首页 > 其他 > 详细

KVM通过qemu实现USB重定向

时间:2014-03-25 18:38:51      阅读:1256      评论:0      收藏:0      [点我收藏+]

KVM是通过qemu来支持USB设备的,可以在启动的时候就指定需要连接的USB设备,也可以系统启动后动态的添加删除.通过qemu的help可知,使用qemu的usb_add host:xxx:xxx来添加usb设备,那么如何知道对应的host:xxx:xxx呢,有2种方法: 
1)在host主机ubuntu中执行lsusb得到这些信息 
比如在我机器上usb的信息如下: 

bubuko.com,布布扣
1 Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
2 Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
3 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
4 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
5 Bus 001 Device 003: ID 0461:4d80 Primax Electronics, Ltd 
6 Bus 001 Device 006: ID 0951:1665 Kingston Technology 
7 Bus 001 Device 004: ID 058f:b002 Alcor Micro Corp. 
8 Bus 002 Device 003: ID 0489:e010 Foxconn / Hon Hai 
bubuko.com,布布扣

  0951:1665就是我们需要的了。

2)进入服务端虚拟机后,通过ctrl+alt+2调出qemu控制台,输入info usb来列出相关已经加载的USB信息。如果显示:

bubuko.com,布布扣
(qemu): usb support not enabled
bubuko.com,布布扣

If you see ‘USB support not enabled‘, confirm to use option -usb at startup.

bubuko.com,布布扣
-usb
This option adds pseudo USB mouse device to a guest OS.

-usbdevice tablet
When a guest OS has a driver for USB tablet, a mouse doesnt need to click in the guest OS windows to capture.

-usbdevice host:xxxx:yyyy
A USB device xxxx:yyyy on a host OS can be used from a guest OS.
bubuko.com,布布扣

3.)Press Ctrl-Alt-2 and check USB device ID of host OS in QEMU monotor.

bubuko.com,布布扣 

 Then connect USB device (0951:1665) to the guest OS. 0951 is a vender ID and 1665 is a product ID.

bubuko.com,布布扣
(qemu) usb_add host:0951:1665
bubuko.com,布布扣

 Finally, PnP manager of WindowsXP guest recognizes USB mouse and a device driver is installed.

4.)When you want to remove the USB device, remove USB device in guest OS. For example, right click on task bar and select remove the device. The mouse doesn‘t need to do this. Then check a number of USB bus and address in QEMU monitor.

bubuko.com,布布扣

Use usb_del in QEMU monitor. 0.3 means that the bus number is 0 and the address of USB device is 3.

bubuko.com,布布扣
(qemu) usb_del 0.3
bubuko.com,布布扣

Then remove USB device in host OS. For example, right click on the task bar and remove the USB device as in guest OS. The mouse doesn‘t need to do this.

After that, unplug the USB device on your machine.

KVM通过qemu实现USB重定向,布布扣,bubuko.com

KVM通过qemu实现USB重定向

原文:http://www.cnblogs.com/fuleying/p/3622908.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!