Modem gets disabled on every suspend
#1
Hello,

I am running KDE (Manjaro + Plasma Mobile) on my Pinephone and I tried everything now to make the modem run properly.
Based on the information of Biktorgj (the-modem-distro) I updated to the newest firmware, I flashed the custom firmware and made the recommended settings. I flashed the recovery. No matter, which firmware is running, on boot and on every suspend (screen goes off after few minutes), the modem gets disabled as the status in 'mmcli -m any' shows. I have to enable it ('mmcli -m any -e') every time I take the pinephone in my hand.
Currently I have the custom firmware installed again and made the settings. The behaviour stays as described.

Is there any advice on this, anything I can try?
  Reply
#2
What does "nmcli radio wwan" say? It should say "enabled".

(Even if you do not actually want to use mobile data – the wwan flag enables/disables the entire modem. I am not sure it makes sense for NetworkManager to do that, but its developers say this is by design. Enabling/disabling only data can be done through the button in Plasma Mobile, which does not actually use that flag, at least not since this was fixed a year ago, see the closed issues https://invent.kde.org/plasma/plasma-mob...issues/133 and https://invent.kde.org/plasma/plasma-mob...issues/182.)

If it says "disabled", try "sudo nmcli radio wwan on".
  Reply
#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
#4
I am sorry for my late response, I had no time to reply earlier.


Quote:What does "nmcli radio wwan" say? It should say "enabled".
It says "disabled".



Quote:If it says "disabled", try "sudo nmcli radio wwan on".
This is supposed to start it, but only once, right? That's what I had before...



More promising looks this:

Quote: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:

Will this script allow to use flight mode? If it doesn't, could there be a "isFlightmodeActive" function or something similar be added?
Or do I have to turn the phone off if I indeed need the modem to be disabled?
  Reply
#5
(03-16-2023, 04:01 AM)jojuma Wrote:
Quote:If it says "disabled", try "sudo nmcli radio wwan on".
This is supposed to start it, but only once, right? That's what I had before...
Well, no, NetworkManager should remember it. What you had before was enabling ModemManager directly through mmcli, bypassing NetworkManager. So NetworkManager still thinks it should be disabled and disables it on startup or resume.

My guess is that you had disabled mobile data with a Plasma Mobile from between December 2021 and March 2022 (keep in mind that preinstalled images on newly shipped phones can be several months out of date), where the mobile data toggle would set the wwan flag in NetworkManager to disabled, disabling the entire modem. Then upgrading to a fixed Plasma Mobile left you with the flag still set incorrectly in NetworkManager, without a UI toggle to fix it. So try my nmcli command.

There may be other ways to end up in this state though. What matters is how to get out of it.
  Reply
#6
And again I apologize for answering that late...


Quote:What does "nmcli radio wwan" say? It should say "enabled".

(Even if you do not actually want to use mobile data – the wwan flag enables/disables the entire modem. I am not sure it makes sense for NetworkManager to do that, but its developers say this is by design. Enabling/disabling only data can be done through the button in Plasma Mobile, which does not actually use that flag, at least not since this was fixed a year ago, see the closed issues https://invent.kde.org/plasma/plasma-mob...issues/133 and https://invent.kde.org/plasma/plasma-mob...issues/182.)

If it says "disabled", try "sudo nmcli radio wwan on".


I enabled "radio wwan" and after some days of testing, it seems like this did the trick.

THANK YOU SO MUCH FOR THAT!

I don't know, how that got disabled or if it has been disabled. I flashed a whole new image in january, so I guess that image should've been current enough to have this flag enabled. But as you said, it matters how to get out of this and it seems I finally did.

I'll mark this as gratefully as solved!
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't complete update of manjaro: wwan0 stays disabled; no phone/text gilford 3 231 12-05-2024, 06:42 AM
Last Post: gilford
  Modem white list aular 7 2,418 02-13-2024, 04:35 PM
Last Post: aular
  qcell modem id aular 6 2,332 01-15-2024, 10:05 PM
Last Post: aular
  Temporary fix for Modem Not Coming Back on in SXMO Postmarketos Pinephone kebab 2 2,790 07-16-2023, 11:14 AM
Last Post: kebab
  Modem audio settings jack1 2 1,859 02-04-2023, 04:01 PM
Last Post: jack1
  Phone won't suspend, battery drains quickly nelstomlinson 12 9,383 04-05-2022, 06:11 AM
Last Post: Anna
  The modem switch affects the connection to battery? JohnDoe 2 2,646 03-30-2022, 12:02 AM
Last Post: JohnDoe
  Modem disabled, can't enable: Invalid transition pac 4 4,642 03-23-2022, 01:08 PM
Last Post: Firewave
Question Modem problems with the distros I tried UltraBlack_ 9 6,776 02-21-2022, 01:57 PM
Last Post: KNERD
Big Grin troubleshooting Chatty / modem? no SMS outbound vap0rtranz 5 4,834 02-14-2022, 12:15 PM
Last Post: vap0rtranz

Forum Jump:


Users browsing this thread: 1 Guest(s)