PINE64
Howto - automatically recover your modem and mobile data after deep sleep - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+---- Forum: Mobian on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=139)
+---- Thread: Howto - automatically recover your modem and mobile data after deep sleep (/showthread.php?tid=12279)

Pages: 1 2 3


RE: Howto - automatically recover your modem and mobile data after deep sleep - arno_nuehm - 12-07-2020

(11-23-2020, 03:25 AM)as400 Wrote: As many of you know, there are problems with Mobile Data connection and modem waking up in a different state after deep sleep.
So I have come up with a solution that is automatic and does not require rebooting the phone.

Find it here --> https://gitlab.com/as400l/pp-modem-guard

Yes, I know it's nasty but the modem behaviour is so painfully unpredictable.


Have you tried the following?

Restart modem with

Code:
mmcli -m any --command='AT+CFUN=1,1'

and activate mobile data with

Code:
nmcli c up Internet

with "Internet" replaced by the name of your mobile data connection name.

Source:
https://gitlab.com/mobian1/issues/-/issues/134#note_438830780

It works quite fine in a script and a sleep of 30 seconds between the two commands.


RE: Howto - automatically recover your modem and mobile data after deep sleep - as400 - 12-08-2020

@arno_nuehm - yes I tried. It takes too long for me.

Currently I'm testing my script with one loop removed on latest Mobian and it's much faster.


RE: Howto - automatically recover your modem and mobile data after deep sleep - arno_nuehm - 12-09-2020

(12-08-2020, 12:46 AM)as400 Wrote: @arno_nuehm - yes I tried. It takes too long for me.

Currently I'm testing my script with one loop removed on latest Mobian and it's much faster.

Sounds promising! Let me know, if the tests work fine and I'll give it a try with the new fde-image.


RE: Howto - automatically recover your modem and mobile data after deep sleep - a-wai - 12-09-2020

(12-08-2020, 12:46 AM)as400 Wrote: @arno_nuehm - yes I tried. It takes too long for me.

Currently I'm testing my script with one loop removed on latest Mobian and it's much faster.

I'm currently working on something remotely inspired by your script, how long does it take from wakeup to mobile data being active again? (when the modem fails to resume, of course)


RE: Howto - automatically recover your modem and mobile data after deep sleep - as400 - 12-10-2020

@a-wai - with this last version I'm testing it's really fast - up to 4-7 seconds from screen unlock. That's if the modem fails "normally" Smile

The modem behaves a bit better with newest Network Manager that was pushed to the repos like two weeks or so ago. And it should behave even better with the Modem Manager 1.14.8 that has some patches from @DylanVanAssche. But it's not generally available since it's not in the repos yet.

I will push these minor changes I've done to the script in a few minutes.


RE: Howto - automatically recover your modem and mobile data after deep sleep - Zebulon Walton - 12-13-2020

Although I haven't run into the modem problem yet because I haven't used the phone enough for it to be an issue, mguard seems like a good thing so I went ahead and installed it.

I ran "apt-get update && apt-get dist-upgrade" to get all the latest Mobian updates, rebooted, and used the mguard_service_v2.sh file.  A change I made was to put the script into /usr/local/bin instead of /usr/bin, and modify the service file accordingly. Haven't tested it yet aside to see that mguard is running when the phone boots up. A couple of questions...

Is the internet connection name (CON_NAME variable) the same as the APN setting? Also, "ps ax | grep mguard" shows two copies of the script running. Is that the way it is supposed to be working?


RE: Howto - automatically recover your modem and mobile data after deep sleep - as400 - 12-14-2020

@Zebulon Walton - the answer to both of your questions is yes.


RE: Howto - automatically recover your modem and mobile data after deep sleep - as400 - 12-15-2020

@a-wai has created new package that does the modem recovery and enhances modem power management. So it does not make sense to use "modem guard" anymore. Also it would be good to test this new solution. For me it works flawlessly for the last 24 hours.

So, to use this new package - enter following commands in terminal:

1. sudo systemctl disable mguard
2. sudo apt update
3. sudo apt upgrade
4. sudo apt install eg25-manager
5. sudo reboot


First step is necessary only if you have modem guard from this thread configured.


RE: Howto - automatically recover your modem and mobile data after deep sleep - a-wai - 12-15-2020

Step 4 isn't needed anymore, actually Wink


RE: Howto - automatically recover your modem and mobile data after deep sleep - kqlnut - 12-15-2020

(12-15-2020, 12:57 AM)as400 Wrote: @a-wai has created new package that does the modem recovery and enhances modem power management. So it does not make sense to use "modem guard" anymore. Also it would be good to test this new solution. For me it works flawlessly for the last 24 hours.
This seems really cool, thank you for that! @a-wai would you mind explaining roughly how this helps with modem recovery and what effects it has on power savings (I'm not very good at reading the source code and don't know much about the AT commands)? And how dependent is this on the specific kernel? Is it possible to compile and use it on another kernel, e. g. megi's kernel on Manjaro?