2010-12-03 16:17:28 +01:00
|
|
|
|
2011-05-31 12:21:43 +02:00
|
|
|
More USB tips & tricks
|
|
|
|
======================
|
|
|
|
|
2018-06-05 15:29:15 +02:00
|
|
|
Recently the USB pass through driver (also known as usb-host) and the
|
|
|
|
QEMU USB subsystem gained a few capabilities which are available only
|
2011-05-31 12:21:43 +02:00
|
|
|
via qdev properties, i,e. when using '-device'.
|
|
|
|
|
|
|
|
USB pass through hints
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
The usb-host driver has a bunch of properties to specify the device
|
|
|
|
which should be passed to the guest:
|
|
|
|
|
|
|
|
hostbus=<nr> -- Specifies the bus number the device must be attached
|
|
|
|
to.
|
|
|
|
|
|
|
|
hostaddr=<nr> -- Specifies the device address the device got
|
|
|
|
assigned by the guest os.
|
|
|
|
|
|
|
|
hostport=<str> -- Specifies the physical port the device is attached
|
|
|
|
to.
|
|
|
|
|
|
|
|
vendorid=<hexnr> -- Specifies the vendor ID of the device.
|
|
|
|
productid=<hexnr> -- Specifies the product ID of the device.
|
|
|
|
|
|
|
|
In theory you can combine all these properties as you like. In
|
|
|
|
practice only a few combinations are useful:
|
|
|
|
|
|
|
|
(1) vendorid+productid -- match for a specific device, pass it to
|
|
|
|
the guest when it shows up somewhere in the host.
|
|
|
|
|
|
|
|
(2) hostbus+hostport -- match for a specific physical port in the
|
|
|
|
host, any device which is plugged in there gets passed to the
|
|
|
|
guest.
|
|
|
|
|
|
|
|
(3) hostbus+hostaddr -- most useful for ad-hoc pass through as the
|
|
|
|
hostaddr isn't stable, the next time you plug in the device it
|
|
|
|
gets a new one ...
|
|
|
|
|
|
|
|
Note that USB 1.1 devices are handled by UHCI/OHCI and USB 2.0 by
|
|
|
|
EHCI. That means a device plugged into the very same physical port
|
2018-06-05 15:29:15 +02:00
|
|
|
may show up on different buses depending on the speed. The port I'm
|
2011-05-31 12:21:43 +02:00
|
|
|
using for testing is bus 1 + port 1 for 2.0 devices and bus 3 + port 1
|
|
|
|
for 1.1 devices. Passing through any device plugged into that port
|
|
|
|
and also assign them to the correct bus can be done this way:
|
|
|
|
|
2013-04-02 12:15:24 +02:00
|
|
|
qemu -M pc ${otheroptions} \
|
|
|
|
-usb \
|
|
|
|
-device usb-ehci,id=ehci \
|
|
|
|
-device usb-host,bus=usb-bus.0,hostbus=3,hostport=1 \
|
2011-05-31 12:21:43 +02:00
|
|
|
-device usb-host,bus=ehci.0,hostbus=1,hostport=1
|
|
|
|
|
2010-12-03 16:17:28 +01:00
|
|
|
enjoy,
|
|
|
|
Gerd
|
|
|
|
|
|
|
|
--
|
|
|
|
Gerd Hoffmann <kraxel@redhat.com>
|