最近在RK3399 Android7.1.2上面的USB3.0口上使用一款SONY移动硬盘,接入时识别信息如下:
rk3399_box:/ # [25.497767] usb 6-1.4: new SuperSpeed USB device number 4 using xhci-hcd
[25.512350] usb 6-1.4: New USB device found, idVendor=2537, idProduct=1068
[25.513043] usb 6-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[25.513732] usb 6-1.4: Product: NS1068
[25.514119] usb 6-1.4: Manufacturer: Norelsys
[25.514189] usb 6-1.4: SerialNumber: 0123456789ABCDE
[25.527826] scsi host0: uas
[29.089929] scsi 0:0:0:0: Direct-AccessATATOSHIBA MQ01ABD1 1UPQ: 0 ANSI: 6
[29.100317] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[29.100418] sd 0:0:0:0: [sda] 4096-byte physical blocks
[29.104389] sd 0:0:0:0: [sda] Write Protect is off
[29.105420] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[29.105603] xhci-hcd xhci-hcd.7.auto: ERROR Transfer event for disabled endpoint or incorrect stream ring
[29.105640] xhci-hcd xhci-hcd.7.auto: @00000000f7051510 00000000 00000000 1b000000 04098000
[29.108360] sd 0:0:0:0: Attached scsi generic sg0 type 0
[29.109632] type=1400 audit(1499650871.533:27): avc: denied { create } for pid=37 comm="kdevtmpfs" name="bsg" scontext=u:r:kernel:s0 tcontext=u:object_r:device:s0 tclass=dir permissive=1
[29.164598]sda: sda1 sda2 < sda5 sda6 >
[29.184044] sd 0:0:0:0: [sda] Attached SCSI disk
之后就重复输出如下语句:
[91.377760] sd 0:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[91.377777] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 60 08 68 00 01 00 00
[91.377804] xhci-hcd xhci-hcd.7.auto: ERROR Transfer event for disabled endpoint or incorrect stream ring
[91.377821] xhci-hcd xhci-hcd.7.auto: @00000000f7051540 00000000 00000000 1b000000 04098001
[91.377980] sd 0:0:0:0: [sda] tag#1 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD IN
[91.377997] sd 0:0:0:0: [sda] tag#1 CDB: Read(10) 28 00 00 60 08 30 00 00 38 00
[91.378024] xhci-hcd xhci-hcd.7.auto: ERROR Transfer event for disabled endpoint or incorrect stream ring
[91.378041] xhci-hcd xhci-hcd.7.auto: @00000000f7051560 00000000 00000000 1b000000 04098001
[91.384062] scsi host0: uas_eh_bus_reset_handler start
[91.384146] xhci-hcd xhci-hcd.7.auto: ERROR Transfer event for disabled endpoint or incorrect stream ring
[91.384166] xhci-hcd xhci-hcd.7.auto: @00000000f7051580 00000000 00000000 1b000000 04078001
[91.384232] xhci-hcd xhci-hcd.7.auto: ERROR Transfer event for disabled endpoint or incorrect stream ring
[91.384247] xhci-hcd xhci-hcd.7.auto: @00000000f70515a0 00000000 00000000 1b000000 04078001
[91.384290] xhci-hcd xhci-hcd.7.auto: ERROR Transfer event for disabled endpoint or incorrect stream ring
[91.384305] xhci-hcd xhci-hcd.7.auto: @00000000f70515c0 00000000 00000000 1b000000 04078001
[91.451475] usb 6-1.4: reset SuperSpeed USB device number 4 using xhci-hcd
[91.468379] scsi host0: uas_eh_bus_reset_handler success
发现Kernel config里的CONFIG_USB_UAS=y配置项已打开了,最后只有修改drivers/usb/storage/unusual_uas.h文件,添加如下内容:
UNUSUAL_DEV(0x2537, 0x1068, 0x0000, 0x9999,
"SONY",
"External HDD",
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_IGNORE_UAS),
加上忽略UAS的标记后就能正常识别了。
或者直接将Kernel Config里的UAS配置项关闭掉:# CONFIG_USB_UAS is not set