Skip to content
Snippets Groups Projects
Commit ff132160 authored by Florent Gluck's avatar Florent Gluck
Browse files

Added section about USB redirection via SPICE

parent eb5ef868
Branches
No related tags found
No related merge requests found
......@@ -752,6 +752,63 @@ Successfully uninstalled nexus-server
- [Features/CPUHotplug](https://wiki.qemu.org/Features/CPUHotplug)
- [qmp-shell](https://github.com/0xef53/qmp-shell)
## USB redirection
### Introduction
The spice protocol implements USB redirection which allows USB devices plugged in the PC running the spice client (remote-viewer) to be accessible in the guest OS of the VM running on the server (the server runs QEMU with an embedded Spice server).
First, the `qemu-xhci` device must be added to the VM with:
```
-device qemu-xhci
```
Then, for each USB device to be supported and connected (on a different USB port), its vendor ID (`VID`), product ID (`PID`) and an arbitrary redirection name (`REDIR`) must be specified:
```
-chardev spicevmc,name=usbredir,id=REDIR -device usb-redir,filter='-1:-1:-1:-1:0|-1:VID:PID:-1:1',chardev=REDIR
```
As many devices can be specified as necessary, but each redirection name must be unique.
In the syntax above, each USB device is represented by a filter which can match an arbitrary number of devices. The filter's syntax is as follow:
```
<class>,<vendor>,<product>,<version>,<allow>
```
Filters can be chained using the `|` operator. Here are a few examples:
- `-1:-1:-1:-1:1` $\rightarrow$ allows all USB devices
- `-1:-1:-1:-1:0` $\rightarrow$ forbids all USB devices
- `-1:0x123:0x456:-1:1|-1:-1:-1:-1:0` $\rightarrow$ allows USB device 0x123:0x456 and forbids everything else
Here is a real-world example that defines three USB redirections that forbid everything except these three USB devices (VID:PID):
- A SanDisk Cruzer Blade USB key (0781:5567)
- A Prolific Technology USB/serial (067b:2303)
- An Atmel at91sam SAMBA bootloader (03eb:6124)
```
-device qemu-xhci -chardev spicevmc,name=usbredir,id=usbredir1 -device usb-redir,filter='-1:0x0781:0x5567:-1:1|-1:0x067b:0x2303:-1:1|-1:0x03eb:0x6124:-1:1|-1:-1:-1:-1:0',chardev=usbredir1 -chardev spicevmc,name=usbredir,id=usbredir2 -device usb-redir,filter='-1:0x0781:0x5567:-1:1|-1:0x067b:0x2303:-1:1|-1:0x03eb:0x6124:-1:1|-1:-1:-1:-1:0',chardev=usbredir2 -chardev spicevmc,name=usbredir,id=usbredir3 -device usb-redir,filter='-1:0x0781:0x5567:-1:1|-1:0x067b:0x2303:-1:1|-1:0x03eb:0x6124:-1:1|-1:-1:-1:-1:0',chardev=usbredir3
```
### Vendor ID and product ID of interest
| Device description | Vendor ID | Product ID |
|--- |--- |--- |
| Atmel at91sam SAMBA bootloader | 03eb | 6124 |
| Prolific Technology USB/serial | 067b | 2303 |
| MyLab2 serial port | 0403 | 6015 |
| Digilent Analog Discovery 2 | 0403 | 6014 |
| NXP CMSIS-DAP | 1fc9 | 001d |
| Saleae Logic Pro 16 | 21a9 | 1006 |
| Peak USB CAN | 0c72 | 000c |
| Segger J-Link | 1366 | 0101 |
| Xilinx KV260 and KR260 JTAG and UART | 0403 | 6011 |
| Xilinx Nexys Video JTAG | 0403 | 6010 |
| Xilinx Nexys Video UART | 0403 | 6001 |
| USBest Technology USB key | 1307 | 0165 |
| SanDisk Cruzer Blade USB key | 0781 | 5567 |
## Compiling QEMU from source
1. Retrieve QEMU' source code from [https://www.qemu.org/download/](https://www.qemu.org/download/)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment