USB forwarding from dom0 to domU

Posted on

USB forwarding from dom0 to domU – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, xen, usb, , .

What are my options to forward two USB connected phones to xen guest?

I’ve read about PCI-passthrough, but I’m sure usb controller in the server isn’t a pci card.

There’s device level forwarding, but I need to forward two devices, this here doesn’t say how to do it:

Would something as simple as:

usbdevice = [


EDIT: I’m now starting a bounty. This is really important for me and for other people also, hoping someone who have this resolved will be able to help.

Solution :

I use Xen with USB passthrough to my domU on Centos5.

So far I can tell:
Forward the complete USB-stuff or nothing.
Do not try to forward only some OHCI/UHCI devices.

So here it runs more or less (haven’t started a stress test yet):

  1. Disconnect all USB devices
  2. Unload the USB devices from dom0 via pciback. Unload UHCI/OHCI and EHCI devices. (Write some kind of init.d script for your needs). Details about pciback are here under point 1
  3. Restart xend
  4. lsusb should output nothing on dom0
  5. edit you domU configuration file with the pci = [ ‘0000:yy:xx.0’] stuff
  6. Start your domU
  7. domU should report USB devices via lspci (other pciids) and lsusb

My dom0 is booted with kernel-parameter noirqdebug (grub).

I can confirm that above approach works under the following preconditions:

  • Xen 3.4.3
  • CentOS 5.5 host, kernel 2.6.18-194.32.1.el5xen x86_64
  • CentOS 5.5 guest, kernel 2.6.18-194.32.1.el5xen x86_64

    1. I removed all attached USB devices.
    2. rmmod uhci_hcd ohci_hcd ehci_hcd
    3. Figure out which USB hub is attached to which connectors
    4. Added hiding for some of the USB ports


options pciback hide=(0000:00:1a.0)(0000:00:1a.1)(0000:00:1a.7)
  1. Restarted xend: /etc/init.d/xend restart
  2. Configured the VM config:


usb = 1 # Probably irrelevant
pci = [ '0000:00:1a.0', '0000:00:1a.1', '0000:00:1a.7' ]
  1. Recreated the VM (xm destroy / xm create):


Loading ehci-hcd.ko module
PCI: Enabling device 0000:00:00.7 (0000 -> 0002)
ehci_hcd 0000:00:00.7: EHCI Host Controller
ehci_hcd 0000:00:00.7: new USB bus registered, assigned bus number 1
ehci_hcd 0000:00:00.7: debug port 1
ehci_hcd 0000:00:00.7: irq 17, io mem 0xdf0fe000
ehci_hcd 0000:00:00.7: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 4 ports detected
Loading ohci-hcd.ko module
Loading uhci-hcd.ko module
USB Universal Host Controller Interface driver v3.0
PCI: Enabling device 0000:00:00.0 (0000 -> 0001)
uhci_hcd 0000:00:00.0: UHCI Host Controller
uhci_hcd 0000:00:00.0: new USB bus registered, assigned bus number 2
uhci_hcd 0000:00:00.0: irq 19, io base 0x0000ec40
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
PCI: Enabling device 0000:00:00.1 (0000 -> 0001)
uhci_hcd 0000:00:00.1: UHCI Host Controller
uhci_hcd 0000:00:00.1: new USB bus registered, assigned bus number 3
uhci_hcd 0000:00:00.1: irq 20, io base 0x0000ec60
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
usb 1-3: new high speed USB device using ehci_hcd and address 2
usb 1-3: configuration #1 chosen from 1 choice
hub 1-3:1.0: USB hub found
hub 1-3:1.0: 4 ports detected
usb 1-3.2: new full speed USB device using ehci_hcd and address 3
usb 1-3.2: configuration #1 chosen from 1 choice
  1. Achieved nirvana.

Your best bet is to put the phone on a retired desktop and run whatever you need on bare metal. Yeah it sucks!

Leave a Reply

Your email address will not be published. Required fields are marked *