How to reset USB bus?


#1

Hi all, is it possible to reset USB bus without restarting the device ? I have on my Omnia USB dongle for turris gadgets and USB TV tuner - both stop working after few days. Plug out and plug in don’t help :frowning: only Omnia restart. Load is 3.00 and “lsusb” shows nothing and freezes … nothing in system log

… dmesg | grep usb
[135509.823980] usb 4-1: USB disconnect, device number 2
[135509.823997] usb 4-1.2: USB disconnect, device number 3
[135510.220589] usb 5-1: USB disconnect, device number 2
[135510.500804] usb 5-1: new SuperSpeed USB device number 3 using xhci-hcd
[138753.329472] usb 5-1: USB disconnect, device number 3
[138753.609713] usb 5-1: new SuperSpeed USB device number 4 using xhci-hcd

any advice what to try or how to debug ? Haven’t restarted yet and trying to solve it without restart …

Thanks in advance


#2

usbreset PPPP:VVVV - reset by product and vendor id
usbreset BBB/DDD - reset by bus and device number
usbreset “Product” - reset by product name


#3

Thanks, but it seems to reset USB devices and I need to reset or reinicialize Omnia’s USB bus or driver without rebooting the Omnia if it is possible…

root@Omnia:~# lsusb - show nothing and freezes

root@Omnia:~# 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 001/002 ID 05c6:9215 Quectel LTE Module
Number 002/002 ID 7392:7811 802.11n WLAN Adapter

  • here should be 2 more devices - Jablotron dongle and TV tuner
    but terminal again freezes

I had been using both devices on Turris 1.0 for a lot of months, but few months ago USB started to stop working few days after reboot … so I moved both to Omnia and again few weeks maybe months all was OK, but now it stops working again after few days :frowning:

I will start debuging by removing one device and leaving another one … we will see


#4

maybe try to remove the usb modules with rmmod and then load again with modprobe (or insmod).

root@kukuzi:~# lsmod |grep usbcore
usb_common              2381  1 usbcore
usbcore               128799 29 qcserial

#5

Thanks - I will try next time …

lsusb output after reboot :

root@Omnia:~# lsusb
Bus 004 Device 004: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 004 Device 003: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 002: ID 05e3:0616 Genesys Logic, Inc.
Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless Modem
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

here we can see that Bus 001 and 002 were OK and Bus 003, 004, 005 was not working …


#6

again after 13 days … but atleast something in the log …

2017-11-12T03:12:56+01:00 info kernel[]: [1135998.356549] usb 4-1: USB disconnect, device number 2
2017-11-12T03:12:56+01:00 info kernel[]: [1135998.356559] usb 4-1.4: USB disconnect, device number 3
2017-11-12T03:12:56+01:00 err kernel[]: [1135998.356666] ftdi_sio ttyUSB0: error from flowcontrol urb
2017-11-12T03:12:56+01:00 info kernel[]: [1135998.362286] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
2017-11-12T03:12:56+01:00 info kernel[]: [1135998.362331] ftdi_sio 4-1.4:1.0: device disconnected
2017-11-12T03:12:57+01:00 info kernel[]: [1135998.753157] usb 4-1: new high-speed USB device number 4 using xhci-hcd
2017-11-12T03:12:57+01:00 info kernel[]: [1135998.763842] usb 5-1: USB disconnect, device number 5
2017-11-12T03:12:57+01:00 info kernel[]: [1135998.905444] hub 4-1:1.0: USB hub found
2017-11-12T03:12:57+01:00 info kernel[]: [1135998.906670] hub 4-1:1.0: 4 ports detected
2017-11-12T03:12:57+01:00 info kernel[]: [1135999.043334] usb 5-1: new SuperSpeed USB device number 6 using xhci-hcd
2017-11-12T03:12:57+01:00 info kernel[]: [1135999.067793] hub 5-1:1.0: USB hub found
2017-11-12T03:12:57+01:00 info kernel[]: [1135999.068220] hub 5-1:1.0: 4 ports detected
2017-11-12T03:12:57+01:00 info kernel[]: [1135999.193153] usb 4-1.4: new full-speed USB device number 5 using xhci-hcd
2017-11-12T03:12:57+01:00 info kernel[]: [1135999.303036] ftdi_sio 4-1.4:1.0: FTDI USB Serial Device converter detected
2017-11-12T03:12:57+01:00 info kernel[]: [1135999.303181] usb 4-1.4: Detected FT-X
2017-11-12T03:12:57+01:00 info kernel[]: [1135999.304312] usb 4-1.4: FTDI USB Serial Device converter now attached to ttyUSB0

