Example Assigning Host USB device to a Guest VM

This example is based on qemu-kvm (0.15.0) as installed in Fedora 15. Will first show how to do this manually, and second how to do it using the virt-manager tool. This HOWTO is limited to UHCI devices (no USB2 EHCI).

Here we'll use a phone attached to the host:

# lsusb
...
Bus 002 Device 003: ID 18d1:4e11 Google Inc. Nexus One

(Note the Bus and device numbers).

Manually, using qemu-kvm command line

#/usr/bin/qemu-kvm -m 1024 -name f15 -drive file=/images/f15.img,if=virtio -usb -device usb-host,hostbus=2,hostaddr=3

Here we add the -usb to add a host controller, and add -device usb-host,hostbus=2,hostaddr=3 to add the host's USB device at Bus 2, Device 3. Simple as that.

Now, we can verify this in the guest:

$ lspci
...
00:01.2 USB Controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
$ lsusb
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 18d1:4e11 Google Inc. Nexus One Phone

And on the phone enable USB Mass Storage, and the guest should display a dialog seeing a new USB filesystem. Open it and...

$ ls /media/[mountpoint]
Android/ data/ DCIM/ ...

Managed, using virt-manager

This assumes you already have created a VM using virt-manager. The VM is not running, and you'd like to add a USB host device to the VM. Start virt-manager, and open your VM by double clicking on it. Click the virtual hardware details (lightbulb). Now Click Add Hardware, and Choose USB Host Device. Here, we are choosing the same Phone device.

Start the VM and verify the usb host controller and device show up like above. Now on the phone enable USB Mass Storage, and the guest should display a dialog seeing a new USB filesystem.

最新文章

  1. 光标失去焦点事件 onblur
  2. 从Lumia退役看为什么WP走向没落
  3. Contoso 大学 - 4 - 创建更加复杂的数据模型
  4. html5入门信息
  5. jax-ws实现WebService
  6. K倍动态减法游戏
  7. hadoop编程技巧(4)---总体情况key按类别搜索TotalOrderPartitioner
  8. Entity Framework with MySQL 学习笔记一(安装)
  9. Windows Azure HDInsight 支持预览版 Hadoop 2.2 群集
  10. 使用JDBC进行数据库的事务操作(2)
  11. css padding和margin的百分比
  12. 如何修改script.bin/script.fex
  13. 高质量PHP代码的50个实用技巧必备(上)
  14. python for循环巧妙运用(迭代、列表生成式)
  15. 多进程log4cxx区分日志
  16. Windows Java安装
  17. 【Hadoop】3、Hadoop-MapReduce使用avro进行数据的序列化与反序列化
  18. TensorFlow.js入门(一)一维向量的学习
  19. 进程锁Lock
  20. p3792 由乃与大母神原型和偶像崇拜(思维+线段树)

热门文章

  1. static函数与普通函数
  2. HeadFirst设计模式之组合模式
  3. Android 使用SDcard进行文件的读取
  4. SVN中update to revision与revert to revision的区别
  5. 在vs2010中mfc,C++的一些小经验
  6. PHP 日期计算函数【差异天数】
  7. R12 - OM改进了对成本与收入确认的流程
  8. Hive 接口介绍(Web UI/JDBC)
  9. centos 如何用 rsyslog 搭建本地日志服务(续1: omprog模块与php deamon的配合使用)
  10. poj3225 线段树区间操作 (见鬼)