Problem :
When trying to run arch linux with a usb passthrough using qemu on my macbook pro retina 2015, running osx Yosemite 10.10., using the command:
sudo qemu-system-i386 -cpu core2duo -cdrom
archlinux-2015.11.01-dual.iso -boot order=d -m 1G -usbdevice
host:0x13fe:0x5500
I keep getting the error:
qemu: could not add USB device ‘host:0x13fe:0x5500’
While, in system information, the USB device has the vendor id “0x13fe” and the product id “0x5500”.
I get the same vendor and product id using the codeblock (in bash)
`system_profiler SPUSBDataType | awk '
/Product ID:/{p=$3}
/Vendor ID:/{v=$3}
/Manufacturer:/{sub(/.*: /,""); m=$0}
/Location ID:/{sub(/.*: /,""); printf("%s:%s %s (%s)n", v, p, $0, m);}
'
`
On the qemu documentation, it says the correct form to pass through a USB is
host:vendor_id:product_id
So I believe I’m doing it correctly.
I’m running qemu 2.4.0.1
Am I doing something wrong here?
Solution :
I’m not sure why you are getting that error, but you’d barely want to use -usbdevice
anyway, since it can only attach a device in “full-speed” mode (12M), even if it is a “high-speed” (480M) device on the host side:
It may not even work at all if you are attaching a “superspeed” (5000M) device (xHCI enabled on the host side):
So instead, you would want the more modern and generic -device usb-host
approach, with an emulated host controller of your choice (e.g. -device nec-usb-xhci
):
It should also work for “high-speed” (480M) devices:
as well as “full-speed” (12M) devices:
Possbile choices of emulated host controller are:
[tom@localhost ~]$ qemu-system-x86_64 -device help |& grep usb.*hci
name "ich9-usb-ehci1", bus PCI
name "ich9-usb-ehci2", bus PCI
name "ich9-usb-uhci1", bus PCI
name "ich9-usb-uhci2", bus PCI
name "ich9-usb-uhci3", bus PCI
name "ich9-usb-uhci4", bus PCI
name "ich9-usb-uhci5", bus PCI
name "ich9-usb-uhci6", bus PCI
name "nec-usb-xhci", bus PCI
name "piix3-usb-uhci", bus PCI
name "piix4-usb-uhci", bus PCI
name "usb-ehci", bus PCI
name "vt82c686b-usb-uhci", bus PCI
[tom@localhost ~]$ qemu-system-x86_64 -device help |& grep ohci
name "pci-ohci", bus PCI, desc "Apple USB Controller"
name "sysbus-ohci", bus System, desc "OHCI USB Controller"
nec-usb-xhci
should work best and fine in most cases.
Btw, there are also ways other than vendorid
+productid
to specify which device you want to attach with -device usb-host
. For example, hostbus
+hostaddr
:
Or, hostbus
+hostport
:
Which are handy when there are multiple devices of the same model in the system.
Ref.: http://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb2.txt;hb=HEAD
Most likely it’s because ‘-usbdevice host’ is for Linux only and can’t be use on osx.
https://people.cs.clemson.edu/~ccorsi/kyouko/qemu-doc.html#index-g_t_002dusbdevice-38
host:bus.addr
Pass through the host device identified by bus.addr (Linux only).
host:vendor_id:product_id
Pass through the host device identified by vendor_id:product_id (Linux only).
I had the same problem on my laptop. You can use -hdb /dev/sdb
instead of -usb -usbdevice ...
as following:
sudo qemu-system-i386 ubuntu16.img --enable-kvm -monitor stdio -m 2048 -hdb /dev/sdb -vga cirrus -vnc :0