Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

I've read about PCI-passthrough http://www.wlug.org.nz/XenPciPassthrough, 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: http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/

Would something as simple as:

usbdevice = [ 'host:xxx', 'host:yyy', ]

work?

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.

share|improve this question
    
Any update on this? I'm in the process of trying to figure this out myself as I have a couple of USB dongles that need to be passed through to a DomU. I think I have all the dots lined up and hope to connect them all tomorrow. I'll post my solution if it works. –  3dinfluence Jul 14 '09 at 23:44
    
As far as I know, there's no official way of forwarding multiple devices for domU, there's some effort with XEN patching involved, read about it here: lists.xensource.com/archives/html/xen-users/2009-03/… I've followed these steps but didn't have the chance to test real devices (two phones for Nagios alerting), hence no updates. AFAIK another problem is that devices passed in such way lose "hot swap" ability, I can't confirm this yet, but if that's the case - it's a real problem for me. –  Karolis T. Jul 15 '09 at 6:23
    
And pciback approach doesn't work? –  3dinfluence Jul 15 '09 at 15:03
    
I have tried these patches, it didn't work, lsusb has empty output. I have not tried pciback approach, but I've read that it might cause some problems and is not considered stable, I'm not willing to implement a nonstable solution just now. –  Karolis T. Jul 27 '09 at 10:47
    
Just to report back. I haven't had any luck either. Even tried Xen 3.4 without any luck. I'll try what Zeeman has suggested once I get a chance though. –  3dinfluence Jul 29 '09 at 23:54
show 1 more comment

3 Answers

up vote 4 down vote accepted
+75

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).

share|improve this answer
    
I'll try this over the weekend and report back, however, could you be more specific about unloading UHCI/OCHI/EHCI devices? Do you mean rmmod'ing corresponding kernel modules? Where is noirqdebug put, in grub (presumably?) config? Thanks! –  Karolis T. Jul 30 '09 at 17:51
    
I have moved all my services to dom0 from this machine, battling with USB was not worth it. I could have selected your answer if you'd been more specific, now it wasn't that helpful to be honest. –  Karolis T. Aug 3 '09 at 14:03
add comment

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

/etc/modprobe.conf:

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:

/etc/xen/auto/vm:

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):

dmesg:

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.
share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.