USB is disconnected when WAN is up

Hello everyone!
I'm using "Linksys EA7300 v2" router with "Linux OpenWrt 5.4.154 #0 SMP Sun Oct 24 09:01:35 2021 mips GNU/Linux" installed.
There is a problem with USB drives.
Actually USB works only if 'wan' interface is down. When 'wan' goes up, USB is disconnected.
What's the reason for such a strange behaviour? I'd appreciate any advise of the way it may be fixed.

root@OpenWrt:~# opkg list-installed | grep usb
kmod-usb-core - 5.4.154-1
kmod-usb-storage - 5.4.154-1
kmod-usb-storage-uas - 5.4.154-1
kmod-usb3 - 5.4.154-1
libusb-1.0-0 - 1.0.24-4
usbids - 0.354-1
usbutils - 013-2

root@OpenWrt:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M
root@OpenWrt:~# ifconfig wan down
root@OpenWrt:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M
    |__ Port 1: Dev 6, If 0, Class=, Driver=usb-storage, 480M
root@OpenWrt:~# ifconfig wan up
root@OpenWrt:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M

root@OpenWrt:~# dmesg
[1854.912855] mt7530 mdio-bus:1f wan: Link is Down
[1855.359672] usb 1-1: new high-speed USB device number 6 using xhci-mtk
[1855.521753] usb-storage 1-1:1.0: USB Mass Storage device detected
[1855.528567] usb-storage 1-1:1.0: Quirks match for vid 090c pid 1000: 400
[1855.535799] scsi host0: usb-storage 1-1:1.0
[1856.552663] scsi 0:0:0:0: Direct-Access     Corsair  Flash Voyager    1100 PQ: 0 ANSI: 0 CCS
[1856.565276] sd 0:0:0:0: [sda] 7864320 512-byte logical blocks: (4.03 GB/3.75 GiB)
[1856.573589] sd 0:0:0:0: [sda] Write Protect is off
[1856.578453] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[1856.579104] sd 0:0:0:0: [sda] No Caching mode page found
[1856.584447] sd 0:0:0:0: [sda] Assuming drive cache: write through
[1856.634363]  sda: sda1 sda2
[1856.641099] sd 0:0:0:0: [sda] Attached SCSI removable disk
[1880.679081] mt7530 mdio-bus:1f wan: configuring for phy/gmii link mode
[1880.686150] 8021q: adding VLAN 0 to HW filter on device wan
[1883.750794] mt7530 mdio-bus:1f wan: Link is Up - 1Gbps/Full - flow control rx/tx
[1883.758288] IPv6: ADDRCONF(NETDEV_CHANGE): wan: link becomes ready
[1883.765518] usb 1-1: USB disconnect, device number 6
root@OpenWrt:~#
1 Like

First thing that comes to mind is power shortage. Is the USB drive powered from the usb port or has its own power supply?
Is the power supply of the router adequate?

1 Like

The plugged in device is Corsair Flash Voyager 4Gb USB stick.

Then verify if the power supply of the router is adequate to power on the router and the flash.

I flashed original Linksys firmware and checked USB port with both USB stick and USB HDD, there was no problem.

Using the original firmware doesn't necessarily rule out a power issue. It is entirely possible that the Linksys stock firmware uses less power overall (thus allowing more margin with respect to the external power supply or internal power circuitry) and/or allows a higher power to be delivered via the USB port relative to when OpenWrt is running.

Try connecting the flash drive to a powered USB hub and then connecting that to the router. If the drive still appears to disconnect when the WAN comes up, that would likely confirm that it is not power related.

2 Likes

Thank you for the hint, It's a pity, I don't have a powered USB hub at hand to check it right now.
Update:
I've tried another 12V 3.5A power adapter instead of original 12V 2A, but no way. The issue persists.
When I remove ethernet cable from wan, USB starts working, when I plug it in again, USB stops.

While USB power issues often occur with USB harddrives (typically drawing AMPS), I doubt that a 4GB USB stick (typically drawing 50...100mA) should cause this.

1 Like

I don't know how much power it can provide, but I have a lightning to USB adapter (with lightning input for charging) for my iPhone that is unable to power a Samsung flash drive (a simple USB thumb drive). This particular stick runs very warm when in use, so it is certainly consuming a decent amount of power. The adapter can work with that USB stick just fine if I plug in the lightning cable to provide power to the whole system. So while I tend to think that most USB sticks should be fine with well under 500mA, there are obviously exceptions to this rule.

EDIT: the drive I have apparently requires 300mA. That is still reasonably far below the 500mA limit of many USB ports, but still not insignificant.

Please read https://forum.openwrt.org/t/usb-not-working-on-linksys-ea7300/
I've found a solution to your issue. Not really a solution, but an easy workaround that works well.

1 Like

@psherman has good point. is not an issue about current drain, is about software power off the port (and dmesg is so clear...). as consequence, if u need all 5 eth ports in use and usb, just connect the usb hosts via a separate 5dc connection (ext powered hub or hardwire the dc for usb); once wan is up only the dc routed to usb port will be cut, data lines will be ok in any conditions. b /ps: super router by the way

1 Like

You don't have to disable the WAN port. The WAN LED is assigned to the wrong pin, and actually toggles USB power. Disable the LED to enable USB power:

echo 0 > /sys/class/leds/green:wan/brightness

There is an issue on Github about this, where I posted the correct LED GPIOs.

1 Like