On Mon, Dec 02, 2002, Duncan Haldane <f.duncan.m.haldane@xxxxxxxxxxxxxxxx> wrote: > If you have a USB webcam please let me know what happens if you > disconnect its usb cable while it is streaming images to a v4l viewer > (e.g. xawtv) > > > I'm trying to understand what the "normal" behaviour of a USB > v4l1 webcam should be (and what it actually is) > when the usb cable is just yanked out and > the /dev/video<n> it is connected to disappears. > > (even if the cable is not yanked, 2.4.x usb/hub.c can > simulate this if the USB hub bandwidth is overloaded, which > it seems to intepret as "Electromagnetic Interference (EMI) > due to bad cables", according to an error message.... ) That's usually related to power overload, but can be related to other things. It really has nothing to do with bandwidth oversubscription. > I'm working on maintaining the cpia driver, and this causes a nasty hang of > the v4l application (xawtv, gqcam...) when one tries to close > the app, the app (and the kernel driver) are left in a frozen "busy" state that > can only be cleared by a reboot.... Sounds like a bug. I'll take the blame since I originally wrote the code :) > The same thing happens when I yank the usb cable of a running ov511 > cam, so its not just a cpia issue.... > (I only have cpia and ov511 cams to test with). Could be because ov511 was based on the original cpia code so it has the same bug? > Do *any* usb v4l1 webcams + apps behave nicely when the cable > is yanked? (I would like to hear about > actual behavior, not just theoretical!) I don't think the actual behavior is that interesting. It shouldn't hang like that, period. > I would guess what *should* happen is that image on the > v4l app freezes (I see this), but the app should be closable and the > kernel module unloadable before the app is closed. Just to clarify. The kernel module can only be unloaded when the v4l device is closed by the application. > In my case, I see that deregistration of the cpia module is postponed > until I attempt to close the app, (which until then shows a frozen image, > and is producing lots of error messages that the image can't be found) > and then the hang occurs. I'd guess this is because the v4l app still has the v4l device open, causing the module use count to be > 0. > The XFree86 desktop still functions OK, but it hangs > if I attempt to log out. (because the v4l app cant be > shut down). > > Thanks for any info about how other drivers/apps handle this. Is the application stuck in uninterruptible? Can you kill it with SIGKILL? JE