USB is different
Posted Jan 29, 2004 16:04 UTC (Thu) by HalfMoon
Parent article: User-space device drivers
This Gelato approach would seem to be focussed on a particular
style of userspace driver, which works on non-virtualized devices.
Specifically, it aims for PCI (or ISA) style devices, where
the device driver needs to touch "real hardware".
USB is a good example of a different style driver, one where
the device driver can't touch the hardware. In fact you can
view USB drivers as the clients in a client/server framework,
with the "server" being the device.
The bus is really a special purpose network link, used to
exchange packets between device and host.
(And always initiated by the host, not the device/"server".)
So userspace USB drivers
work with virtualized devices ... they start with a formalized
protocol to talk with the hardware, which doesn't involve
register access, IRQs, or memory mapping except indirectly.
There are two approaches right now to userspace USB drivers.
- The original "usbfs" (or "usdevfs"), which is in
sore need of replacement. It's ioctl-heavy, and multiplexes
I/O streams (up to 32 per device) into one file descriptor.
And it defines its own async I/O primitives.
So while a Java API exists, it's awkward.
- "gadgetfs" runs inside USB devices. It's got
hardly any ioctls, and uses one file descriptor per I/O stream.
Current versions of gadgetfs (not yet in Linux 2.6) use standard
AIO calls to support data streaming from userspace.
There are discussions underway to create "usbfs2", which
should eventually replace "usbfs".
It'll look much more like gadgetfs than "usbfs", with few
ioctls and using the standard AIO framework.
So that's something else to keep in mind. This Gelato
framework doesn't seem like it'd work well with USB, or
with other device models that have already upleveled and
virtualized their hardware.
to post comments)