Reboot Modem on Pinephone in Mobian
#1
I've had my Pinephone for some weeks now, and I'm trying to solve one important nagging issue. 

The Broadband modem will just die and not come back up. I'm suspecting that it may be a weak or absent carrier signal but, I have very little to go on.

I'm not finding any  mmcli commands that would allow me to reboot the modem. 

When this happens, it's as if the device is gone, or has been completely unmounted and mmcli fails as there is no device and my only recourse is to reboot the system.

What would be the best approach to:
  • Discover and remount the device if necessary
  • Cycle the modem on if not active
I would like to script this either on a cron, or some subscribable event or signal. That may be tough as it seems like the modem goes down when Mobian suspends. Any help / advice would be much appreciated! 

Here is the modem when it is actually healthy

Code:
  -----------------------------------
  General  |               dbus path: /org/freedesktop/ModemManager1/Modem/2
           |               device id: 1234567
  -----------------------------------
  Hardware |            manufacturer: QUALCOMM INCORPORATED
           |                   model: QUECTEL Mobile Broadband Module
           |       firmware revision: EG25GGBR07A08M2G
           |          carrier config: Commercial-TMO_VoLTE
           | carrier config revision: xxxxxxx
           |            h/w revision: 10000
           |               supported: gsm-umts, lte
           |                 current: gsm-umts, lte
           |            equipment id: 867698047214237

The index seems to increase when waking up from suspend (Modem/0 -> [font=Monaco, Consolas, Courier, monospace]Modem/1 -> [font=Monaco, Consolas, Courier, monospace]Modem/2)[/font][/font]

[font=Monaco, Consolas, Courier, monospace][font=Monaco, Consolas, Courier, monospace]Thank your for looking into this, my first Pine64 post![/font][/font]
  Reply
#2
There's probably a better way, but you can monitor if /dev/ttyUSB0..3 exists. Those 4 serial ports disappear when the modem disconnects. Then restarting eg25-manager will bring the modem back up. It takes 30+ seconds to boot up before the serial ports will return. You can see what is happening in dmesg.

This is a simple bash script that I used. It has to run as root. It is an endless loop. You could take out the loop and the delays and run it with cron, as root. Or run it as a service.

Code:
#!/bin/bash
FILE=/dev/ttyUSB2

while :
do
if test -c "$FILE"; then
  sleep 5
else
  systemctl restart eg25-manager
  sleep 60
fi
done
  Reply
#3
(06-04-2021, 11:03 AM)8bit Wrote: There's probably a better way, but you can monitor if /dev/ttyUSB0..3 exists. Those 4 serial ports disappear when the modem disconnects. Then restarting eg25-manager will bring the modem back up. It takes 30+ seconds to boot up before the serial ports will return. You can see what is happening in dmesg.

This is a simple bash script that I used. It has to run as root. It is an endless loop. You could take out the loop and the delays and run it with cron, as root. Or run it as a service.

Code:
#!/bin/bash
FILE=/dev/ttyUSB2

while :
do
if test -c "$FILE"; then
  sleep 5
else
  systemctl restart eg25-manager
  sleep 60
fi
done

This looks promising. Thanks for the script! I'll give it a whirl and let you know how it turns out.
  Reply
#4
(06-04-2021, 11:03 AM)8bit Wrote: There's probably a better way, but you can monitor if /dev/ttyUSB0..3 exists. Those 4 serial ports disappear when the modem disconnects. Then restarting eg25-manager will bring the modem back up. It takes 30+ seconds to boot up before the serial ports will return. You can see what is happening in dmesg.

This is a simple bash script that I used. It has to run as root. It is an endless loop. You could take out the loop and the delays and run it with cron, as root. Or run it as a service.

Code:
#!/bin/bash
FILE=/dev/ttyUSB2

while :
do
if test -c "$FILE"; then
  sleep 5
else
  systemctl restart eg25-manager
  sleep 60
fi
done


I am having problems with the modem as well. Based on your suggestion I created the following script `/home/mobian/bin/test-and-connect-modem.sh`
that restarts the serial port if the devices are not present.

Code:
#!/bin/bash
FILE=/dev/ttyUSB2

if ! test -c "$FILE"; then
  systemctl restart eg25-manager
fi


Then in order to check this regularly I suggest using `cron` jobs as root:
Code:
sudo crontab -e

and set the following rule that executes every minute
Code:
* * * * * /home/mobian/bin/test-and-connect-modem.sh
  Reply
#5
Hello,

For your information, look at the thread "pinephone drops cellular network" in the 'Hardware' part : https://forum.pine64.org/showthread.php?tid=13885 .
  Reply
#6
The systemctl restart eg25-manager restart works like a charm. There was an update where it did seem to stabilize but, I still have to rely on this script. Works great. Meant to go and look at Gribouille's suggestion but my entire phone just bricked.

Mobian won't boot from flash, Manjaro boots but KDE locks the screen after 3 seconds and won't respond to user touch when unlocked. Good times.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mobian pinephone -- "Stalled" (best way to describe it) fred_mobian 1 31 5 hours ago
Last Post: Zebulon Walton
  Cell modem mmd604 8 241 09-21-2021, 12:15 PM
Last Post: bcnaz
  Why do you use mobian? unrealb2 17 765 09-18-2021, 03:44 AM
Last Post: TRS-80
  Axolotl on PinePhone / Mobian arno_nuehm 116 33,241 09-17-2021, 02:36 AM
Last Post: arno_nuehm
  Mobian September 13 Nightly bcnaz 1 204 09-14-2021, 03:50 PM
Last Post: bcnaz
  Updating old Mobian installation? SocialNetworkingWasAMistake 1 122 09-14-2021, 03:41 PM
Last Post: bcnaz
  Installing Mobian --> "Resizing file system" forever Anna 13 2,890 09-09-2021, 04:26 AM
Last Post: spaetz
  I'd like to have a Discord client on Mobian lsitongia 2 182 09-03-2021, 06:56 PM
Last Post: ryo
  Mobian September 01, 2021 bcnaz 2 331 09-01-2021, 11:45 AM
Last Post: bcnaz
  Mobian 'HotSpot" bcnaz 2 394 08-29-2021, 07:34 AM
Last Post: bcnaz

Forum Jump:


Users browsing this thread: 1 Guest(s)