Skip to contentSkip to conversation

Detecting webcam unplugging

DISCUSSION Fabrice Nansi 1 participant 1 message Jun 2, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi Gilles,

----- Message d'origine ----

Quoted 16 lines

De : Gilles GIGAN <[email protected]>
À : [email protected]
Envoyé le : Lundi, 2 Juin 2008, 8h49mn 02s
Objet : Detecting webcam unplugging

Hi all,
I have written a small app which uses V4L1 & V4L2 to do streaming captures from video sources (mostly webcams).
Capture works perfectly. However, if a webcam is unplugged during the capture, the app hangs on ioctl(VIDIOCSYNC) if the source uses a V4L1 driver whereas, for V4L2, the ioctl(VIDIOC_DQBUF) fails instead of just hanging. So, is there a reliable way to detect when a V4L1 video source has become unavailable ?
I tested my app with the following V4L1 drivers:
gspca (01.00.20) and qc-usb (0.6.6)

Quoted 3 lines

Thanks,
Gilles
--

You can solve your problem using the HAL daemon (http://www.freedesktop.org/wiki/Software/hal).
The HAL library provides 2 callbacks LibHalDeviceAdded and LibHalDeviceRemoved and a function libhal_device_property_watch_all() that you can use.

Regards.
Fabrice

__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list