No go for me, maybe I'm running the wrong version of virsh?
virsh # attach-device XPJohn usbPhone2.xml
libvir: QEMU error : unknown device type
error: Failed to attach device from usbPhone2.xml
virsh # version
Compiled against library: libvir 0.4.0
Using library: libvir 0.4.0
Using API: QEMU 0.4.0
Running hypervisor: QEMU 0.9.1
[root@e6400:/etc/libvirt/ 482]$virsh list
Connecting to uri: qemu:///system
Id Name State
----------------------------------
1 XPJohn running
2 ubuntuVNC running
3 webserver running
4 XPTest running
[root@e6400:/etc/libvirt/ 481]$lsusb
Bus 007 Device 004: ID 0bb4:0b2e High Tech Computer Corp.
Bus 007 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
[root@e6400:/etc/libvirt/ 481]$cat usbPhone2.xml
<hostdev mode='subsystem' type='usb'>
<source>
<address bus='7' device='4'/>
</source>
What am I doing wrong?
-Jay
-----Original Message-----
From: Cole Robinson [mailto:crobinso@redhat.com]
Sent: Sunday, February 22, 2009 6:09 PM
To: Fedora/Linux Management Tools
Cc: Libvirt; jmandawg(a)hotmail.com
Subject: Re: [et-mgmt-tools] attach hot usb device
cc-ing libvir-list (future libvirt questions should be directed there)
jmandawg wrote:
> Hi,
>
>
>
> Quick question, since I can't get to the qemu monitor anymore, how do I
> hot add a usb device (smartphone)?
>
> Is it possible to do through virsh?
>
Sure:
- Use 'lsusb' to determine the bus and device. Example listing looks like:
Bus 001 Device 006: ID 0781:5151 SanDisk Corp. Cruzer Micro 256/512MB
Flash Drive
- Put hostdev xml in a file:
cat << __EOF__ > usb.xml
<hostdev mode='subsystem' type='usb'>
<source>
<address bus='1' device='6'/>
</source>
</hostdev>
__EOF__
- Run 'virsh attach-device {VMNAME} usb.xml' on a running VM.
Hope that helps,
Cole