[Spice-devel] Questions on usbredir + XSpice redux, libusb anyone?

Hans de Goede hdegoede at redhat.com
Mon Apr 13 23:14:17 PDT 2015


Hi,

On 13-04-15 21:40, Jeremy White wrote:
> Hi folks,
>
> I've done some work on a usbredir kernel module to bring support for USB
> to XSpice.   In doing so, and talking with some colleagues, their
> reaction was:  why don't you modify libusb instead?
>
> That is, the current change is to modify XSpice to pipe the USBREDIR
> protocol bytes out to a unix domain socket, and then into the kernel
> module from there.  However, if you think about it, most Linux
> applications (e.g. most apps running inside an XSpice session) are going
> to use libusb to access the USB devices.
>
> So then the question - why not modify libusb to detect devices from the
> unix domain socket instead of making the round trip through the kernel?
>   It has the benefit of letting you keep the traffic and the files in
> userspace, and avoiding sharing devices system wide.  The main downside
> would seem to be that non libusb devices (e.g. thumb drives et all)
> would not be supported.  For our use case, that limitation is not an
> issue, and the simplicity is compelling.
>
> I wanted to share this idea to make sure there wasn't something else we
> were missing and to see what others think.

"most Linux applications ... are going to use libusb to access the USB devices."

That is not true, applications using libusb rather then a kernel driver
are the exception not the rule. Basically the only major applications using
libusb are sane (scanners) and libgphoto2 (still photo cameras), anything
else, webcams, usb audio, hid devices, usb-sticks, usb-harddisks, dvb receivers,
printers (*), etc. is all using kernel drivers.

Regards,

Hans

*) Yes some printer backends may use libusb, this is usually done to get
some extra info from the printer using vendor specific commands, the actual
printing is usually still done via /dev/lp and thus through a kernel driver.


More information about the Spice-devel mailing list