Quite a few readers have been asking about support for usb devices using the virt-manager management tool so I thought I’d write a short post about it. The bad news is that virt-manager currently does not support usb device passthrough. The reason is because virt-manager uses the libvirt C library for access to these hypervisor features and the current version of libvirt (0.4.4) does not support usb device passthrough.

The only consolation is that since 0.4.4, support for usb devices is being baked so the next release of libvirt will be supporting USB devices. In fact there’s already syntax that can be used with your xml configuration files describing your domains. The syntax is as follows:
<hostdev mode='subsystem' type='usb'> <source> <vendor id='0x1234'/> <product id='0x5678'/> </source> </disk>
Until then, the only way to use the usb device passthrough is directly from the command line or via the monitor interface. From the command line you need the –usb and –usbdevice options when starting up your virtual machine like so:
qemu-system-x86_64 -m 400 –hda windows.img –usb –usbdevice host:1234:5678
Go to your monitor using Ctrl-Alt-2 and from within the monitor with your usb device connected run the following command to get the id of your usb device.
(qemu) info usbhost
You’ll see a list of usb devices connected to your host. Now add your usb device to your guest with the following command.
(qemu) usb_add host:1234:5678
Your usb device will now show up in your guest virtual machine.
Comments
A small correction to the code that is listed....
Tuesday, May 5, 2009 - 15:22 Dan Ratje (not verified)Hey... This is exactly what I needed to get my virtual XP going in linux. The only comment that I might make is you may need to change the to
Thanks!
Post new comment