目录
实现直通
查看USB相关信息:
# lsusb
Bus 002 Device 003: ID 058f:6387 Alcor Micro Corp. Flash Drive
Bus 002 Device 002: ID 8087:8002 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 413c:a001 Dell Computer Corp. Hub
Bus 001 Device 004: ID 17ef:602d Lenovo
Bus 001 Device 003: ID 17ef:602e Lenovo
Bus 001 Device 002: ID 8087:800a Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
查看USB的树状信息:
# lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
|__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=usbfs, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 5: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 5: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 6: Dev 5, If 0, Class=Hub, Driver=hub/6p, 480M
根据上面的信息,可以获取到将要直通的USB设备的如下相关信息:
Vendor id : 058f
Product id :6387
Driver :ehci
新建一个xml文件:
# vim /etc/libvirt/W10_usb.xml
写入如下内容:
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x058