[Solved] Usb port with 3G modem disconnects and stays disconnected over reboot

I have a working setup with a modded Huwaei E3276 4G modem (running in 3G/umts mode over NCM) connected to the USB port on my Netgear WNDR3800. My question here is not about the 3G stuff but rather really isolated to the USB connection, as I saw I surprising behaviour today, when the device didn't connect after a reboot.

As written in other posts spontaneous USB disconnects may happen after shorter or longer uptimes with various 3G modems, and it happens to me too sometimes but not so often. This post is not about that particular issue.
For completeness, here's the log from the latest disconnect (no related log events preceding the usb events):

Fri Jun 12 11:27:48 2020 kern.info kernel: [79113.865537] usb 1-1: USB disconnect, device number 2
Fri Jun 12 11:27:48 2020 kern.info kernel: [79113.870909] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
Fri Jun 12 11:27:48 2020 kern.info kernel: [79113.879026] option 1-1:1.0: device disconnected
Fri Jun 12 11:27:48 2020 kern.info kernel: [79113.883881] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
Fri Jun 12 11:27:48 2020 kern.info kernel: [79113.891994] option 1-1:1.1: device disconnected
Fri Jun 12 11:27:48 2020 daemon.notice netifd: Network device 'wwan0' link is down
Fri Jun 12 11:27:48 2020 daemon.notice netifd: Interface 'wwan_4' is disabled

So, we now have a USB device that has disconnected and the related devices ttyUSB0 and ttyUSB1 have gone away.

So, now doing a reboot:
# reboot
but when the system came up the USB device still did not get activated. The usb drivers etc got loaded fine according to the kernel log:

[    5.653583] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.720413] usbcore: registered new interface driver usbfs
[    5.725995] usbcore: registered new interface driver hub
[    5.731413] usbcore: registered new device driver usb
[    5.740557] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.748278] ehci-platform: EHCI generic platform driver
[    5.753642] ehci-platform ehci-platform: EHCI Host Controller
[    5.759405] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    5.767428] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    5.789845] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    5.796898] hub 1-0:1.0: USB hub found
[    5.800970] hub 1-0:1.0: 2 ports detected
[    5.807215] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.814503] ohci-platform: OHCI generic platform driver
[    5.819856] ohci-platform ohci-platform: Generic Platform OHCI controller
[    5.826649] ohci-platform ohci-platform: new USB bus registered, assigned bus number 2
[    5.834646] ohci-platform ohci-platform: irq 14, io mem 0x1c000000
[    5.904654] hub 2-0:1.0: USB hub found
[    5.908662] hub 2-0:1.0: 2 ports detected
[    5.913454] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
...
[   13.655841] usbcore: registered new interface driver cdc_wdm
...
[   13.741706] usbcore: registered new interface driver usb-storage
[   13.768325] usbcore: registered new interface driver usbserial
[   13.774281] usbcore: registered new interface driver usbserial_generic
[   13.780904] usbserial: USB Serial support registered for generic
...
[   13.826717] usbcore: registered new interface driver cdc_ether
[   13.839765] usbcore: registered new interface driver cdc_ncm
[   13.866415] usbcore: registered new interface driver huawei_cdc_ncm
[   13.910674] PPP generic driver version 2.4.2
[   13.917487] NET: Registered protocol family 24
[   13.924899] usbcore: registered new interface driver qmi_wwan
[   13.933400] usbcore: registered new interface driver rndis_host
[   13.969488] usbcore: registered new interface driver option
[   13.975193] usbserial: USB Serial support registered for GSM modem (1-port)

but still no ttyUSB devices under /dev.
Unplugging and replugging the USB modem made the USB connection kick in:

[  116.549832] usb 1-1: new high-speed USB device number 2 using ehci-platform
[  116.711862] usb-storage 1-1:1.0: USB Mass Storage device detected
[  116.726678] scsi host0: usb-storage 1-1:1.0
[  117.026956] usb 1-1: USB disconnect, device number 2
[  117.429837] usb 1-1: new high-speed USB device number 3 using ehci-platform
[  117.583731] option 1-1:1.0: GSM modem (1-port) converter detected
[  117.590170] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[  117.597524] option 1-1:1.1: GSM modem (1-port) converter detected
[  117.603934] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[  117.681269] huawei_cdc_ncm 1-1:1.2: MAC-Address: 0c:5b:8f:27:9a:64
[  117.687453] huawei_cdc_ncm 1-1:1.2: setting rx_max = 16384
[  117.737656] huawei_cdc_ncm 1-1:1.2: setting tx_max = 16384
[  117.745073] huawei_cdc_ncm 1-1:1.2: NDP will be placed at end of frame for this device.
[  117.753410] huawei_cdc_ncm 1-1:1.2: cdc-wdm0: USB WDM device
[  117.760090] huawei_cdc_ncm 1-1:1.2 wwan0: register 'huawei_cdc_ncm' at usb-ehci-platform-1, Huawei CDC NCM device, 0c:5b:8f:27:9a:64
[  117.772326] usb-storage 1-1:1.3: USB Mass Storage device detected
[  117.859656] scsi host1: usb-storage 1-1:1.3
[  117.864624] usb-storage 1-1:1.4: USB Mass Storage device detected
[  117.893348] scsi host2: usb-storage 1-1:1.4
[  118.873588] scsi 1:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[  118.921003] scsi 2:0:0:0: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
[  118.935094] sd 2:0:0:0: [sda] Attached SCSI removable disk

and ttyUSB devices are back under /dev.
Why did the disconnected state persist over the reboot?
(On the next reboot it connected up fine.)

Don't connect your modem directly to the router, use a short extension cable.
Make sure your power supply is powerful enough, try to use Y-cable to power your modem or use a powered USB hub.
Get rid of the storage function with AT^SETPORT="FF;10,12,16"

I'm already using an extension cable and I am considering getting a powered hub to get rid of the disconnection problem altogether. But both these actions are targeted at the spontaneous disconnects right?

But my question here is why the USB connection did not activate at boot but only after reboot/unplug/replug?

Extension cable should be short and thick. E3276 is known to be power hungry, so all the stability issues are expected. If you do not have LTE coverage in your area you can also set your modem to 3G only.
As always, I recommend using this OpenWrt-based firmware instead of a standard OpenWrt for its great modem support.

Thanks for all the tips about LTE and 3G. I'll save followups for another thread.

My question here is really about if there is something wrong with the USB subsystem? Why isn't the modem USB stick being detected/activated at boot this time but only until manual unplug/replug?

Or are you saying that this is not an error by the USB subsystem, but one of the stability issues of this particular USB device?

This is what I suspect by default.

Most likely the internal CPU in the modem has crashed, and it stays crashed through rebooting the router. Re-plugging the modem of course reboots its CPU.

As @AndrewZ said it probably results from insufficient DC power.

Ah thanks for these insights. At some earlier "problem times" I can remember getting successful reboots after power cycling the router, which of course also would reboot the modem CPU.

I'll get that powered USB hub in place and keep watching if the disconnection problem is now gone.
Thanks again! :slight_smile:

The problems continued with the hub but I move that discussion to a new thread here:

Maybe a USB reset helps to get out of this situation?

Described there.
https://dev.openwrt.org/ticket/18116#comment:6

Very interesting. The problem happens quite infrequently but I will for sure try the

echo "1" > /sys/bus/usb/devices/usb1/bConfigurationValue
echo "1" > /sys/bus/usb/devices/usb2/bConfigurationValue

reset commands next time it happens!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.