60 | | TODO write this section |
| 60 | To make use of the UHCI host controller built-into QEMU, add `-usb` option to the command line. That only initializes the USB but no devices would be present. QEMU emulates some of USB devices by its own or you can bridge real USB device from the host system. Plugging and unplugging can be specified either at the command line or from QEMU console at runtime. |
| 61 | |
| 62 | === Bridging of host devices === |
| 63 | |
| 64 | The following example assume you are running Linux box and you are able to pin-point the device you want to bridge to QEMU in `lsusb` output. The `lsusb` output can look like this |
| 65 | {{{ |
| 66 | Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub |
| 67 | Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub |
| 68 | Bus 002 Device 074: ID 04f2:0403 Chicony Electronics Co., Ltd KU-0420 keyboard |
| 69 | }}} |
| 70 | |
| 71 | If you want to bridge the Chicony keyboard, you add another option ``-usbdevice`` with parameter ``host:2.74`` where '''2''' denotes bus number and '''74''' device number. Notice that the delimiter is a period instead of colon that is used when filtering ``lsusb`` output. |
| 72 | |
| 73 | {{{ |
| 74 | qemu-system-x86_64 -cdrom image.iso -usb -usbdevice host:2.74 |
| 75 | }}} |
| 76 | |
| 77 | Depending on your OS settings, you may need to run QEMU with higher privileges. |
| 78 | |
| 79 | QEMU will grab the device from your OS and you will no longer be able to use it in the host system (rather do not try it). When QEMU terminates, it releases the control. Depending on your OS and QEMU version you are using, it might be needed to physically reattach the device, before the host OS can work with it again. |
| 80 | |
| 81 | |
| 82 | === Emulated devices === |
| 83 | |
| 84 | QEMU by itself is able to emulate keyboard, mouse, tablet and a mass storage backed by a file representing disk image. To use emulated keyboard and mouse, run QEMU like this. |
| 85 | |
| 86 | {{{ |
| 87 | qemu-system-x86_64 -cdrom image.iso -usb -usbdevice keyboard -usbdevice mouse |
| 88 | }}} |
| 89 | |
| 90 | Note that using the emulated USB keyboard disables the standard AT keyboard, thus you will not be able to use kernel console (more details at discontinued [https://sourceforge.net/apps/trac/helenos-usb/ticket/33 USB Trac]). |
| 91 | |
| 92 | The disk image is specified as `disk:filename`. Following command shall create an illusion that `image.iso` is on a mass storage device plugged to the machine: |
| 93 | |
| 94 | {{{ |
| 95 | qemu-system-x86_64 -cdrom image.iso -usb -usbdevice disk:image.iso |
| 96 | }}} |
| 97 | |
| 98 | |
| 99 | === Working with USB devices in the control console |
| 100 | |
| 101 | TODO |
| 102 | |