[CentOS] Use USB2.0 Camera with KVM based VM

Tue Jun 28 07:34:43 UTC 2016
Gordon Messmer <gordon.messmer at gmail.com>

On 06/27/2016 05:20 PM, Mark LaPierre wrote:
> The reply to the bug post went on to say that the problem is that the
> USB 2.0 camera will not work with the USB 1.1 default hub and that I
> should change the hub from USB 1.1 to USB 2.0.
>
> I see no way to do that.

I don't either, but maybe this is helpful...  According to this 
document, you can specify the bus that a USB device is attached to, 
including pass-through devices:
http://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb2.txt;hb=HEAD

So, one option would be to create a shell script that modifies the 
arguments given to qemu-system-x86_64, and then use "virsh edit <guest>" 
to replace the default emulator with the path to your shell script.  I 
do that for a guest where I pass through a video card, which needs a PCI 
express bridge:

$ cat /usr/local/bin/qemu-system-x86_64-passthrough
#!/bin/bash

declare -a qemuargs

for x in "$@"
do
     if test "${x:0:21}" == "vfio-pci,host=01:00.0"
     then
qemuargs+=(ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1)
         qemuargs+=(-device)
qemuargs+=(vfio-pci,host=01:00.0,id=hostvga,bus=root.1,addr=00.0,multifunction=on)
     else
         qemuargs+=("$x")
     fi
done

/usr/bin/qemu-system-x86_64 "${qemuargs[@]}"