我有这个设备将在libusb_reset_device
时断开连接并重新连接,如何将其转发到VM。我查看了source code,并致电libusb_reset_device
。
这是我附加该设备时的日志跟踪:
1720@1518601481.571033:usb_host_open_started dev 2:3
1720@1518601481.571164:usb_host_detach_kernel dev 2:3, if 0
1720@1518601481.578244:usb_host_parse_config dev 2:3, value 1, active 1
1720@1518601481.578276:usb_host_parse_interface dev 2:3, num 0, alt 0, active 1
1720@1518601481.578287:usb_host_parse_endpoint dev 2:3, ep 1, in, bulk, active 1
. . .
1720@1518601481.579041:usb_host_open_success dev 2:3
1720@1518601481.694268:usb_host_reset dev 2:3
1720@1518601482.072884:usb_host_reset dev 2:3
1720@1518601482.072954:usb_host_close dev 2:3
1720@1518601482.073045:usb_host_auto_scan_enabled
这是主机(不是VM)的dmesg日志
Feb 14 16:43:25 win-pc kernel: usb 2-1: new high-speed USB device number 3 using xhci_hcd
Feb 14 16:43:25 win-pc kernel: usb 2-1: New USB device found, idVendor=1782, idProduct=5d24
Feb 14 16:43:25 win-pc kernel: usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
Feb 14 16:43:25 win-pc kernel: usb 2-1: Product: Spreadtrum
Feb 14 16:43:25 win-pc kernel: usb 2-1: Manufacturer: Spreadtrum
Feb 14 16:43:25 win-pc kernel: usb 2-1: SerialNumber: 20161122200747
Feb 14 16:43:26 win-pc kernel: usb-storage 2-1:1.0: USB Mass Storage device detected
Feb 14 16:43:26 win-pc kernel: scsi host4: usb-storage 2-1:1.0
Feb 14 16:43:26 win-pc kernel: usbcore: registered new interface driver usb-storage
Feb 14 16:43:26 win-pc kernel: usbcore: registered new interface driver uas
Feb 14 16:43:27 win-pc kernel: scsi 4:0:0:0: Direct-Access Linux File-CD Gadget 0310 PQ: 0 ANSI: 2
Feb 14 16:43:27 win-pc kernel: sd 4:0:0:0: Power-on or device reset occurred
Feb 14 16:43:27 win-pc kernel: sd 4:0:0:0: [sdb] Attached SCSI removable disk
Feb 14 16:44:41 win-pc kernel: usb 2-1: reset high-speed USB device number 3 using xhci_hcd
Feb 14 16:44:41 win-pc kernel: usb 2-1: USB disconnect, device number 3
Feb 14 16:44:42 win-pc kernel: usb 2-1: new high-speed USB device number 4 using xhci_hcd
Feb 14 16:44:42 win-pc kernel: usb 2-1: New USB device found, idVendor=1782, idProduct=5d24
Feb 14 16:44:42 win-pc kernel: usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
Feb 14 16:44:42 win-pc kernel: usb 2-1: Product: Spreadtrum
Feb 14 16:44:42 win-pc kernel: usb 2-1: Manufacturer: Spreadtrum
Feb 14 16:44:42 win-pc kernel: usb 2-1: SerialNumber: 20161122200747
Feb 14 16:44:42 win-pc kernel: usb-storage 2-1:1.0: USB Mass Storage device detected
Feb 14 16:44:42 win-pc kernel: scsi host4: usb-storage 2-1:1.0
Feb 14 16:44:43 win-pc kernel: scsi 4:0:0:0: Direct-Access Linux File-CD Gadget 0310 PQ: 0 ANSI: 2
. . .
如您所见,设备将断开连接并在此之后重新连接
如何将此类设备转发到VM
编辑1:
如果你想知道它是什么设备,它是一部Android手机。我想将它传递给VM,以便我可以在VM上使用adb
编辑2:
我的时区是UTC + 7。您可以根据时间戳
查看qemu跟踪日志和dmesg日志之间的关联编辑3:
我尝试使用device_add usb-host,vendorid=1782,productid=5d24
而非使用hostbus
和hostaddr
,这会导致无限循环: