TOS 4 - how to reset USB3 bus?

Hi,
is there any way how to reset USB3 bus on TOS 4 without Omnia reset?

Today I had to reset my Omnia, all looked OK, but now I discovered, that my USB3 external disc is not connected. Messages from log:

root@turris:~# grep usb /var/log/messages
May  6 07:07:03 turris kernel: [    3.120608] usbcore: registered new interface driver usbfs
May  6 07:07:03 turris kernel: [    3.120642] usbcore: registered new interface driver hub
May  6 07:07:03 turris kernel: [    3.120671] usbcore: registered new device driver usb
May  6 07:07:03 turris kernel: [    4.491882] orion-ehci f1058000.usb: EHCI Host Controller
May  6 07:07:03 turris kernel: [    4.497307] orion-ehci f1058000.usb: new USB bus registered, assigned bus number 1
May  6 07:07:03 turris kernel: [    4.504944] orion-ehci f1058000.usb: irq 40, io mem 0xf1058000
May  6 07:07:03 turris kernel: [    4.531360] orion-ehci f1058000.usb: USB 2.0 started, EHCI 1.00
May  6 07:07:03 turris kernel: [    4.545691] xhci-hcd f10f0000.usb3: xHCI Host Controller
May  6 07:07:03 turris kernel: [    4.551035] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 2
May  6 07:07:03 turris kernel: [    4.558605] xhci-hcd f10f0000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
May  6 07:07:03 turris kernel: [    4.567871] xhci-hcd f10f0000.usb3: irq 46, io mem 0xf10f0000
May  6 07:07:03 turris kernel: [    4.587277] xhci-hcd f10f0000.usb3: xHCI Host Controller
May  6 07:07:03 turris kernel: [    4.592615] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 3
May  6 07:07:03 turris kernel: [    4.600124] xhci-hcd f10f0000.usb3: Host supports USB 3.0  SuperSpeed
May  6 07:07:03 turris kernel: [    4.606612] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
May  6 07:07:03 turris kernel: [    4.622801] xhci-hcd f10f8000.usb3: xHCI Host Controller
May  6 07:07:03 turris kernel: [    4.628132] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 4
May  6 07:07:03 turris kernel: [    4.635692] xhci-hcd f10f8000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
May  6 07:07:03 turris kernel: [    4.644959] xhci-hcd f10f8000.usb3: irq 47, io mem 0xf10f8000
May  6 07:07:03 turris kernel: [    4.658766] xhci-hcd f10f8000.usb3: xHCI Host Controller
May  6 07:07:03 turris kernel: [    4.664102] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 5
May  6 07:07:03 turris kernel: [    4.671614] xhci-hcd f10f8000.usb3: Host supports USB 3.0  SuperSpeed
May  6 07:07:03 turris kernel: [    4.678097] usb usb5: We don't know the algorithms for LPM for this host, disabling LPM.
May  6 07:07:03 turris kernel: [    4.694332] usbcore: registered new interface driver usb-storage
May  6 07:07:03 turris kernel: [    5.027114] usb 3-1: new SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [    5.033703] usb 4-1: new full-speed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [    5.065956] usb 3-1: USB controller f10f0000.usb3 does not support streams, which are required by the UAS driver.
May  6 07:07:03 turris kernel: [    5.076267] usb 3-1: Please try an other USB controller if you wish to use UAS.
May  6 07:07:03 turris kernel: [    5.083599] usb-storage 3-1:1.0: USB Mass Storage device detected
May  6 07:07:03 turris kernel: [    5.089882] scsi host2: usb-storage 3-1:1.0
May  6 07:07:03 turris kernel: [    9.551403] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   30.001395] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   32.731394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   35.441393] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   38.151393] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   38.732181] usbcore: registered new interface driver uas
May  6 07:07:03 turris kernel: [   45.851401] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   48.561394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   51.271394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   53.981394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   56.691393] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   59.401394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   62.101394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   64.811394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   67.521393] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   70.231393] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   72.941394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   75.651393] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   78.351394] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   81.061398] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   83.771393] usb 3-1: reset SuperSpeed USB device number 2 using xhci-hcd
May  6 07:07:03 turris kernel: [   86.481393] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   86.701359] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   86.921353] usb 3-1: device not accepting address 2, error -22
May  6 07:07:03 turris kernel: [   87.191390] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   87.411360] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   87.631352] usb 3-1: device not accepting address 2, error -22
May  6 07:07:03 turris kernel: [   87.901390] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   88.121360] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   88.341352] usb 3-1: device not accepting address 2, error -22
May  6 07:07:03 turris kernel: [   88.611390] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   88.831359] xhci-hcd f10f0000.usb3: ERROR: unexpected setup address command completion code 0x11.
May  6 07:07:03 turris kernel: [   89.051352] usb 3-1: device not accepting address 2, error -22
May  6 07:07:03 turris kernel: [   89.131382] usb 3-1: USB disconnect, device number 2
May  6 07:07:03 turris kernel: [   90.510685] usbcore: registered new interface driver cdc_acm
May  6 07:07:03 turris kernel: [   90.602195] usbcore: registered new interface driver ums-alauda
May  6 07:07:03 turris kernel: [   90.608611] usbcore: registered new interface driver ums-cypress
May  6 07:07:03 turris kernel: [   90.615429] usbcore: registered new interface driver ums-datafab
May  6 07:07:03 turris kernel: [   90.621985] usbcore: registered new interface driver ums-freecom
May  6 07:07:03 turris kernel: [   90.628489] usbcore: registered new interface driver ums-isd200
May  6 07:07:03 turris kernel: [   90.635025] usbcore: registered new interface driver ums-jumpshot
May  6 07:07:03 turris kernel: [   90.641679] usbcore: registered new interface driver ums-karma
May  6 07:07:03 turris kernel: [   90.648075] usbcore: registered new interface driver ums-sddr09
May  6 07:07:03 turris kernel: [   90.654680] usbcore: registered new interface driver ums-sddr55
May  6 07:07:03 turris kernel: [   90.661166] usbcore: registered new interface driver ums-usbat
May  6 07:07:03 turris kernel: [   90.669000] usbcore: registered new interface driver usbserial
May  6 07:07:03 turris kernel: [   90.674953] usbcore: registered new interface driver usbserial_generic
May  6 07:07:03 turris kernel: [   90.681618] usbserial: USB Serial support registered for generic
May  6 07:07:03 turris kernel: [   90.726938] usbcore: registered new interface driver ftdi_sio
May  6 07:07:03 turris kernel: [   90.732804] usbserial: USB Serial support registered for FTDI USB Serial Device
May  6 07:07:03 turris kernel: [   90.747010] usb 4-1: Detected FT-X
May  6 07:07:03 turris kernel: [   90.750888] usb 4-1: FTDI USB Serial Device converter now attached to ttyUSB0
May  6 07:07:03 turris kernel: [   92.483058] usbcore: registered new interface driver qcserial
May  6 07:07:03 turris kernel: [   92.488874] usbserial: USB Serial support registered for Qualcomm USB modem
May  6 07:07:03 turris kernel: [   99.551363] xhci-hcd f10f0000.usb3: Abort failed to stop command ring: -110
May  6 07:07:03 turris kernel: [   99.558346] xhci-hcd f10f0000.usb3: xHCI host controller not responding, assume dead
May  6 07:07:03 turris kernel: [   99.566115] xhci-hcd f10f0000.usb3: HC died; cleaning up
May  6 07:07:03 turris kernel: [   99.571483] xhci-hcd f10f0000.usb3: Error while assigning device slot ID
May  6 07:07:03 turris kernel: [   99.578204] xhci-hcd f10f0000.usb3: Max number of devices this xHCI host supports is 32.
May  6 07:07:03 turris kernel: [   99.586326] usb usb3-port1: couldn't allocate usb_device

