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
  Amberol Mobile Music player(flatpak) biketool 0 53 06-19-2022, 07:16 AM
Last Post: biketool
  DNS Problems with Mobile Data arno_nuehm 27 4,098 05-16-2022, 04:14 PM
Last Post: henrythemouse
  Cellular data is working! drh 0 154 05-15-2022, 09:02 AM
Last Post: drh
  Mobile internet via cellular network mostly not working Anna 17 2,250 02-28-2022, 02:51 PM
Last Post: TRS-80
  sharing mobile data through usb tethering deb75 7 996 02-26-2022, 08:52 AM
Last Post: Zebulon Walton
  Phosh modem on/off effectiveness? Zebulon Walton 0 319 01-24-2022, 09:21 AM
Last Post: Zebulon Walton
  Reskinning Apps for Mobile biketool 6 754 12-05-2021, 02:30 PM
Last Post: biketool
  Mobile network mode setting not saved Zebulon Walton 3 1,310 12-05-2021, 12:12 AM
Last Post: bcnaz
  Mobian and Deep Sleep Crust some_pinephone_user 1 817 11-14-2021, 07:05 AM
Last Post: some_pinephone_user
  Modem suddenly not enabled when booting from eMMC Zebulon Walton 3 1,074 10-23-2021, 01:55 PM
Last Post: Zebulon Walton

Forum Jump:


Users browsing this thread: 1 Guest(s)