1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
user-level: 0.928
device: 0.904
risc-v: 0.901
KVM: 0.899
hypervisor: 0.891
graphic: 0.890
x86: 0.884
permissions: 0.880
assembly: 0.875
virtual: 0.873
mistranslation: 0.858
VMM: 0.857
semantic: 0.856
architecture: 0.852
peripherals: 0.841
TCG: 0.839
ppc: 0.836
debug: 0.834
boot: 0.829
files: 0.828
PID: 0.827
kernel: 0.818
vnc: 0.814
register: 0.809
network: 0.806
performance: 0.790
socket: 0.778
arm: 0.777
i386: 0.765
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/<machine>.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.]
|