USB with passthrougth guest cannot enumerate USB host Following the guide at http://www.linux-kvm.org/page/USB_Host_Device_Assigned_to_Guest Qemu is launched with qemu-system-x86_64 /dev/vgstripe/kvm_wifi -enable-kvm -m 512 -k fr -net nic -net tap,ifname=tap1,script=/bin/ifup.script -kernel /usr/src/linux_git/arch/x86_64/boot/bzImage -append root=/dev/sda -usb -device usb-host,hostbus=1,hostaddr=6 The USB device does not show and USB stack seems not working On the guest: dmesg |grep -i usb [ 1.416966] hub 1-0:1.0: USB hub found [ 1.420431] usbcore: registered new interface driver usb-storage [ 1.445374] usbcore: registered new interface driver usbhid [ 1.446839] usbhid: USB HID core driver [ 1.863226] usb 1-1: new low-speed USB device number 2 using uhci_hcd [ 2.126173] usb 1-1: Invalid ep0 maxpacket: 64 [ 2.373161] usb 1-1: new low-speed USB device number 3 using uhci_hcd [ 2.648112] usb 1-1: Invalid ep0 maxpacket: 64 [ 2.892404] usb 1-1: new low-speed USB device number 4 using uhci_hcd [ 2.913001] usb 1-1: Invalid ep0 maxpacket: 64 [ 3.161367] usb 1-1: new low-speed USB device number 5 using uhci_hcd [ 3.180070] usb 1-1: Invalid ep0 maxpacket: 64 [ 3.181633] usb usb1-port1: unable to enumerate USB device lsusb Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub On the host: lsusb Bus 001 Device 006: ID 0457:0163 Silicon Integrated Systems Corp. SiS163U 802.11 Wireless LAN Adapter qemu-system-x86_64 --version QEMU emulator version 2.1.2, Copyright (c) 2003-2008 Fabrice Bellard You might try connecting the device to a ehci/xhci bus (instead of the default uhci bus... i.e. USB 1.1). See docs/usb2.txt in the qemu source for more info. the problem is this commit: http://git.qemu.org/?p=qemu.git;a=commit;h=b791c3b38c7969cb9f4acda8229e19fd865a1c08 it's easy to reproduce -- plug in a USB flash drive and try to pass it through on the host: $ lsusb Bus 003 Device 004: ID 1307:0163 Transcend Information, Inc. 256MB/512MB/1GB Flash Drive so launch qemu with that: -usbdevice host:1307:0163 and then in the VM, if it fails, you get those errors in dmesg, and the device doesn't show up in `lsusb`. if it passes, `lsusb` reports it fine. On 2014/11/9 2:47, MikeFrysinger wrote: > the problem is this commit: > http://git.qemu.org/?p=qemu.git;a=commit;h=b791c3b38c7969cb9f4acda8229e19fd865a1c08 > > it's easy to reproduce -- plug in a USB flash drive and try to pass it > through > What's your USB flash drive's version? USB1.1 or USB2.0 or 3.0? Please post the value: 1.cat /sys/bus/usb/device/xx-xx/speed [xx-xx: hostbus-hostport] 2.And your exact command line launched Qemu . Best regards, -Gonglei > on the host: > $ lsusb > Bus 003 Device 004: ID 1307:0163 Transcend Information, Inc. 256MB/512MB/1GB Flash Drive > > so launch qemu with that: > -usbdevice host:1307:0163 > > and then in the VM, if it fails, you get those errors in dmesg, and the > device doesn't show up in `lsusb`. if it passes, `lsusb` reports it > fine. > i've attached the `lsusb -v` output for the device. it is USB 2.0. the sysfs speed file shows 480. the qemu cmdline: qemu-system-x86_64 \ -hda images/root \ -hdb images/var \ -hdc images/usr \ -append "root=/dev/hda console=ttyS0 panic=3 init=/ginit" \ -kernel images/bzImage \ -nographic \ -no-reboot \ -m 512 \ -enable-kvm \ -usbdevice host:1307:0163 On 2014/11/11 1:52, MikeFrysinger wrote: > i've attached the `lsusb -v` output for the device. it is USB 2.0. the > sysfs speed file shows 480. > You should add an ehci controller or xhci for USB2.0 device. Please use such below cmdline: -device usb-ehci,id=ehci \ -device usb-host,bus=ehci.0,vendorid=1307,productid=0163 BTW, This is a really bug, and Gerd had posted a patch: [PATCH] usb-host: fix usb_host_speed_compat tyops http://lists.gnu.org/archive/html/qemu-devel/2014-11/msg01441.html After applying this patch, you will get a warning: "Warning: speed mismatch trying to attach..." if you use the cmdline as your showing. Thanks, -Gonglei > the qemu cmdline: > qemu-system-x86_64 \ > -hda images/root \ > -hdb images/var \ > -hdc images/usr \ > -append "root=/dev/hda console=ttyS0 panic=3 init=/ginit" \ > -kernel images/bzImage \ > -nographic \ > -no-reboot \ > -m 512 \ > -enable-kvm \ > -usbdevice host:1307:0163 > > ** Attachment added: "lsusb.txt" > https://bugs.launchpad.net/qemu/+bug/1385934/+attachment/4257409/+files/lsusb.txt > Can you check if the same error messages appear in /var/log/syslog and /var/log/libvirt/qemu/.log as I described in bug #1392504? Because I think it is apparmor related. looks like 79ae25af1569a50a0ec799901a1bb280c088f121 (which is in qemu-2.2.0) makes it work again for my test case. not sure if the OP wants to verify as well or just close this out now. With qemu 2.2.0 I see now the usb dongle but using it give me some problem seen on the host: libusb: error [submit_control_transfer] submiturb failed error -1 errno=22 Disabling caps and seccomp change nothing. I strace the process and I see: 26170 ioctl(20, USBDEVFS_SUBMITURB, 0x7f00c0539eb0) = -1 EINVAL (Invalid argument) 26170 write(2, "libusb: error [submit_control_transfer] submiturb failed error -1 errno=22\n", 75) = 75 Triaging old bug tickets... can you still reproduce this issue with the latest version of QEMU? Or could we close this ticket nowadays? [Expired for QEMU because there has been no activity for 60 days.]