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
  Reboot Modem on Pinephone in Mobian eggmatters 5 437 7 hours ago
Last Post: eggmatters
  mobile data on mobian not working synaption 1 156 06-02-2021, 03:16 PM
Last Post: Aberts10
  How to access GPS data in Mobian ragreenburg 3 563 05-09-2021, 08:23 PM
Last Post: 8bit
  Pinephone not receiving SMS. SMS not showing on modem either. norbear 4 1,017 03-27-2021, 11:43 AM
Last Post: norbear
  Issues with Mobian 20210314 (data and updates) IMSAI8080 5 1,570 03-20-2021, 04:14 AM
Last Post: IMSAI8080
  Deep sleep shutdown the phone bitsandnumbers 7 1,041 03-09-2021, 07:01 AM
Last Post: yanikd
  lightdm-mobile-greeter mobian dawg161 0 408 03-08-2021, 08:59 PM
Last Post: dawg161
  Sylpheed, Nextcloud Screensize not for Mobile Franze_m 6 658 02-25-2021, 09:55 AM
Last Post: C0ffeeFreak
  eg25manager always turns on GPS when waking up from sleep dcinoz 5 717 02-21-2021, 05:06 PM
Last Post: dcinoz
  No modem after dist-upgrade KJ6OHG 2 530 02-09-2021, 04:29 AM
Last Post: sfb

Forum Jump:


Users browsing this thread: 1 Guest(s)