Howto - automatically recover your modem and mobile data after deep sleep
#11
(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/-/issu..._438830780

It works quite fine in a script and a sleep of 30 seconds between the two commands.
  Reply
#12
@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.
  Reply
#13
(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.
  Reply
#14
(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)
  Reply
#15
@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.
  Reply
#16
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?
  Reply
#17
@Zebulon Walton - the answer to both of your questions is yes.
  Reply
#18
@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.
  Reply
#19
Step 4 isn't needed anymore, actually Wink
  Reply
#20
(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?
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pinephone seems tobe using 4G data instead of Wifi data grump_fiddle_reinstall 1 789 06-25-2024, 10:38 AM
Last Post: mikehenson
  Mobile internet via cellular network mostly not working Anna 18 13,565 01-19-2024, 02:59 AM
Last Post: anonymous
  MODEM - Usb problem & couldn't query SIM slots: QMI protocol freelectro 5 4,361 06-06-2023, 06:36 AM
Last Post: freelectro
  4G data on default startup / boot dcinoz 1 1,189 04-29-2023, 11:24 PM
Last Post: dcinoz
  ModemManager debug mode? (Needed to flash modem) calinb 1 1,635 02-27-2023, 04:18 PM
Last Post: calinb
  Block firefix-esr-mobile-config from (re)installing itself grump_fiddle_reinstall 3 2,222 01-07-2023, 09:36 AM
Last Post: dcarvil
Exclamation No modems were found: No mobile data, no 2G anonymous 2 1,963 12-26-2022, 06:46 PM
Last Post: anonymous
  very slow processing of MMS received via Ting (T-Mobile) treebeard 6 3,666 12-01-2022, 09:18 AM
Last Post: traut
  DNS Problems with Mobile Data arno_nuehm 29 21,053 10-29-2022, 09:16 AM
Last Post: treebeard
  Modem Firmware Upgrade - Modem Busy - USB Issues biketool 10 6,344 09-23-2022, 05:15 AM
Last Post: biketool

Forum Jump:


Users browsing this thread: 2 Guest(s)