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

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

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

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

(qemu): usb support not enabled

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

-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 doesn't 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.

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

 

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

(qemu) usb_add host:0951:1665

 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.

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

(qemu) usb_del 0.3

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.

最新文章

  1. 使用WCF传输DataTable:DataTable和Xml格式的字符串相互转换(C#)
  2. windows2013 iis 配置 xcache
  3. Varnish介绍
  4. 文本溢出省略解决笔记css
  5. 微信域名weixin.com天价成交!是腾讯吗?
  6. Cookie和Session专题
  7. [转载]DateTime TryParse
  8. spring-boot系列:初试spring-boot
  9. bzoj2597: [Wc2007]剪刀石头布
  10. 实现ie6下的居中
  11. vue简单实例代码
  12. 提取jedis源码的一致性hash代码作为通用工具类
  13. MQ4入门篇(一)
  14. c# mvc 封装返回对象
  15. Java编程的逻辑 (77) - 异步任务执行服务
  16. 注册ActiveX控件
  17. Python Redis pipeline操作和Redis乐观锁保持数据一致性
  18. C++指针与引用
  19. Sprint2-2.0
  20. 转:Tomcat 7.0配置SSL的问题及解决办法

热门文章

  1. Jquery事件委托之Safari
  2. asp.net实现通用水晶报表
  3. activity传递数据
  4. Mac下github的使用
  5. Linux 线程 条件变量
  6. Python的 is 运算符
  7. git 终端常输入命令
  8. Linux下编译安装mysql-5.0.45.tar.gz
  9. Cadence OrCad Allegro SPB 16.6 下载及安装破解指南
  10. zynq 之u-boot