支持UAS技术的移动硬盘识别问题

2024-10-12 12:04:47

1、最近在RK3399 Android7.1.2上面的USB3.0口接上一款标称为SONY牌的移动硬盘,接入时调试串口识别信息如下:

2、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-Access ATA TOSHIBA MQ01ABD1 1U PQ: 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

3、之后就不停的重复输出如下内容:

4、[ 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

5、从上面的提示可以看到UAS的相关字眼,明显RK3399 Android7.1.2对UAS特性支持并不太好,故而我们可以做如下处理:

6、如果Kernel Config里存在CONFIG_USB_UAS=y配置项,那么修改drivers/usb/storage/unusual_uas.h文件,添加如下内容:

7、UNUSUAL_DEV(0x2537, 0x1068, 0x0000, 0x9999,"SONY"稆糨孝汶;,"External HDD",USB_SC_DEVICE, USB_PR_DEVICE, NULL,US_FL_IGNORE_UAS),

8、即将该款移动硬盘的VID和PID添加进去,并使用US_FL_IGNORE_UAS标志来忽略这款移动硬盘,让它不使用UAS特性,这样只是会导致访问这款移动硬盘时,数据传输速度变慢。

9、直接修改Kernel Config,将UAS选项去掉,即添加或修改如下配置项:

10、# CONFIG_USB_UAS is not set

11、至此,这两种方法均可解决本次发现的问题,方法2是一劳永役,但会导致能正常支持UAS的移动硬盘无法使用该特性而影响访问速率。

猜你喜欢