2017-11-12T04:07:00+01:00 info kernel[]: [1139241.862796] usb 5-1: USB disconnect, device number 6
2017-11-12T04:07:00+01:00 info kernel[]: [1139242.143039] usb 5-1: new SuperSpeed USB device number 7 using xhci-hcd
2017-11-12T04:07:00+01:00 info kernel[]: [1139242.167292] hub 5-1:1.0: USB hub found
2017-11-12T04:07:00+01:00 info kernel[]: [1139242.167694] hub 5-1:1.0: 4 ports detected

2017-11-12T05:01:03+01:00 info kernel[]: [1142484.964572] usb 5-1: USB disconnect, device number 7
2017-11-12T05:01:04+01:00 info kernel[]: [1142485.244777] usb 5-1: new SuperSpeed USB device number 8 using xhci-hcd
2017-11-12T05:01:04+01:00 info kernel[]: [1142485.269434] hub 5-1:1.0: USB hub found
2017-11-12T05:01:04+01:00 info kernel[]: [1142485.269901] hub 5-1:1.0: 4 ports detected

2017-11-12T05:55:07+01:00 info kernel[]: [1145728.067520] usb 5-1: USB disconnect, device number 8
2017-11-12T05:55:07+01:00 info kernel[]: [1145728.347721] usb 5-1: new SuperSpeed USB device number 9 using xhci-hcd
2017-11-12T05:55:07+01:00 info kernel[]: [1145728.372143] hub 5-1:1.0: USB hub found
2017-11-12T05:55:07+01:00 info kernel[]: [1145728.372550] hub 5-1:1.0: 4 ports detected

and

:~# dmesg | grep usb
[1129512.545130] usb 5-1: USB disconnect, device number 4
[1129512.825321] usb 5-1: new SuperSpeed USB device number 5 using xhci-hcd
[1135998.356549] usb 4-1: USB disconnect, device number 2
[1135998.356559] usb 4-1.4: USB disconnect, device number 3
[1135998.753157] usb 4-1: new high-speed USB device number 4 using xhci-hcd
[1135998.763842] usb 5-1: USB disconnect, device number 5
[1135999.043334] usb 5-1: new SuperSpeed USB device number 6 using xhci-hcd
[1135999.193153] usb 4-1.4: new full-speed USB device number 5 using xhci-hcd
[1135999.303181] usb 4-1.4: Detected FT-X
[1135999.304312] usb 4-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
[1139241.862796] usb 5-1: USB disconnect, device number 6
[1139242.143039] usb 5-1: new SuperSpeed USB device number 7 using xhci-hcd
[1142484.964572] usb 5-1: USB disconnect, device number 7
[1142485.244777] usb 5-1: new SuperSpeed USB device number 8 using xhci-hcd
[1145728.067520] usb 5-1: USB disconnect, device number 8
[1145728.347721] usb 5-1: new SuperSpeed USB device number 9 using xhci-hcd
[1148971.190826] usb 5-1: USB disconnect, device number 9
[1148971.471017] usb 5-1: new SuperSpeed USB device number 10 using xhci-hcd
[1152214.301834] usb 5-1: USB disconnect, device number 10
[1152214.582049] usb 5-1: new SuperSpeed USB device number 11 using xhci-hcd

so any new code in kernel regarding USB bus ? No need to remove usb device …


#8

I have the same problem with my USB HDDs.
I connect them at evening and they have /dev/sdc and /dev/sdd.
But they have /dev/sde and /dev/sdf in the morning. And also they are unmounted. I was able to mount one them.
I have to reboot Turris 1.0 to connect second one.

