HOWTO:Forwarding a USB device to a Guest VM in Xen on Fedora

This procedure works with fully virtualized VMs. I would assume it works with paravirtualized VMs as well…

Shut down and power off your VM

Unplug and re-plug your USB device to see what it appears as in dmesg,then run
   dmesg | grep ^usb

See these lines?:
   usb 3-2:USB disconnect,address 7
   usb 3-2:new low speed USB device using uhci_hcd and address 8
   usb 3-2:configuration #1 chosen from 1 choice

This indicates that it is connected to Bus 003 as Device 008. Now run this:
   lsusb

Now look a device at Bus 003 Device 008:
   Bus 003 Device 008:ID 04b9:0300 Rainbow Technologies,Inc.

Note the ID…
   04b9:0300

Open the config.sxp file for the domain,usually located at:
   "/var/lib/xend/domains//config.sxp"

Look for a section similar to this:

   (platform
       ((usb 1)
           (device_model /usr/lib64/xen/bin/qemu-dm)
           (boot c)
           (rtc_timeoffset -18008)
           (pae 1)
           (apic 1)
           (localtime 1)
           (acpi 1)
       )
   )
   
Add your USB device:

   (platform
       ((usb 1)
           (device_model /usr/lib64/xen/bin/qemu-dm)
           (boot c)
           (rtc_timeoffset -18008)
           (pae 1)
           (apic 1)
           (localtime 1)
           (acpi 1)
           (usbdevice host:04b9:0300)
       )
   )

Restart xend:
   /etc/init.d/xend restart

Start your VM

Leave a Reply