Reputation: 340
I am new in using the emulator qemu and I'm trying to make use of it to emulate the raspbian system, which is used in the raspberry pi, but I do not know how to use my camera usb in it. Could anyone help me ?
Upvotes: 3
Views: 8503
Reputation: 419
As of October 2019 we now have Qemu 4.1.0
and -usbdevice
in goe's answer is deprecated.
So, the advice is to use the new option -device usb...
and probably your camera is high-speed
so you must use usb-ehci
, otherwise you'll get a speed mismatch
error.
That said, I launch a VM with the integrated Webcam from my laptop with:
qemu-system-x86_64 -enable-kvm -m 2048 -rtc base=localtime -hda /path/win7.img -cpu host -soundhw hda -usb -device usb-ehci,id=ehci -device usb-host,hostbus=1,hostaddr=3
hostbus=1,hostaddr=3
is from:
lsusb
...
Bus 001 Device 003: ID 0408:2fb1 Quanta Computer, Inc.
...
and I know that from:
sudo dmesg |grep -i webcam
...
[ 5594.955703] uvcvideo: Found UVC 1.00 device Laptop_Integrated_Webcam_2HDM (0408:2fb1)
...
Upvotes: 7
Reputation: 2303
To include the usb device, you can use the option '-usbdevice' and include the location of the device bus. The full option could be something similar to this:
qemu-system-arm -M versatilepb ... -usbdevice host:5.4
The host address definition (I mean, the numbers after 'host:') could be found with 'lsusb' command. In the list given by 'lsusb' you have to find the device to be shared. For example:
$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 003: ID 046d:0805 Logitech, Inc. Webcam C300
Bus 005 Device 004: ID 046d:082d Logitech, Inc. HD Pro Webcam C920
Bus 005 Device 002: ID 2109:3431
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
In the previous example, the device I wanted to share is the 'Logitech, Inc. HD Pro Webcam C920' camera, and as you can see in the corresponding line, the bus and device values are defined there (5 and 4 respectively).
Upvotes: 1