USB Physical Port Mapping: Difference between revisions
Jump to navigation
Jump to search
(Link to new article USB_Devices_in_Virtual_Machines) |
(cosmetic) |
||
Line 1: | Line 1: | ||
The main reason to use physical USB port mapping is to be able to connect several usb devices which have the same IDs to different virtual machines (device-1 to VM1, device-2 to VM2, etc). | The main reason to use physical USB port mapping is to be able to connect several usb devices which have the same IDs to different virtual machines (device-1 to VM1, device-2 to VM2, etc). | ||
Line 70: | Line 68: | ||
* [[Manual: vm.conf|man vm.conf]] | * [[Manual: vm.conf|man vm.conf]] | ||
* http://www.kraxel.org/cgit/qemu/tree/docs/usb2.txt | * http://www.kraxel.org/cgit/qemu/tree/docs/usb2.txt | ||
== See laso == | |||
* [[USB Devices in Virtual Machines]] - general aspects about assigning USB devices to VMs can be found |
Revision as of 11:19, 16 January 2015
The main reason to use physical USB port mapping is to be able to connect several usb devices which have the same IDs to different virtual machines (device-1 to VM1, device-2 to VM2, etc).
Map hardware USB port
Find out physical port parameters (bus and port)
Through Qemu/KVM tool (simpler)
qm monitor <VM_ID> qm> info usbhost Bus 3, Addr 2, Port 1.2, Speed 1.5 Mb/s Vendor Specific: USB device 0529:0001, HASP 2.17 Bus 5, Addr 3, Port 2, Speed 12 Mb/s Class 00: USB device 0624:0248, USB Composite Device-0
- Example: Bus 3, Port 1.2 => 3-1.2
Or from the host
lsusb -t /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M |__ Port 1: Dev 4, If 0, Class=vend., Driver=usbfs, 1.5M |__ Port 2: Dev 5, If 0, Class=vend., Driver=usbfs, 1.5M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M |__ Port 3: Dev 5, If 0, Class=comm., Driver=usbfs, 480M |__ Port 3: Dev 5, If 1, Class=data, Driver=usbfs, 480M
- Example 1: Bus 3, Port 1 => 3-1
- Example 2: Bus 1, Port 1, Port 3 => 1-1.3
Add the device to the VM
Proxmox 2.x and later
Edit the VM's configuration file /etc/pve/qemu-server/<VM_ID>.conf and add this line:
- Example:
usb0: host=3-1.2
- Examples 1 & 2:
usb0: host=3-1 usb1: host=1-1.3
Proxmox 1.x
- Example 1:
args: -device usb-host,hostbus=3,hostport=1.2
- Example 1:
args: -device usb-host,hostbus=3,hostport=1
- Example 2:
args: -device usb-host,hostbus=1,hostport=1.3
Stop and restart the VM
Stop and start the VM (a reboot is not enought).
Check that the USB devices are seen by the VM:
qm monitor <VM_ID> qm> info usb Device 0.2, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet Device 0.3, Port 2, Speed 12 Mb/s, Product QEMU USB Hub Device 1.1, Port 1, Speed 1.5 Mb/s, Product HASP 2.17 Device 1.0, Port 2, Speed 480 Mb/s, Product USB Host Device
References
See laso
- USB Devices in Virtual Machines - general aspects about assigning USB devices to VMs can be found