Topic
1 reply Latest Post - ‏2012-04-12T17:02:55Z by SystemAdmin
SystemAdmin
SystemAdmin
2364 Posts
ACCEPTED ANSWER

Pinned topic USB passthrough with KVM

‏2012-04-12T15:14:51Z |
I'm setting up a VM host to build clients for testing hardware, many of the hardware devices are connected to USB and they show the exact same vendor and product ID so my XML would appear as:


<domain type=
'kvm'> <name>WINXP32</name> … <devices> … <hostdev mode=
'subsystem' type=
'usb' managed=
'yes'> <source> <vendor id=
'0x04b3'/> <product id=
'0x4557'/> </source> </hostdev> <hostdev mode=
'subsystem' type=
'usb' managed=
'yes'> <source> <vendor id=
'0x04b3'/> <product id=
'0x4557'/> </source> </hostdev> </devices> </domain>


Is there no way to specify the bus?

lsusb shows:

Bus 007 Device 003: ID 04b3:4557 IBM Corp. Bus 004 Device 003: ID 04b3:4557 IBM Corp.


I'm not sure how to tell which devices are being used by which machine here.
Updated on 2012-04-12T17:02:55Z at 2012-04-12T17:02:55Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2364 Posts
    ACCEPTED ANSWER

    Re: USB passthrough with KVM

    ‏2012-04-12T17:02:55Z  in response to SystemAdmin
    I've figured out half of the problem, I used:

    
    <domain type=
    'kvm'> <name>WINXP32</name> … <devices> … <hostdev mode=
    'subsystem' type=
    'usb' managed=
    'no'> <source> <vendor id=
    '0x04b3'/> <product id=
    '0x4557'/> <address bus=
    '7' device=
    '4'/> </source> <alias name=
    'hostdev0'/> </hostdev> <hostdev mode=
    'subsystem' type=
    'usb' managed=
    'no'> <source> <vendor id=
    '0x04b3'/> <product id=
    '0x4557'/> <address bus=
    '4' device=
    '4'/> </source> <alias name=
    'hostdev1'/> </hostdev> </devices> </domain>
    


    but whenever I do
    
    virsh start WINXP32 virsh dumpxml WINXP32
    


    it changes to
    
    <domain type=
    'kvm'> <name>WINXP32</name> … <devices> … <hostdev mode=
    'subsystem' type=
    'usb' managed=
    'no'> <source> <vendor id=
    '0x04b3'/> <product id=
    '0x4557'/> <address bus=
    '7' device=
    '4'/> </source> <alias name=
    'hostdev0'/> </hostdev> <hostdev mode=
    'subsystem' type=
    'usb' managed=
    'no'> <source> <vendor id=
    '0x04b3'/> <product id=
    '0x4557'/> <address bus=
    '7' device=
    '4'/> </source> <alias name=
    'hostdev1'/> </hostdev> </devices> </domain>
    


    Why is the address for the two different devices changing when I start the VM?