![USB 检测无法正常工作](https://linux22.com/image/180974/USB%20%E6%A3%80%E6%B5%8B%E6%97%A0%E6%B3%95%E6%AD%A3%E5%B8%B8%E5%B7%A5%E4%BD%9C.png)
我有一个为 karo 模块构建的自定义 yocto 图像。运行 5.7.1 内核。
当我插入 USB 驱动器时,它没有像我预期的那样显示在“lsblk”的输出中。它确实显示在“lsusb”中,所以我知道系统已检测到该驱动器,但内核处理它的方式可能有些问题?
我在内核中启用了许多调试选项,因此这是插入驱动器时的输出
root@txmp-1530:~# [ 451.851889] usb 1-1.1: new high-speed USB device number 7 using ehci-platform
[ 452.004112] usb 1-1.1: New USB device found, idVendor=090c, idProduct=1000, bcdDevice=11.00
[ 452.011016] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 452.018427] usb 1-1.1: Product: Flash Disk
[ 452.022432] usb 1-1.1: Manufacturer: USB
[ 452.026288] usb 1-1.1: SerialNumber: SCY0000000271192
[ 452.031340] device: '1-1.1': device_add
[ 452.035347] bus: 'usb': add device 1-1.1
[ 452.039134] PM: Adding info for usb:1-1.1
[ 452.045798] bus: 'usb': driver_probe_device: matched device 1-1.1 with driver usb
[ 452.051941] bus: 'usb': really_probe: probing driver usb with device 1-1.1
[ 452.058854] usb 1-1.1: no default pinctrl state
[ 452.063898] device: '1-1.1:1.0': device_add
[ 452.067446] bus: 'usb': add device 1-1.1:1.0
[ 452.071695] PM: Adding info for usb:1-1.1:1.0
[ 452.077418] bus: 'usb': driver_probe_device: matched device 1-1.1:1.0 with driver uas
[ 452.084011] bus: 'usb': really_probe: probing driver uas with device 1-1.1:1.0
[ 452.091073] uas 1-1.1:1.0: no default pinctrl state
[ 452.095994] uas: probe of 1-1.1:1.0 rejects match -19
[ 452.101346] bus: 'usb': driver_probe_device: matched device 1-1.1:1.0 with driver usb-storage
[ 452.109502] bus: 'usb': really_probe: probing driver usb-storage with device 1-1.1:1.0
[ 452.117436] usb-storage 1-1.1:1.0: no default pinctrl state
[ 452.122991] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[ 452.129639] Vendor: 0x090c, Product: 0x1000, Revision: 0x1100
[ 452.134956] Interface Subclass: 0x06, Protocol: 0x50
[ 452.139840] usb-storage 1-1.1:1.0: Quirks match for vid 090c pid 1000: 400
[ 452.146734] Transport: Bulk
[ 452.149470] Protocol: Transparent SCSI
[ 452.153509] scsi host0: usb-storage 1-1.1:1.0
[ 452.157617] device: 'host0': device_add
[ 452.161408] bus: 'scsi': add device host0
[ 452.161955] *** thread sleeping
[ 452.165488] PM: Adding info for scsi:host0
[ 452.173070] device: 'host0': device_add
[ 452.176543] PM: Adding info for No Bus:host0
[ 452.181033] usb-storage 1-1.1:1.0: waiting for device to settle before scanning
[ 452.188048] driver: 'usb-storage': driver_bound: bound to device '1-1.1:1.0'
[ 452.195481] bus: 'usb': really_probe: bound device 1-1.1:1.0 to driver usb-storage
[ 452.202627] device: 'ep_81': device_add
[ 452.206478] PM: Adding info for No Bus:ep_81
[ 452.210643] device: 'ep_02': device_add
[ 452.214594] PM: Adding info for No Bus:ep_02
[ 452.218722] driver: 'usb': driver_bound: bound to device '1-1.1'
[ 452.225409] bus: 'usb': really_probe: bound device 1-1.1 to driver usb
[ 452.231297] device: 'ep_00': device_add
[ 452.235675] PM: Adding info for No Bus:ep_00
[ 453.191885] usb-storage 1-1.1:1.0: starting scan
[ 453.195048] rq=fe rqtype=a1 value=0000 index=00 len=1
[ 453.200261] GetMaxLUN command result is 1, data is 0
[ 453.205490] *** thread awakened
[ 453.208189] Command INQUIRY (6 bytes)
[ 453.211899] bytes: 12 00 00 00 24 00
[ 453.215377] Bulk Command S 0x43425355 T 0x1 L 36 F 128 Trg 0 LUN 0 CL 6
[ 453.222067] xfer 31 bytes
[ 453.224777] Status code 0; transferred 31/31
[ 453.228833] -- transfer complete
[ 453.232115] Bulk command transfer result=0
[ 453.236143] xfer 36 bytes, 1 entries
[ 453.338971] Status code 0; transferred 36/36
[ 453.341769] -- transfer complete
[ 453.345064] Bulk data transfer result 0x0
[ 453.348992] Attempting to get CSW...
[ 453.352595] xfer 13 bytes
[ 453.355328] Status code 0; transferred 13/13
[ 453.359404] -- transfer complete
[ 453.362716] Bulk status result = 0
[ 453.366024] Bulk Status S 0x53425355 T 0x1 R 0 Stat 0x0
[ 453.371232] scsi cmd done, result=0x0
[ 453.374939] *** thread sleeping
[ 453.378159] scsi 0:0:0:0: Direct-Access USB Flash Disk 1100 PQ: 0 ANSI: 4
[ 453.386162] device: 'target0:0:0': device_add
[ 453.390472] bus: 'scsi': add device target0:0:0
[ 453.395040] PM: Adding info for scsi:target0:0:0
[ 453.400124] device: '0:0:0:0': device_add
[ 453.404002] bus: 'scsi': add device 0:0:0:0
[ 453.407762] PM: Adding info for scsi:0:0:0:0
[ 453.412525] device: '0:0:0:0': device_add
[ 453.416281] PM: Adding info for No Bus:0:0:0:0
[ 453.421030] device: '0:0:0:0': device_add
[ 453.424821] PM: Adding info for No Bus:0:0:0:0
[ 453.430287] *** thread awakened
[ 453.432560] Bad LUN (0:1)
[ 453.434572] scsi cmd done, result=0x40000
[ 453.438571] *** thread sleeping
[ 453.438736] usb-storage 1-1.1:1.0: scan complete
驱动器留在原处,并且有这两个命令输出。
root@txmp-1530:~# lsusb
Bus 001 Device 004: ID 125b:0158
Bus 001 Device 003: ID 125b:0159
Bus 001 Device 007: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
root@txmp-1530:~#
root@txmp-1530:~#
root@txmp-1530:~#
root@txmp-1530:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 3.5G 0 disk
|-mmcblk0p1 179:1 0 2M 0 part
|-mmcblk0p2 179:2 0 64M 0 part
|-mmcblk0p3 179:3 0 373M 0 part /
|-mmcblk0p4 179:4 0 373M 0 part
`-mmcblk0p5 179:5 0 2.8G 0 part /opt/videx
mmcblk0boot0 179:16 0 2M 1 disk
mmcblk0boot1 179:32 0 2M 1 disk
然后我删除该设备,并得到此输出。
root@txmp-1530:~# [ 542.214305] usb 1-1.1: USB disconnect, device number 7
[ 542.218038] device: 'ep_81': device_unregister
[ 542.222600] PM: Removing info for No Bus:ep_81
[ 542.226870] device: 'ep_02': device_unregister
[ 542.231375] PM: Removing info for No Bus:ep_02
[ 542.235879] bus: 'usb': remove device 1-1.1:1.0
[ 542.240270] device: '0:0:0:0': device_unregister
[ 542.245121] PM: Removing info for No Bus:0:0:0:0
[ 542.252005] device: '0:0:0:0': device_create_release
[ 542.255531] device: '0:0:0:0': device_unregister
[ 542.260516] PM: Removing info for No Bus:0:0:0:0
[ 542.266061] bus: 'scsi': remove device 0:0:0:0
[ 542.269352] PM: Removing info for scsi:0:0:0:0
[ 542.274491] bus: 'scsi': remove device target0:0:0
[ 542.278569] PM: Removing info for scsi:target0:0:0
[ 542.283727] device: 'host0': device_unregister
[ 542.287905] PM: Removing info for No Bus:host0
[ 542.292759] bus: 'scsi': remove device host0
[ 542.296442] PM: Removing info for scsi:host0
[ 542.300931] -- sending exit command to thread
[ 542.305293] *** thread awakened
[ 542.307980] -- exiting
[ 542.342645] PM: Removing info for usb:1-1.1:1.0
[ 542.346463] device: 'ep_00': device_unregister
[ 542.350428] PM: Removing info for No Bus:ep_00
[ 542.355071] bus: 'usb': remove device 1-1.1
[ 542.359538] PM: Removing info for usb:1-1.1
再次,删除后的两个 ls 命令以供参考。
root@txmp-1530:~# lsusb
Bus 001 Device 004: ID 125b:0158
Bus 001 Device 003: ID 125b:0159
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
root@txmp-1530:~#
root@txmp-1530:~#
root@txmp-1530:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 3.5G 0 disk
|-mmcblk0p1 179:1 0 2M 0 part
|-mmcblk0p2 179:2 0 64M 0 part
|-mmcblk0p3 179:3 0 373M 0 part /
|-mmcblk0p4 179:4 0 373M 0 part
`-mmcblk0p5 179:5 0 2.8G 0 part /opt/videx
mmcblk0boot0 179:16 0 2M 1 disk
mmcblk0boot1 179:32 0 2M 1 disk
root@txmp-1530:~#
如果我应该包含任何其他信息来帮助追踪此问题,请告诉我。谢谢