There is no xhci-hcd kernel module to reload :frowning:

It helped me only the power off.

1 Like

There is generally no way to hard-reset the USB bus from linux. I’ve tried a lot with various sensors (mainly Realsense cameras), and gave up. The only hope would be if the device supported a reset command. But that of course needs the link to be connected at least “a bit”.

So I have to restart :neutral_face:
Thanks.

I’ve logged via ssh, send reboot command and now disk works again.
But this is not a first time I have this issue. It was there in TOS3, now is in TOS4. There is something wrong with driver on Omnia or on USB disk.

Also I don’t know, what exactly went wrong this night with Omnia. Was really slow at morning, internet connection very unstable. Have no clue yet.

Check what driver you disk uses (using lsusb -t). There are two which can be used - usb mass storage and uas. You might try the other one to see if it helps (if your disk support UAS, which should be somewhere in product manual or datasheet). You can probably force the driver using a hotplug script.

You should be able to reset the usb bus by sending unbind/bind command to the xhci driver like:

echo -n "<usb_controller_id>" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo -n "<usb_controller_id>" | tee /sys/bus/pci/drivers/xhci_hcd/bind

Not sure how to get the id though as I do not see id with a lspci.

I’ve tried, but did not work :frowning:

root@turris:~# lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=orion-ehci/1p, 480M

