分类: LINUX
2011-09-24 14:51:49
~jwrdegoede
With the new libusb in place, it is time to build the non qemu parts of the usbredir code
(a standalone server, as well as the usbredir protocol parser and host libraries):
git clone
cd usbredir
make PREFIX=/usr LIBDIR=/usr/lib64
sudo make PREFIX=/usr LIBDIR=/usr/lib64 install
And now lets build qemu with usbredir support (note I enable spice + spices smartcard support here, since that is
what I use in my day to day testing, this is not strictly needed).
git clone
cd qemu
git checkout usbredir
./configure --prefix=/usr --enable-smartcard-nss --enable-smartcard --enable-spice --target-list=x86_64-softmmu
make
sudo install -m0755 -p x86_64-softmmu/qemu-system-x86_64 "/usr/bin"
Note do not use make install, this will also install the BIOS roms from qemu git which are outdated, this assumes that you already have a recent qemu installed and will be using the BIOS roms from that version.
Now start qemu with all the options you use normally and "-usb" or "-usb -device usb-ehci" for USB2 support. To test the network redirection, start the usbredirserver in another terminal, lets say you want to redirect a usb device with vid:pid 045e:0772, then start usbredirserver like this:
usbredirserver 045e:0772
And then in the qemu monitor cmdline type:
usb_add tcp-redir:localhost:4000
Notes:
1) replace localhost with the ip or hostname of the other machine if you're actually testing this over the network
2) you can start multiple servers to redirect multiple devices on the same machine, add " -p 4001" to start a second server on port 4001, and make the 4000 4001 in the usb_add command
3) To unplug a device do a usb_del with the exact same arguments as you passed to the usb_add command
If you're interested in the network protocol used for the usb redirection, see:
~jwrdegoede/qemu/tree/?h=usbredir