RFE: add a usbredirclient, to use with a qemu socket chardev in server mode
Submitted by Cole Robinson
Assigned to Hans de Goede @jwrdegoede
Description
This was originally filed at:
https://bugzilla.redhat.com/show_bug.cgi?id=844657
Moving this to the upstream tracker rather than have it limp along downstream.
USB redirection across the network is a very very usful feature. However, it seems to be limited to Spice based clients because there are no client tools that use the new usbredir package at this time.
As a result of this, usbredir is pretty much limited to Qemu VMs that support this feature.
...
It appears that the usbredirtestclient is infact a protocol testing client rather than an usbredir client that talks to the usbredir-server in the same package.
So I suppose this bug is more of a feature request than a bug :(
Hans replied:
(In reply to Hans de Goede from comment 2)
Hi,
(In reply to comment 1)
It appears that the usbredirtestclient is infact a protocol testing client rather than an usbredir client that talks to the usbredir-server in the same package.
Correct.
So if you want to use usbredir without spice atm you can do that like this:
On the machine which has the physica; usb device you want to share do: sudo usbredirserver 0c45:63f8
Where 0c45:63f8 is the usb id of the device you want to share.
Then after starting the server, start qemu with the following cmdline options added: -readconfig /etc/qemu/ich9-ehci-uhci.cfg
-chardev socket,host=localhost,port=4000,id=usbredirchardev1
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=3 \You can find ich9-ehci-uhci.cfg here: http://cgit.freedesktop.org/spice/qemu/plain/docs/ich9-ehci-uhci.cfg
Or in Fedora-17, with virt-manager, you can change the USB-controller type to "USB 2" and add a TCP USB redirection device.
Note that qemu supports operating as a TCP-server to, so you could use something like: -readconfig /etc/qemu/ich9-ehci-uhci.cfg
-chardev socket,server,port=4000,id=usbredirchardev1
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=3 \And then first start qemu and then have a usbredirserver-like usbredirclient application, connect to the qemu process to give a device to qemu, this way you could also disconnect the usbredir-client, and restart it with a different device, etc.
This does require someone writing a usbredirclient application, this should be easy since all the hard stuf is done by using libusbredirhost , if you look at libusbredirserver it is very small, just doing the tcp and driving the libusb select loop.
The easiest way to get a usbredirclient is probably to just modify usbredirserver.c so that when started with an extra cmdline option instead of listening it tries to build a connection to a given hostname:port itself, re-using the select loop, and other stuff from usbredirserver. This is actually a pretty easy project for some one to do, and patches for this are certainly welcome.
Regards,
Hans