Linux - kvm - How to use USB devices?
0) Close the Virtual Machine Manager or any instance of VM
1) Locate vendor/product id from your device
Example:
shell> lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 004: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 003: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 002: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID eb1b:3212 "blah Technology, Inc. "
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Once you know your vendor and product id:
Vendor id: 0xeb1b
Product id: 0x3212
2) Edit the xml config file from your VM
Example:
shell> vi /etc/libvirt/qemu/NAME_OF_YOUR_VIRTUAL_M ACHINE_HERE.xml
Add the following lines:
Example:
<devices> (do not include this line)
<emulator>/usr/bin/qemu-kvm</emulator> (do not include this line)
<hostdev mode='subsystem' type='usb'>
<source>
<vendor id='0xeb1b'/>
<product id='0x3212'/>
</source>
</hostdev>
3) Save and restart libvirt
shell> /etc/init.d/libvirtd restart
4) Now just start your VM and test if your usb was detectd:
shell from VM> lsusb
Bus 001 Device 002: ID eb1b:3212 "blah Technology, Inc. "
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Done!
1) Locate vendor/product id from your device
Example:
shell> lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 004: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 003: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 002: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID eb1b:3212 "blah Technology, Inc. "
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Once you know your vendor and product id:
Vendor id: 0xeb1b
Product id: 0x3212
2) Edit the xml config file from your VM
Example:
shell> vi /etc/libvirt/qemu/NAME_OF_YOUR_VIRTUAL_M
Add the following lines:
Example:
<devices> (do not include this line)
<emulator>/usr/bin/qemu-kvm</emulator>
<hostdev mode='subsystem' type='usb'>
<source>
<vendor id='0xeb1b'/>
<product id='0x3212'/>
</source>
</hostdev>
3) Save and restart libvirt
shell> /etc/init.d/libvirtd restart
4) Now just start your VM and test if your usb was detectd:
shell from VM> lsusb
Bus 001 Device 002: ID eb1b:3212 "blah Technology, Inc. "
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Done!

Comments