Openwrt MTK USB3.0 識別UASP存儲失敗的解決方案

Openwrt MTK USB3.0 識別UASP存儲失敗的解決方案

 , 2019年05月06日 , Linux , 评论 在〈Openwrt MTK USB3.0 識別UASP存儲失敗的解決方案〉中留言功能已關閉 ,

手裏有個MT7621的設備自己鼓搗鼓搗廢物利用用來做NAS用
發現之前用USB3.0的U盤都可以正常使用
換了USB3.0的移動硬盤盒無法識別出硬盤
執行lsusb -t發現該設備的驅動標示爲uas
但是xhci-mtk看起來並不支持UASP設備
在內核日志中報了一堆錯誤:

1
2
3
4
5
6
7
8
9
10
11
12
kmodloader: loading kernel modules from /etc/modules.d/*
scsi host0: uas
xhci-mtk 1e1c0000.xhci: ERROR Transfer event for unknown stream ring slot 1 ep 6
xhci-mtk 1e1c0000.xhci: @000000000f72e170 0e8c4000 00000000 05000000 01078001
xhci-mtk 1e1c0000.xhci: ERROR Transfer event for unknown stream ring slot 1 ep 2
xhci-mtk 1e1c0000.xhci: @000000000f72e180 0e8c4100 00000000 05000000 01038001
scsi 0:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
scsi 0:0:0:0: tag#0 CDB: opcode=0x12 12 00 00 00 24 00
xhci-mtk 1e1c0000.xhci: Mismatch between completed Set TR Deq Ptr command & xHCI internal state.
xhci-mtk 1e1c0000.xhci: ep deq seg = 8d8acd80, deq ptr = ae33c010
scsi host0: uas_eh_device_reset_handler FAILED to get lock err -16
scsi 0:0:0:0: Device offlined - not ready after error recovery

那麽解決方案就很簡單了
1.去掉uas驅動

1
opkg remove kmod-usb-storage-uas

去掉之後發現內核日志沒有報錯了
但是在識別出設備之後就沒下文了

1
2
usb 2-1: USB disconnect, device number 5
usb 2-1: new SuperSpeed USB device number 6 using xhci-mtk

使用lsusb查看設備 發現驅動爲空

1
2
3
4
5
6
7
8
9
>lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 008: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
>lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
    |__ Port 1: Dev 8, If 0, Class=Mass Storage, Driver=, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M

那麽就將設備[174c:55aa]強行驅動成usb-storage

1
sed -i 's/usb-storage/usb-storage quirks=174c:55aa:u/g' /etc/modules.d/usb-storage

重啓可以看到設備已經可以成功識別使用了

1
2
3
4
5
6
usb 2-1: new SuperSpeed USB device number 2 using xhci-mtk
usb 2-1: UAS is blacklisted for this device, using usb-storage instead
usb-storage 2-1:1.0: USB Mass Storage device detected
usb-storage 2-1:1.0: Quirks match for vid 174c pid 55aa: c00000
scsi host0: usb-storage 2-1:1.0
usbcore: registered new interface driver usb-storage