Messages in this thread | | | Date | Fri, 05 Aug 2011 10:18:01 +0200 | From | Hans de Goede <> | Subject | Re: USB mini-summit at LinuxCon Vancouveroliver |
| |
Hi,
On 08/05/2011 09:59 AM, Oliver Neukum wrote: > Am Freitag, 5. August 2011, 09:45:56 schrieb Hans de Goede: >> This is the issue on which I feel a bit stonewalled. Simple putting your >> fingers in your ears and singing la la la do it in userspace is not going >> to cut it here. There is no way to do this race free in userspace, unless >> all possible callers of mount get modified. Moreover 99% of the necessary >> accounting for this is already done in the kernel. We already have the notion >> of a block device being in use. We simply need to add some code to pass >> this notion to the usb mass storage driver, and add a new try_disconnect >> callback for usb drivers. I'm not saying this is going to be completely >> straight forward, but it ain't rocket science either. And it so very >> obviously is the right thing to do, that I'm getting very tired of >> the do it in userspace song I keep hearing. > > Doing a try_disconnect() would also solve the dual camera issue. > But it doesn't really interfere with the user space vs. kernel space > issue. You simply have to expand the ioctl interface to have > an ioctl that triggers this API call in the kernel. > > A V4L2 device would return an error if its device node is opened, > otherwise disconnect.
Getting a bit offtopic here, but no a try_disconnect will fix the userspace stillcam mode driver being able to disconnect the device while the webcam function is active. If the webcam is not active userspace will still "win", and possibly never return the device back to the kernel driver (this already happens today with gvfs-gphoto creating a fuse mount and keeping the device open indefinitely, locking out the webcam function).
Likewise a v4l2 control panel like app (think alsamixer for videodevs to set brightness / contrast, etc.) can keep the /dev/video node open indefinitely. Unless we rewrite most of userspace, we need to allow the device to be open in bode modes *at the same time* and only fail with -EBUSY when something really exclusive is requested (so not just having the device open, or setting contrast, but trying to stream and read/delete pictures from the stillcam memory at the same time).
Regards,
Hans
| |