I have two WD Blue (EZRZ), 3,5" - 3TB disc in ICY BOX IB-RD3620SU3. I’m not sure about the UAS support as I’ve bought them in 2016.

Well, you may just try the UAS driver and see if it works :slight_smile: I’d suggest trying on TurrisOS 4.x because it has a newer kernel with some uas-targeted improvements.

1 Like

I’m on TOS4 and it does not work :frowning:

root@turris:~# dmesg |grep usb
[    5.070541] usb 3-1: USB controller f10f0000.usb3 does not support streams, which are required by the UAS driver.
[    5.080863] usb 3-1: Please try an other USB controller if you wish to use UAS.
[    5.088194] usb-storage 3-1:1.0: USB Mass Storage device detected

And it still happening. It was OK last week, but this week I had to restart router on Monday and currently it does not work again :frowning:

What’s next? TOS5? New USB3 HDD box? Return to special NAS BOX?

Try usbreset?

This package contains the small usbreset utility which can be used to send a USB port reset to a USB device - useful for debugging or to force re-detection of particular devices.

root@turris:~# usbreset
Usage:
  usbreset PPPP:VVVV - reset by product and vendor id
  usbreset BBB/DDD   - reset by bus and device number
  usbreset "Product" - reset by product name

Devices:
  Number 004/002  ID 0403:6015  
  Number 003/002  ID 152d:0569  ICY BOX IB-RD3620
root@turris:~# usbreset 003/002

and frozes there :frowning:

A little crazy idea - Turris routers have GPIO pins. You could add a GPIO-controlled relay/mosfet and solder it somehow to the USB port, e.g. killing one of the power lines and routing it through the relay/mosfet. If done properly, it could solve the problem. If something goes wrong, you risk the USB port (the better case) or the whole router (the worse case). But I’m no electrician, you should definitely consult this with someone with deep knowledge :slight_smile:

@turris-admin wouldn’t it be a nice idea for the next generation of Turris routers (if you decide to make a new one at some time). Having USB/mSATA/mPCIe ports switchable by GPIO would be a killer feature :slight_smile:

Or maybe a safer solution - you can try to take a short extension cable, extract the power line, and do the harakiri there. This would be way safer and you could test everything properly before going wild. But you’d have to take care about not introducing impedance or breaking the shielding, otherwise the line could drop to slower speeds.

The latest revision of Omnia is without GPIO.
And I don’t want to do any harakiri as working internet is important for my family.

The safest option so far: buy something like https://www.vova.com/cs/Usb-Hub-3-0-High-Speed-4-7-Port-Usb-3-0-Hub-Splitter-On-Off-Switch-With-Eu-Us-GSN1584342187846269482750732-g17013454-m18480510 and exchange the mechanical switch for a GPIO-operated relay.

That’s not exactly correct. Turris Omnia sold as 2019 and 2020 edition has GPIO again.
https://docs.turris.cz/hw/omnia/revisions/

and you can see it here https://www.turris.cz/en/omnia/specifications/

Sorry for sharing wrong info.

So this is a equivalent to physical unplug? This does not work. On TOS3 I was able reload usb modules and I was able to access HDD without restart. But this is not possible on TOS4 :frowning:

root@turris:~# lsmod |egrep -i "usb|xhci"
ums_usbat              20480  0 
usb_wwan               16384  1 qcserial
usbserial              24576  5 qcserial,usb_wwan,ftdi_sio
root@turris:~#