PS: This happens each night. hd-idle is not enabled. And also I was coping from one of these HDD during whole night and even that they disconnect. Because of that copying failed.


#9

Is there any solution for this USB issue?

I have Turris Omnia and both USBs are unstable and HDDs disconnects after some time. I encounter this issue in the past and then my turris have one year pause in the paper box (due to house reconstruction) but it didn’t grow up. Possible HW issue?

What is package for usbreset? It seems I don’t have it included.

Thanks

Attaching some logs…

[ 6187.010995] xhci-hcd f10f0000.usb3: xHCI host not responding to stop endpoint command.
[ 6187.011006] xhci-hcd f10f0000.usb3: Assuming host is dying, halting host.
[ 6187.011024] xhci-hcd f10f0000.usb3: HC died; cleaning up
[ 6187.016545] usb 3-1: USB disconnect, device number 2
[ 6187.031033] sd 2:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[ 6187.031045] sd 2:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 ff 0d d8 00 00 1e 00
[ 6187.031050] blk_update_request: I/O error, dev sda, sector 536374976
[ 6187.037467] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 587202560 size 8388608 starting block 67047174)
[ 6187.037473] Buffer I/O error on device sda2, logical block 66970112
[ 6187.043759] Buffer I/O error on device sda2, logical block 66970113
[ 6187.050040] Buffer I/O error on device sda2, logical block 66970114
[ 6187.056321] Buffer I/O error on device sda2, logical block 66970115
[ 6187.062601] Buffer I/O error on device sda2, logical block 66970116
[ 6187.068882] Buffer I/O error on device sda2, logical block 66970117
[ 6187.075162] Buffer I/O error on device sda2, logical block 66970118
[ 6187.081442] Buffer I/O error on device sda2, logical block 66970119
[ 6187.087723] Buffer I/O error on device sda2, logical block 66970120
[ 6187.094003] Buffer I/O error on device sda2, logical block 66970121
[ 6187.100581] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 587202560 size 8388608 starting block 67047430)
[ 6187.100869] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 587202560 size 8388608 starting block 67047686)
[ 6187.101181] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 587202560 size 8388608 starting block 67047942)
[ 6187.101485] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 587202560 size 8388608 starting block 67048198)
[ 6187.101773] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 587202560 size 8388608 starting block 67048454)
[ 6187.102056] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 595591168 size 5767168 starting block 67048710)
[ 6187.102338] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 595591168 size 5767168 starting block 67048966)
[ 6187.102620] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 595591168 size 5767168 starting block 67049222)
[ 6187.102903] EXT4-fs warning (device sda2): ext4_end_bio:330: I/O error -5 writing to inode 98697877 (offset 595591168 size 5767168 starting block 67049478)
[ 6187.111027] sd 2:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[ 6187.111038] sd 2:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 ff 0d f6 00 00 10 00
[ 6187.111044] blk_update_request: I/O error, dev sda, sector 536375216
[ 6187.187990] JBD2: Detected IO errors while flushing file data on sda2-8
[ 6187.188017] Aborting journal on device sda2-8.
[ 6187.192533] JBD2: Error -5 detected when updating journal superblock for sda2-8.
[ 6187.200662] JBD2: Detected IO errors while flushing file data on sda2-8
[ 6187.261096] EXT4-fs error (device sda2): ext4_journal_check_start:56: Detected aborted journal
[ 6187.269840] EXT4-fs (sda2): Remounting filesystem read-only
[ 6187.275477] EXT4-fs (sda2): previous I/O error to superblock detected
[ 6187.547456] sd 2:0:0:0: [sda] Synchronizing SCSI cache
[ 6187.547660] sd 2:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x01 driverbyte=0x00

