Assigning Host USB device to a Guest VM
2016-01-10 11:18
513 查看
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
-usbto add a host controller, and add
-device usb-host,hostbus=2,hostaddr=3to 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.
相关文章推荐
- iOS 【UIKit-事件产生与传送 练习(重写hitTest和pointInside方法)】
- 专注UI——有用技术:模糊搜索
- IOS 之 UIActivityIndicatorView
- (转)Java中StringBuilder的清空方法比较
- UIButton详细的属性介绍
- SpriteKit 1-SKScene
- UITableview性能优化总结
- UITableView的使用(熟练使用)
- 利用简单的参数传递来实现单条查询的easyui-datagrid
- Leetcode: Range Sum Query 2D - Immutable
- UIView的一些知识
- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platf...
- 如何处理UIVIew addsubview 不显示subview
- iOS开发之UIAlertController新版的使用方法
- 补充UIAlertView的一些知识,包括UIAlertViewStyleLoginAndPasswordInput和代理方法
- UITextField只能输入一位字符串
- UITextField和UITextView限制字数(包括中文)
- hdu 2560 buildings
- 【优先队列】:poj2442,Sequence
- Druid数据库连接池两种简单使用方式