Web lists-archives.com

[Spca50x-devs] gspca freezing when device in use is removed.


I'm having a problem with the gspca driver. If a program is accessing an usb 
webcam supported by the gspca driver and meanwhile the webcam is removed, the 
program freezes.
It's a problem because I cannot get around the freeze in a sane way. Other 
drivers, as the uvc, return an EINVAL (22), allowing a program(mer) to take 
the proper measures to handle the error.
I'm the main KDE's Kopete IM and Solid/Phonon maintainer for webcam support, 
and our team found this problem and we're asking for help from you driver 
KDE4 uses Solid, a device discovery with hotplugging support that, in Linux, 
uses hal to do it's job. Currently it detects the present v4l/v4l2 devices, 
and issues alerts when devices are connected/disconnected.
If a device is disconnected while in use, it doesn't issue an alert until the 
device's file handle is closed, by means of a close() call of killing the 
program (as it closes program's all open files). So a program should get an 
error condition to be able to detect the device was disconnected, then close 
the file handle and handle gracefuly the disconnection, and hal would update 
its info about connected devices. It's how it works with uvc drivers. But 
with gspca driver, it blocks when the device is no longer present, freezing 
the application, so it's unable to close the file handle, and hal will not be 
updated until we kill the frozen process by hand.
I cannot see any easy (or at least feasibly) way around this problem, so I'm 
asking for your help.
Kopete is the KDE dafault IM program, and thousands of people use it daily. 
Finding a way to resolve this issue (maybe making gspca return an EINVAL when 
it can no longer access the device instead of blocking - it doesn't recover 
when you plug the device again) would benefit not only those users, but all 
Linux users who rely on hal. It would open a way to fix long time old bugs 
about programs not handling device disconnection, and allow us all to present 
a better experience to our (gspca, KDE and Linux in general) userbase.

Thanks in advance,

Cláudio da Silveira Pinheiro
KDE/Kopete developer

This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
Spca50x-devs mailing list