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


Howto - automatically recover your modem and mobile data after deep sleep - as400 - 11-23-2020

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.


RE: Howto - automatically recover your modem and mobile data after deep sleep - Ph42oN - 11-23-2020

I have been using script that does "echo 0 > /sys/class/modem-power/modem-power/device/powered" to stop modem and then echo 1 to start it, just manually in case data stops working.

But having it restored to working state automatically is better, i will test and see how well your script works.

Edit: I have been testing this script on both mobian and arch, it does work so that makes it better but i have seen modem actually completely disappear, in that case running my script manually restores it to working state.


RE: Howto - automatically recover your modem and mobile data after deep sleep - Gribouille - 11-24-2020

Hello AS400,

Sorry for the question, but what is the "connection name" ? How to identify it ?

If I try : "nmcli", I found :

        cdc-wdm0: déconnecté
        "cdc-wdm0"
        gsm (qmi_wwan, option1), hw


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

Hello @Gribouille,

It's the name you define in Settings --> Mobile --> Access point names.
Usually something like internet.

If you don't trust settings app, try "nmcli" when the modem is connected to mobile data. It will tell you the name of the connection.
I suggest one word name.


RE: Howto - automatically recover your modem and mobile data after deep sleep - Lousy Fisherman - 11-24-2020

(11-23-2020, 03:25 AM)as400 Wrote: Yes, I know it's nasty but the modem behaviour is so painfully unpredictable.
Thank you very much. I was just starting to write a similar script to enable GPS on wakeup.

I don't know why you think it is nasty. It may not be optimal but there will be many ugly hacks required for systems integration on the Pinephone

Thanks once again.
LF


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

@Lousy Fisherman - well, maybe not exactly how it should look like Smile But as I said - this modem is absolutely unpredictable.

I just pushed a minor change to fix mobile data connection bring up problems.


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

(11-24-2020, 08:24 AM)as400 Wrote: Hello @Gribouille,

It's the name you define in Settings --> Mobile --> Access point names.
Usually something like internet.

If you don't trust settings app, try "nmcli" when the modem is connected to mobile data. It will tell you the name of the connection.
I suggest one word name.

Hello @as400,

In France, with Bouygues Telecom the 'Access point names' are detected. The following 'Access point names' proposed are :
  • Contrat Pro Data Illimité / a2bouygtel.com
  • B2Bouygtel / b2bouygtel.com
  • Forfait Data / ebouygtel.com
The last is the usual 'Acces point name', for Internet.

But for send or receive some SMS, I've added :
  • Bouygesmms / mmsbouygtel.com

As example, with 'Forfait Data ' with 'nmcli' :

Code:
cdc-wdm0: connecté à Forfait Data
    "cdc-wdm0"
    gsm (qmi_wwan, option1), hw, iface wwan0, mtu 1500
    ip6 par défaut

With my definition for MMS :

Code:
cdc-wdm0: connecté à Bouyguesmms
        "cdc-wdm0"
        gsm (qmi_wwan, option1), hw, iface wwan0, mtu 1500
        ip6 par défaut


So you have right to recommend only one word for define the 'Access point name', it's simpler to use in a script.


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

@Gribouille - I think I don't fully follow you. Is there some kind of problem ?


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

(12-04-2020, 06:28 AM)as400 Wrote: @Gribouille - I think I don't fully follow you. Is there some kind of problem ?

Dont't worry @as400, all is fine Smile

I've added the details for the Access Points, because is not clear with my phone provider.


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

Thank you for sharing this, its my favorite solution for downloading mms out of the ones I've seen.

If anyone has a problem downloading the files try adding the following the curl command in the donwload_messages function. This is definitely required for t-mobile and setting the dns-interface might be useful for other carriers.
Code:
-6 --dns-interface $INTERFACE


Also if the modem number keeps increasing due to crust you can use this line
Code:
MODEM_NUM=$(mmcli --list-modems | grep -oP "(?<=Modem/)[0-9]+")