Gl-mifi ec-25 starts using ttyUSB4 after losing signal


I’ve read a post here on getting the gl-mifi modem to recover after bad signal. However the post is a little old now and don’t describe exactly my situation, and it doesn’t resolve my issue.

I am running LEDE firmware version 2.271.

My device is gl-mifi with ec-25 modem.

When I boot up my device, the modem uses ttyUSB0, ttyUSB1, ttyUSB2 and ttyUSB3. These is the desired state. There are several scripts etc that depend on the ttyUSB3 allocation in particular.

After the device experiences a loss of 3G/4G signal I guess some script (from gl-inet?) attempts to recover the modem with a reset or something? Firstly, could somebody tell me where this script lives please?

After a while of intermittent signal loss, something causes the modem to start using ttyUSB4 instead of ttyUSB3. Unfortunately my dmesg log has wrapped around, but I can try to reproduce later and get the exact sequence when this happened. But in essence it is “GSM modem (1-port) converter now disconnected from ttyUSB3” then “GSM modem (1-port) converter now attached to ttyUSB4”. So this will have happened following a modem reset triggered by the ‘modem reset script’ I’m guessing.

I have tried

echo 1 > /sys/class/leds/gl-mifi:3gcontrol/brightness
sleep 1
echo 0 > /sys/class/leds/gl-mifi:3gcontrol/brightness

But while this causes the USB connection to be torn down and re-connected, it always comes back again with ttyUSB4.

I also tried echo “usb1”> /sys/bus/usb/drivers/usb/unbind as a last resort, but this didn’t help and it also screwed up the other USB connections on bus1 (lsusb below):

Bus 001 Device 017: ID 2c7c:0125
Bus 001 Device 010: ID 05e3:0752 Genesys Logic, Inc.
Bus 001 Device 009: ID 05e3:0618 Genesys Logic, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So it seems like the kernel thinks that /dev/ttyUSB3 isn’t available for some reason. Perhaps something died in a bad way after one of the previous modem resets. Does anyone have any tips for troubleshooting this at kernel level? Is there any way to remedy this without completely rebooting the device? Or to stop it happening at all in the first place?

Many thanks,


Does this happen very often? When you power off then power on again, does the problem go away?

The modem does has ttyUSB4 but it depends on the driver. As ttyUSB4 is of no use we didn’t add this. Not sure if this is your case.

Is it still usable when it changes to ttyUSB4?


Thanks for reply.

When I reboot, it uses ttyUSB3 again.

It’s usable on ttyUSB4 if I change my scripts and /etc/ppp/options to point to ttyUSB4.

The problem is not that device using the 5th interface of the modem (i.e. what would be attached after ttyUSB0-3) but instead that kernel is attaching the 4th interface (the ‘main’ modem interface I think) to ttyUSB4, and ttyUSB3 is attached to nothing.

My theory is that when kernel tries to attach to ttyUSB3 for some reason it is not available, so it uses ttyUSB4.

Anyway, I think I might have a solution which I will try today, and that is to create init and hotplug scripts that check the product ID , vendor id etc and create symlink to whatever ttyUSB[n] that has been attached to to a more friendly name (e.g. /dev/modem ) and then I can link /etc/ppp/options and my other scripts to the friendly name.

It will be quite similar to this solution.

I’ll let you know if it works.

Just reporting back, incase this is useful to anyone.

Setting up symlinks in a hotplug script solved the issue for me. I also had to set up symlinks on boot so that I would have a known location to point things like network config and ppp config to.

My hotplug script looks like this:


# This is a hotplug script which belongs in /etc/hotplug.d/usb/
# It creates symlinks to modem ports in /dev so we have a static name to link to incase ttyUSB[n] changes.

# Vars
int=$(cat /sys$DEVPATH/bInterfaceNumber)
tty_name=$(ls /sys/$DEVPATH | grep tty)

# On add device
if [ "$ACTION" = "add" ] && [ "$PRODUCT" = "$q_product" ];then
  # Create symlimk
  if [ "$int" == "00" ] || [ "$int" == "01" ] || [ "$int" == "02" ] || [ "$int" == "03" ];then
    logger "Creating symlink for modem interface $int to $dev_symlink$int. Actual name is $tty_name"
    # Remove old symlink first if there is one (-h is file test for symlink)
    if [ -h "$dev_symlink$int" ];then
      rm "$dev_symlink$int"
    ln -s "/dev/$tty_name" "$dev_symlink$int"
    # Restart network after last port setup
    if [ "$int" == "03" ];then
       /etc/init.d/network restart