On Thu, 11 Aug 2011, Hans de Goede wrote:
The alternative seems to be to define a device-sharing protocol for USB
drivers. Kernel drivers would implement a new callback (asking them to
give up control of the device), and usbfs would implement new ioctls by
which a program could ask for and relinquish control of a device. The
amount of rewriting needed would be relatively small.
A few loose ends would remain, such as how to handle suspends, resumes,
resets, and disconnects. Assuming usbfs is the only driver that will
want to share a device in this way, we could handle them.
Hans, what do you think?
First of all thanks for the constructive input!
When you say: "device-sharing protocol", do you mean 2 drivers been
attached, but only 1 being active. Or just some additional glue to make
hand-over between them work better?
I was thinking that the webcam driver would always be attached, but
from time to time usbfs would ask to use the device. When the webcam
driver gives away control, it remains bound to the device but does not
send any URBs. If it needs to send an URB, first it has to ask usbfs
to give control back.
I'm not claiming that this is a better solution than putting everything
in the kernel. Just that it is a workable alternative which would
involve a lot less coding.