Re: RFC: allow usb drivers to disallow USBDEVFS_DISCONNECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 01/12/2010 09:01 PM, Greg KH wrote:
Fixing userspace bugs with kernel driver changes seems a bit harsh :)

Oh I completely agree, and I also agree that apps which looses their
/dev/video device because of unplug should handle that properly, still
the stealing of the device from the webcam app by libgphoto apps is
unwanted behavior in my book, and that is what I'm trying to fix.

Then fix libgphoto please.  I don't see a kernel issue here yet.


Well libgphoto2 politely asks the kernel, can you please release usb device
foo for userspace use ? I'm asking for drivers to have the possibility to
say: No sorry, the device is in use.

This does not seem something strange to me. This can be hacked around
in libgphoto by:

1) Adding code to match the usb device to a /dev/video
2) If it matches a /dev/video, open that (this will work multiple opens
   are allowed)
3) Try to start a stream (yes because we really want libgphoto2 to
   have to start the webcam)
4) If 3) fails with ebusy, an other app is already streaming, don't ask
   the kernel to release the device.
5) If 3) does not fail, close the device and continue

That would be a gross hack, but that would be the way to "fix" libgphoto2 .

Or we could have the please release the device call return -EBUSY, which
almost every other single syscall in the kernel will do when a single use
device is already in use by another application.

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux