6 QEMU can emulate a PCI UHCI, OHCI, EHCI or XHCI USB controller. You can
7 plug virtual USB devices or real host USB devices (only works with
8 certain host operating systems). QEMU will automatically create and
9 connect virtual USB hubs as necessary to connect multiple USB devices.
13 Connecting USB devices
14 ~~~~~~~~~~~~~~~~~~~~~~
16 USB devices can be connected with the ``-device usb-...`` command line
17 option or the ``device_add`` monitor command. Available devices are:
20 Virtual Mouse. This will override the PS/2 mouse emulation when
24 Pointer device that uses absolute coordinates (like a touchscreen).
25 This means QEMU is able to report the mouse position without having
26 to grab the mouse. Also overrides the PS/2 mouse emulation when
29 ``usb-storage,drive=drive_id``
30 Mass storage device backed by drive_id (see
31 :ref:`disk_005fimages`)
34 USB attached SCSI device, see
35 `usb-storage.txt <https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb-storage.txt>`__
39 Bulk-only transport storage device, see
40 `usb-storage.txt <https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb-storage.txt>`__
43 ``usb-mtp,rootdir=dir``
44 Media transfer protocol device, using dir as root of the file tree
45 that is presented to the guest.
47 ``usb-host,hostbus=bus,hostaddr=addr``
48 Pass through the host device identified by bus and addr
50 ``usb-host,vendorid=vendor,productid=product``
51 Pass through the host device identified by vendor and product ID
54 Virtual Wacom PenPartner tablet. This device is similar to the
55 ``tablet`` above but it can be used with the tslib library because in
56 addition to touch coordinates it reports touch pressure.
59 Standard USB keyboard. Will override the PS/2 keyboard (if present).
61 ``usb-serial,chardev=id``
62 Serial converter. This emulates an FTDI FT232BM chip connected to
63 host character device id.
65 ``usb-braille,chardev=id``
66 Braille device. This will use BrlAPI to display the braille output on
67 a real or fake device referenced by id.
69 ``usb-net[,netdev=id]``
70 Network adapter that supports CDC ethernet and RNDIS protocols. id
71 specifies a netdev defined with ``-netdev …,id=id``. For instance,
72 user-mode networking can be used with
76 |qemu_system| [...] -netdev user,id=net0 -device usb-net,netdev=net0
79 Smartcard reader device
84 .. _host_005fusb_005fdevices:
86 Using host USB devices on a Linux host
87 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89 WARNING: this is an experimental feature. QEMU will slow down when using
90 it. USB devices requiring real time streaming (i.e. USB Video Cameras)
91 are not supported yet.
93 1. If you use an early Linux 2.4 kernel, verify that no Linux driver is
94 actually using the USB device. A simple way to do that is simply to
95 disable the corresponding kernel module by renaming it from
96 ``mydriver.o`` to ``mydriver.o.disabled``.
98 2. Verify that ``/proc/bus/usb`` is working (most Linux distributions
99 should enable it by default). You should see something like that:
106 3. Since only root can access to the USB devices directly, you can
107 either launch QEMU as root or change the permissions of the USB
108 devices you want to use. For testing, the following suffices:
112 chown -R myuid /proc/bus/usb
114 4. Launch QEMU and do in the monitor:
119 Device 1.2, speed 480 Mb/s
120 Class 00: USB device 1234:5678, USB DISK
122 You should see the list of the devices you can use (Never try to use
123 hubs, it won't work).
125 5. Add the device in QEMU by using:
129 device_add usb-host,vendorid=0x1234,productid=0x5678
131 Normally the guest OS should report that a new USB device is plugged.
132 You can use the option ``-device usb-host,...`` to do the same.
134 6. Now you can try to use the host USB device in QEMU.
136 When relaunching QEMU, you may have to unplug and plug again the USB
137 device to make it work again (this is a bug).