[xiaomi R3G] SSD USB3 driver not working


#1

I would like to have SSD working for DLNA feature. Unfortunatelly can not install my drive (SSD USB3 external drive Trancend)

I did basic research on few topics on this forum, especially this one link looks to be close for me

but can not achieve success.
some basic info:
firmware: 18.06.1, r7258-5eb055306f
hardware is xiaomi router R3G

root@OpenWrt:~# opkg list-installed | grep usb
kmod-usb-core - 4.14.63-1
kmod-usb-ledtrig-usbport - 4.14.63-1
kmod-usb-storage - 4.14.63-1
kmod-usb-storage-uas - 4.14.63-1
kmod-usb-uhci - 4.14.63-1
kmod-usb3 - 4.14.63-1
libusb-1.0 - 1.0.22-1
usbutils - 007-7
root@OpenWrt:~# opkg list-installed | grep fs
fstools - 2018-04-16-e2436836-1
kmod-fs-autofs4 - 4.14.63-1
kmod-fs-vfat - 4.14.63-1

part of dmesg output

[  482.325912] kmodloader: loading kernel modules from /etc/modules.d/*
[  482.338877] scsi host0: uas
[  482.342591] xhci-mtk 1e1c0000.xhci: ERROR Transfer event for unknown stream ring slot 1 ep 6
[  482.351013] xhci-mtk 1e1c0000.xhci: @000000000f72e170 0e8c4000 00000000 05000000 01078001
[  482.359154] xhci-mtk 1e1c0000.xhci: ERROR Transfer event for unknown stream ring slot 1 ep 2
[  482.367554] xhci-mtk 1e1c0000.xhci: @000000000f72e180 0e8c4100 00000000 05000000 01038001
[  503.572931] scsi 0:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[  503.580497] scsi 0:0:0:0: tag#0 CDB: opcode=0x12 12 00 00 00 24 00
[  503.586791] xhci-mtk 1e1c0000.xhci: Mismatch between completed Set TR Deq Ptr command & xHCI internal state.
[  503.596581] xhci-mtk 1e1c0000.xhci: ep deq seg = 8d8acd80, deq ptr = ae33c010
[  504.662903] scsi host0: uas_eh_device_reset_handler FAILED to get lock err -16
[  504.670127] scsi 0:0:0:0: Device offlined - not ready after error recovery
[  504.677655] usbcore: registered new interface driver uas
[  504.683226] kmodloader: done loading kernel modules from /etc/modules.d/*
root@OpenWrt:/mnt# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
    |__ Port 1: Dev 4, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M

unfortunatelly here nothing:

root@OpenWrt:/mnt# ls -l /dev/sd*
ls: /dev/sd*: No such file or directory

Please advice what could go wrong... I followed wiki realted topic to install usb storage.
I am not advanced in linux - just looking on forums and trying to find similar problem (without really knowing what that means) - so please be patient...


#2

Can you try kmod-usb-dwc2 kmod-usb-dwc3 kmod-usb-ohci block-mount blkid kmod-usb2 kmod-usb-ehci and then see if it works? I have seen people with a lot of problems with this particular router in this forum.


#3

Installed all mentioned. (Some already have been installed).
Do I have to insmod them?

After reboot dmesg gives the same error.

00.036310] usb 2-1: new SuperSpeed USB device number 2 using xhci-mtk
[  100.070962] scsi host0: uas
[  100.074875] xhci-mtk 1e1c0000.xhci: ERROR Transfer event for unknown stream ring slot 1 ep 6
[  100.083337] xhci-mtk 1e1c0000.xhci: @000000000f7bc170 0e2cc000 00000000 05000000 01078001
[  100.091515] xhci-mtk 1e1c0000.xhci: ERROR Transfer event for unknown stream ring slot 1 ep 2
[  100.099927] xhci-mtk 1e1c0000.xhci: @000000000f7bc180 0e2cc100 00000000 05000000 01038001
[  121.535939] scsi 0:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[  121.543507] scsi 0:0:0:0: tag#0 CDB: opcode=0x12 12 00 00 00 24 00
[  121.549803] xhci-mtk 1e1c0000.xhci: Mismatch between completed Set TR Deq Ptr command & xHCI internal state.
[  121.559592] xhci-mtk 1e1c0000.xhci: ep deq seg = 8e2cda80, deq ptr = aea1e010
[  122.625952] scsi host0: uas_eh_device_reset_handler FAILED to get lock err -16
[  122.633175] scsi 0:0:0:0: Device offlined - not ready after error recovery
root@OpenWrt:~#

#4

The modules would have been loaded already, no need insmod them. I think someone with more expertise might be able to help you.


#5

Thank you anyway . Can this be related to filesystem on this drive? I mean if there is unexpected fs there like NTFS?


#6

No it's not related to file system at all, right now your drive is not able to connect to the router so router doesnt even know if any partition exists at all. FS will be a concern when you can successfully connect your drive. Have you tried the snapshot version of openwrt? It might help you as it helped the other person in the above forum link.


#7

You know - I will try today later and let know.
That is strange - I wrote in first post about that link and specific problem - but I see now that I misunderstood it. Before I was sure that the problem was solved by installing version 18.06 (I have it now). I was so focused on install mentioned there kmods... After reading it again... Yeah I know - reading with understanding ... Hope it will help.
In the mean time - do you know command to "unplug and plug again" usb device in openwrt? I have to visit basement every time I want to see if there is a difference...


#8

I think there is a package called usb-modeswitch, it might be worth looking. You maybe able to find something that turns off the usb power to ssd making it look like it has been unplugged and then turn on the power again. Also take a look at this.


#9

after upgrade to SNAPSHOT, r8684-f6e9f23

root@OpenWrt:~# opkg list-installed | grep usb
kmod-usb-core - 4.14.87-1
kmod-usb-ledtrig-usbport - 4.14.87-1
kmod-usb3 - 4.14.87-1
root@OpenWrt:~#

root@OpenWrt:~# opkg list-installed | grep block
root@OpenWrt:~#

root@OpenWrt:~# opkg list-installed | grep fs
fstools - 2018-09-29-29e53af0-3


root@OpenWrt:~# dmesg | grep usb
[    5.497885] usb_vbus: disabling
[    6.655080] usbcore: registered new interface driver usbfs
[    6.660694] usbcore: registered new interface driver hub
[    6.666161] usbcore: registered new device driver usb
[    6.680857] xhci-mtk 1e1c0000.xhci: 1e1c0000.xhci supply vusb33 not found, using dummy regulator
[    6.750407] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    7.486623] usb 2-1: new SuperSpeed USB device number 2 using xhci-mtk


root@OpenWrt:~# opkg install kmod-usb-storage
Installing kmod-usb-storage (4.14.87-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.87-1-ab71e6baa247b994f1363879625a7e6f/kmod-usb-storage_4.14.87-1_mipsel_24kc.ipk
Installing kmod-scsi-core (4.14.87-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.87-1-ab71e6baa247b994f1363879625a7e6f/kmod-scsi-core_4.14.87-1_mipsel_24kc.ipk
Configuring kmod-scsi-core.
Configuring kmod-usb-storage.
root@OpenWrt:~#

root@OpenWrt:~# opkg install usbutils
Installing usbutils (007-9) to root...
Downloading http://downloads.openwrt.org/snapshots/packages/mipsel_24kc/base/usbutils_007-9_mipsel_24kc.ipk
Installing librt (1.1.20-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/packages/librt_1.1.20-1_mipsel_24kc.ipk
Installing libusb-1.0 (1.0.22-1) to root...
Downloading http://downloads.openwrt.org/snapshots/packages/mipsel_24kc/base/libusb-1.0_1.0.22-1_mipsel_24kc.ipk
Configuring librt.
Configuring libusb-1.0.
Configuring usbutils.
root@OpenWrt:~#


root@OpenWrt:~# opkg install kmod-fs-vfat
Installing kmod-fs-vfat (4.14.87-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.87-1-ab71e6baa247b994f1363879625a7e6f/kmod-fs-vfat_4.14.87-1_mipsel_24kc.ipk
Installing kmod-nls-cp437 (4.14.87-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.87-1-ab71e6baa247b994f1363879625a7e6f/kmod-nls-cp437_4.14.87-1_mipsel_24kc.ipk
Installing kmod-nls-iso8859-1 (4.14.87-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.87-1-ab71e6baa247b994f1363879625a7e6f/kmod-nls-iso8859-1_4.14.87-1_mipsel_24kc.ipk
Installing kmod-nls-utf8 (4.14.87-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.87-1-ab71e6baa247b994f1363879625a7e6f/kmod-nls-utf8_4.14.87-1_mipsel_24kc.ipk
Configuring kmod-nls-cp437.
Configuring kmod-nls-iso8859-1.
Configuring kmod-nls-utf8.
Configuring kmod-fs-vfat.
root@OpenWrt:~#


root@OpenWrt:~# opkg install block-mount
Installing block-mount (2018-09-29-29e53af0-3) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/packages/block-mount_2018-09-29-29e53af0-3_mipsel_24kc.ipk
Configuring block-mount.
this file has been obsoleted. please call "/sbin/block mount" directly
root@OpenWrt:~#

root@OpenWrt:~# dmesg | grep usb
[    5.497885] usb_vbus: disabling
[    6.655080] usbcore: registered new interface driver usbfs
[    6.660694] usbcore: registered new interface driver hub
[    6.666161] usbcore: registered new device driver usb
[    6.680857] xhci-mtk 1e1c0000.xhci: 1e1c0000.xhci supply vusb33 not found, using dummy regulator
[    6.750407] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    7.486623] usb 2-1: new SuperSpeed USB device number 2 using xhci-mtk
[  250.567010] usbcore: registered new interface driver usb-storage

after reboot we have:

root@OpenWrt:~# dmesg | grep usb
[    5.507153] usb_vbus: disabling
[    6.663965] usbcore: registered new interface driver usbfs
[    6.669575] usbcore: registered new interface driver hub
[    6.675047] usbcore: registered new device driver usb
[    6.689604] xhci-mtk 1e1c0000.xhci: 1e1c0000.xhci supply vusb33 not found, using dummy regulator
[    6.759729] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    7.566117] usb 2-1: new SuperSpeed USB device number 2 using xhci-mtk
[   11.192779] usbcore: registered new interface driver usb-storage
root@OpenWrt:~#

root@OpenWrt:~# dmesg | grep scsi
root@OpenWrt:~# dmesg | grep error
[    2.489010] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
root@OpenWrt:~#

root@OpenWrt:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M
root@OpenWrt:~#

missing driver...
following
https://openwrt.org/docs/guide-user/storage/usb-installing

point 8 there says to try opkg install kmod-usb-storage-uas

root@OpenWrt:~# opkg install kmod-usb-storage-uas
Installing kmod-usb-storage-uas (4.14.87-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.87-1-ab71e6baa247b994f1363879625a7e6f/kmod-usb-storage-uas_4.14.87-1_mipsel_24kc.ipk
Configuring kmod-usb-storage-uas.

root@OpenWrt:~# dmesg | grep usb
[    5.507153] usb_vbus: disabling
[    6.663965] usbcore: registered new interface driver usbfs
[    6.669575] usbcore: registered new interface driver hub
[    6.675047] usbcore: registered new device driver usb
[    6.689604] xhci-mtk 1e1c0000.xhci: 1e1c0000.xhci supply vusb33 not found, using dummy regulator
[    6.759729] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    7.566117] usb 2-1: new SuperSpeed USB device number 2 using xhci-mtk
[   11.192779] usbcore: registered new interface driver usb-storage
[  257.665113] usbcore: registered new interface driver uas
root@OpenWrt:~#


root@OpenWrt:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M
root@OpenWrt:~# dmesg | grep scsi
[   11.225783] scsi host0: uas
[   32.576709] scsi 0:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[   32.584264] scsi 0:0:0:0: tag#0 CDB: opcode=0x12 12 00 00 00 24 00
[   33.666675] scsi host0: uas_eh_device_reset_handler FAILED to get lock err -16
[   33.673876] scsi 0:0:0:0: Device offlined - not ready after error recovery
root@OpenWrt:~#

Unfortunaltelly it is the same status like before change to snapshot...

Any ideas what more can I do?

*EDIT

after more looking for similar problem, found something interesting (maybe) here

the idea is that uas driver is not patient enough for drive initialization time. solution there is:

"usb-storage.delay_use=5" to the kernel or add "options usb_storage delay_use=5" to some custom .conf file in the modprobe.d directory....."

but how to do it in my openwrt ?

*******EDIT 2 ********
tried to send

echo 10 > /sys/module/usb_storage/parameters/delay_use

but no change in behaviour.

Additionally I found that many users who are using USB3 on this router have strange issues with 2,4G radio (5G is ok) , so I assume that even if I will solve that problem, will get in another trap.

What I found is that if I connect the disk thru 2.0 cable - it works (of course with 2.0 speed )

This is fine for me.

Anyway the problem is not resolved, and if someone have idea - will try it to learn something.


#10

I think it will be better to wait for the next Openwrt release. USB 3 is fairly new and although drivers are available there still seems to be a gap between stable support. It is possible that the router uses some new protocols to define the USB 3 interface and that is why it's refusing to work with openwrt just yet.

It's not wrong to say that the stable support will be available in future at some point. Till then you should use the USB 2.


#11

@ahmar16 - You are right, and this confirms what I discovered by myself too. thank you for your time and suggestions. Xiaomi router R3g is very capable (real dual radio) for little money. But this comes with some nasty, widely reported USB3<>2,4G radio interference. So if that would be my next trouble - I prefer to stay with USB2 for even longer time.

What I also learned , it is not necessary to use another USB cable , just enough is not to insert fully USB3 cable into socket (USB2 contact is physically before 3.0 pins).


#12

There is a patch for forcing USB2 here: Xiaomi Wifi Router 3G - 18.06.x / Wifi issues 2.4GHz + 5GHz