Sometimes, qemu cannot find correct usb device number
Reproduce steps:
1?lsusb
Bus 001 Device 011: ID 090c:1000
1?prepare usb device attach xml
<hostdev managed="yes" mode="subsystem"
type="usb">
<source>
<vendor id="0x090c" />
<product id="0x1000" />
<address bus='001' device='011'/>
</source><address bus="1" port="1"
type="usb" />
</hostdev>
2?virsh attach-device vm usb.xml
error: internal error: Did not find USB device 090c:1000 bus:1 device 9
Question:
why the device number returned in qemu's error report is not what I wrote in
xml?
what I mean is that if my dev number is really wrong, the returned error should
also be the number I wrote?
commonly when using dongle
Look forward to your reply
yaohua.wu
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://listman.redhat.com/archives/libvirt-users/attachments/20201208/cad23816/attachment.htm>
YaoHua Wu
2020-Dec-08 08:23 UTC
回复: Cannot passthrough usb with bus number and device number
Version:
# libvirtd --version
libvirtd (libvirt) 4.9.0
# qemu-img --version
qemu-img version 2.12.0 (qemu-kvm-ev-2.12.0-44.1.el7_9.1)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
yaohua.wu
???? YaoHua Wu
????? 2020-12-08 16:14
???? libvirt-users
??? Cannot passthrough usb with bus number and device number
Sometimes, qemu cannot find correct usb device number
Reproduce steps:
1?lsusb
Bus 001 Device 011: ID 090c:1000
1?prepare usb device attach xml
<hostdev managed="yes" mode="subsystem"
type="usb">
<source>
<vendor id="0x090c" />
<product id="0x1000" />
<address bus='001' device='011'/>
</source><address bus="1" port="1"
type="usb" />
</hostdev>
2?virsh attach-device vm usb.xml
error: internal error: Did not find USB device 090c:1000 bus:1 device 9
Question:
why the device number returned in qemu's error report is not what I wrote in
xml?
what I mean is that if my dev number is really wrong, the returned error should
also be the number I wrote?
commonly when using dongle
Look forward to your reply
yaohua.wu
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://listman.redhat.com/archives/libvirt-users/attachments/20201208/7b5dbfc6/attachment.htm>
Andreas Tscharner
2020-Dec-08 09:11 UTC
Cannot passthrough usb with bus number and device number
On 08.12.20 09:14, YaoHua Wu wrote:> Sometimes, qemu cannot find correct usb device number > Reproduce steps: > 1?lsusb > Bus 001 Device 011: ID?090c:1000 > 1?prepare usb device attach xml > <hostdev managed="yes" mode="subsystem" type="usb"> > <source> > <vendor id="0x090c" /> > <product id="0x1000" /> > <address bus='001' device='011'/> > </source><address bus="1" port="1" type="usb" /> > </hostdev> > 2?virsh attach-device vm usb.xml > error: internal error: Did not find USB device 090c:1000 bus:1 device 9 > > Question: > why the device number returned in qemu's error report is not what I > wrote in xml? > what I mean is that if my dev number is really wrong, the returned error > should also be the number I wrote? > commonly when using dongleLooks like the number 011 in your device='011' is interpreted as octal number: 1x8 + 1x1 = 9 in decimal Best regards Andreas -- Andreas Tscharner sternenfeuer at gmail.com ------------------------------------------------------------------------ Der entscheidende Vorteil eines Chats gegenueber einem normalen Telefon- anruf ist der, dass ersterer langsamer geht und mehr kostet (fuer den lebenswichtigen Austausch von Informationen wie "hya folks", "C U l8er" und ":-)") ... Aus Murphy's Computergesetzen
Yes, I checked the libvirt code and found that the strtoul function is used to
do the hexadecimal conversion, thank you for your reply :)
yaohua.wu at zstack.io
From? YaoHua Wu
Date? 2020-12-08 16:14
To? libvirt-users
Subject? Cannot passthrough usb with bus number and device number
Sometimes, qemu cannot find correct usb device number
Reproduce steps:
1?lsusb
Bus 001 Device 011: ID 090c:1000
1?prepare usb device attach xml
<hostdev managed="yes" mode="subsystem"
type="usb">
<source>
<vendor id="0x090c" />
<product id="0x1000" />
<address bus='001' device='011'/>
</source><address bus="1" port="1"
type="usb" />
</hostdev>
2?virsh attach-device vm usb.xml
error: internal error: Did not find USB device 090c:1000 bus:1 device 9
Question:
why the device number returned in qemu's error report is not what I wrote in
xml?
what I mean is that if my dev number is really wrong, the returned error should
also be the number I wrote?
commonly when using dongle
Look forward to your reply
yaohua.wu
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://listman.redhat.com/archives/libvirt-users/attachments/20201208/a144689e/attachment.htm>