实现usb功能,在server端的具体操作:
1.安装libusb-1.0.9-rc3、usbredir-0.4.2,编译qemu时添加参数:--enable-usb-redir;
2.在server上目录/etc/qemu下编辑ich9-ehci-uhci.cfg文件:
1 [device "ehci"]
2 driver ="ich9-usb-ehci1"
3 addr = "1d.7"
4 multifunction = "on"
5
6 [device "uhci-1"]
7 driver = "ich9-usb-uhci1"
8 addr = "1d.0"
9 multifunction = "on"
10 masterbus = "ehci.0"
11 firstport = "0"
12
13 [device "uhci-2"]
14 driver = "ich9-usb-uhci2"
15 addr = "1d.1"
16 multifunction = "on"
17 masterbus = "ehci.0"
18 firstport = "2"
19
20 [device "uhci-3"]
21 driver = "ich9-usb-uhci3"
22 addr = "1d.2"
23 multifunction = "on"
24 masterbus = "ehci.0"
25 firstport = "4"
3.在启动虚拟机的参数后面添加上:
-readconfig /etc/qemu/ich9-ehci-uhci.cfg –chardev spicevmc,name=usbredir,id=usbredirchardev1 –device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=3
添加一个USB设备,下面是添加第二个USB设备:
-chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,debug=3
如添加多个USB设备,仿照上面修改即可。
可参考文档:http://planet.spice-space.org/