Modem gets disabled on every suspend
#3
Unfortunately, this is a well-known issue that has not been fixed yet. To mitigate this, I run the following shell script as a systemd service with root privileges:

Code:
#! /bin/sh

is_modem_available()
{
        if [ -z "$(lsusb | grep "2c7c:0125")" ]; then
                return 1
        fi

        return 0
}

is_data_available()
{
        if ! nmcli c show --active | grep -e internet -e gsm > /dev/null; then
                return 1
        fi

        return 0
}

TRY=0
while :; do
        if ! is_modem_available ; then
                TRY=$((TRY + 1))
                echo $(date) Restarting modem, $TRY try
                systemctl restart eg25-manager
                systemd-inhibit --what=sleep --why="Modem reset" sleep 60
        elif [ $TRY -ne 0 ]; then
                echo $(date): Modem restarted successfully
                TRY=0
        elif ! is_data_available; then
                echo $(date): Restarting mobile data
                systemd-inhibit --what=sleep --why="Restart mobile data" sleep 5
                nmcli c up internet
        fi

        sleep 5
done

This will restart the eg25-manager service if the modem disappears, as well as restarting mobile data connection if it drops. The latter issue seems to occur often during calls (at least, on my OG PP).

Remember to replace "internet" with whatever name is used by your APN.

I hope you find this useful!
  Reply


Messages In This Thread
Modem gets disabled on every suspend - by jojuma - 03-12-2023, 12:57 PM
RE: Modem gets disabled on every suspend - by xavi92 - 03-12-2023, 06:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Modem white list aular 7 924 02-13-2024, 04:35 PM
Last Post: aular
  qcell modem id aular 6 868 01-15-2024, 10:05 PM
Last Post: aular
  Temporary fix for Modem Not Coming Back on in SXMO Postmarketos Pinephone kebab 2 2,109 07-16-2023, 11:14 AM
Last Post: kebab
  Modem audio settings jack1 2 1,318 02-04-2023, 04:01 PM
Last Post: jack1
  Phone won't suspend, battery drains quickly nelstomlinson 12 7,265 04-05-2022, 06:11 AM
Last Post: Anna
  The modem switch affects the connection to battery? JohnDoe 2 2,056 03-30-2022, 12:02 AM
Last Post: JohnDoe
  Modem disabled, can't enable: Invalid transition pac 4 3,554 03-23-2022, 01:08 PM
Last Post: Firewave
Question Modem problems with the distros I tried UltraBlack_ 9 5,335 02-21-2022, 01:57 PM
Last Post: KNERD
Big Grin troubleshooting Chatty / modem? no SMS outbound vap0rtranz 5 3,665 02-14-2022, 12:15 PM
Last Post: vap0rtranz
  PinePhone Beta 3GB modem not working hannescam 15 9,121 01-19-2022, 02:08 AM
Last Post: bcnaz

Forum Jump:


Users browsing this thread: 1 Guest(s)