[ 7265.991102] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7266.411050] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7267.241053] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7267.401106] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7267.561041] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7267.721045] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7267.881081] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7268.041039] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7268.201035] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7268.361046] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7268.521053] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7268.681039] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7268.841038] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7269.001040] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7269.161036] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7269.321051] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7269.481045] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7269.641084] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7269.801059] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7269.961052] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7270.121058] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7270.281048] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7270.441043] usb 5-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 7270.601055] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7270.811025] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7271.020999] usb 5-1: device not accepting address 2, error -22
[ 7271.441044] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7271.651019] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7271.860999] usb 5-1: device not accepting address 2, error -22
[ 7272.281040] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7272.491014] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7272.700993] usb 5-1: device not accepting address 2, error -22
[ 7273.121046] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7273.331077] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 7273.540994] usb 5-1: device not accepting address 2, error -22
[ 7273.601030] usb 5-1: USB disconnect, device number 2
[ 7273.621036] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[ 7273.621046] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 17 51 2c 9a 00 00 1e 00
[ 7273.621052] blk_update_request: I/O error, dev sda, sector 3129566416
[ 7273.627518] Buffer I/O error on dev sda2, logical block 391118996, lost async page write
[ 7273.635650] Buffer I/O error on dev sda2, logical block 391118997, lost async page write
[ 7273.643769] Buffer I/O error on dev sda2, logical block 391118998, lost async page write
[ 7273.651886] Buffer I/O error on dev sda2, logical block 391118999, lost async page write
[ 7273.659997] Buffer I/O error on dev sda2, logical block 391119000, lost async page write
[ 7273.668113] Buffer I/O error on dev sda2, logical block 391119001, lost async page write
[ 7273.676228] Buffer I/O error on dev sda2, logical block 391119002, lost async page write
[ 7273.684343] Buffer I/O error on dev sda2, logical block 391119003, lost async page write
[ 7273.692458] Buffer I/O error on dev sda2, logical block 391119004, lost async page write
[ 7273.700571] Buffer I/O error on dev sda2, logical block 391119005, lost async page write
[ 7273.713162] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[ 7273.713172] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 17 51 2c b8 00 00 1e 00
[ 7273.713177] blk_update_request: I/O error, dev sda, sector 3129566656
[ 7273.719725] blk_update_request: I/O error, dev sda, sector 0
[ 7273.725430] JBD2: recovery failed
[ 7273.725438] EXT4-fs (sda2): error loading journal
[ 7273.749470] blk_update_request: I/O error, dev sda, sector 0
[ 7273.755172] JBD2: recovery failed
[ 7273.755179] EXT4-fs (sda2): error loading journal
[ 7273.773510] sd 3:0:0:0: [sda] Synchronizing SCSI cache
[ 7273.773626] sd 3:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x01 driverbyte=0x00
[ 7273.776370] VFS: Dirty inode writeback failed for block device sda2 (err=-5).
[ 7288.268462] xhci-hcd f10f8000.usb3: Stopped the command ring failed, maybe the host is dead
[ 7288.276840] xhci-hcd f10f8000.usb3: Abort command ring failed
[ 7288.282782] xhci-hcd f10f8000.usb3: HC died; cleaning up
[ 7288.288125] xhci-hcd f10f8000.usb3: Error while assigning device slot ID
[ 7288.294961] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.294971] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.294979] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.294985] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.294997] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.295004] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.295010] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.295017] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.295023] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.295032] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 7288.296427] xhci-hcd f10f8000.usb3: Max number of devices this xHCI host supports is 32.
[ 7288.305590] usb usb5-port1: couldn't allocate usb_device

#10
root@turris:~# opkg update
Downloading https://repo.turris.cz/omnia/packages//base/Packages.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  144k  100  144k    0     0  1098k      0 --:--:-- --:--:-- --:--:-- 1317k
Updated list of available packages in /var/opkg-lists/omnia_base
...
root@turris:~# opkg list | grep usbreset
usbreset - 4 - 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:~#
root@turris:~# opkg install usbreset
Installing usbreset (4) to root...
Downloading https://repo.turris.cz/omnia/packages//base/usbreset_4_mvebu.ipk
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3798  100  3798    0     0  55043      0 --:--:-- --:--:-- --:--:-- 55852
Configuring usbreset.
root@turris:~#

#11

Sorry :roll_eyes: I tried opkg search usbreset but this doesn’t cross my mind…