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.

Assigning Host USB device to a Guest VM的更多相关文章

  1. usb host和usb device

    S3C2440的数据手册将USB功能分为两章--usb host和usb device.具体什么意思呢? usb host: 微处理器作为usb主设备,可以挂接U盘之类的从属设备. usb devic ...

  2. usb host和device的关系-ARM 论坛 - 21ic电子技术论坛

    usb host和device的关系 疑问1:我们通常所用的u盘应该是usb device吧?我想这个不用多说,呵呵. ===============恩.============== 疑问2:我们通常 ...

  3. Does anyone successfully use USB drive in Windows7 guest?

    Hi, Does anyone successfully use USB drive in Windows7 guest? If I pass a USB drive to Windows7 gues ...

  4. USB device & USB controller & USB passthrough

    目录 USB device USB controller Linux 相关命令 Python 相关库 Libvirt USB passthrough 参考资料 近期往 openstack 里倒腾 US ...

  5. KVM虚拟机IO处理过程(一) ----Guest VM I/O 处理过程

    虚拟化技术主要包含三部分内容:CPU虚拟化,内存虚拟化,设备虚拟化.本系列文章主要描述磁盘设备的虚拟化过程,包含了一个读操作的I/O请求如何从Guest Vm到其最终被处理的整个过程.本系列文章中引用 ...

  6. Install Slax on USB device (Slax U 盘安装)

    Slax is a modern, portable, small and fast Linux operating system with a modular approach and outsta ...

  7. What is a Windows USB device path and how is it formatted?

    http://community.silabs.com/t5/Interface-Knowledge-Base/Windows-USB-Device-Path/ta-p/114059 Windows ...

  8. USB Device Finder

    http://www.velleman.eu/images/tmp/usbfind.c #ifdef __cplusplus extern "C" { #endif #includ ...

  9. "The connection for the USB device '###' was unsuccessful. The device is currently in use"

    一.问题描述 1.情景描述 笔者的物理主机系统是“windows7 64位”,想使用“摄像头录像大师”.这个软件在录制视频的过程中,需要调用windows自带的"windows media ...

随机推荐

  1. 如何用DELPHI编程修改外部EXE文件的版本信

    右击里面有修改 点开直接修改就可以了吧. DELPHI 里程序的版本信息怎么是灰色的,无法更改 耐心读以下说明,应该能解决你的问题,如果不能解决,请Hi我~ 如何给自己的dll文件添加版本信息呢? 首 ...

  2. 推荐五款优秀的PHP代码重构工具

    在软件工程学里,重构代码一词通常是指在不改变代码的外部行为情况下而修改源代码.软件重构需要借助工具完成,而重构工具能够修改代码同时修改所有引用该代码的地方.本文收集了五款出色的PHP代码重构工具,以帮 ...

  3. ios 应用剖析

    在创建HelloWorld的过程中,生成了很多文件(展开Xcode左边的项目导航视图可以看到,如图2-8所示),它们各自的作用是什么?彼此间又是怎样的一种关系呢? 图2-8 项目导航视图 如图2-8所 ...

  4. strcpy函数的C/C++实现

    2013-07-05 14:07:49 本函数给出了几种strcpy与strncpy的实现,有ugly implementation,也有good implementation.并参考标准库中的imp ...

  5. ubuntu装机

    备份: .bashrc profile .vimrc exports defults/ 各种workspace中的源码 goagent/ 重转后安装: apt-get install openjdk- ...

  6. p2p穿透技术

    ios 怎么和wifi外设摄像头实时传输视频 ios 控制wifi摄像头外设的拍照.录像.删除照片等等都可以通过tcp/ip 发送定义好的json指令实现. 但是不知道怎么和wifi外设摄像头实时传输 ...

  7. s​e​t​ ​x​a​c​t​_​a​b​o​r​t ​用​法

    默认行为 默认为SET XACT_ABORT OFF,没有事务行为. SET XACT_ABORT ON SET XACT_ABORT ON分为两种: 1.总体作为一个事务,整体提交或整体回滚,格式为 ...

  8. UVA 11082 Matrix Decompressing 矩阵解压(最大流,经典)

    题意: 知道矩阵的前i行之和,和前j列之和(任意i和j都可以).求这个矩阵.每个格子中的元素必须在1~20之间.矩阵大小上限20*20. 思路: 这么也想不到用网络流解决,这个模型很不错.假设这个矩阵 ...

  9. windows远程桌面3389超时锁定时间调整方法(取消锁屏时间限制)

    我们在管理服务器操作时,有时候需要长时间操作服务器,有时候稍微离开下倒杯水或接个稍长点的电话,就超时断开了很烦啦!有没有方法解决这个问题类?答案是有的!我只要在组策略里面,稍微修改下超时时间就可以了. ...

  10. 剑指Offer:从第一个字符串中删除第二个字符串中出现过的所有字符

    // 从第一个字符串中删除第二个字符串中出现过的所有字符 #include <stdio.h> char* remove_second_from_first( char *first, c ...