PINE64
eg25manager always turns on GPS when waking up from 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: eg25manager always turns on GPS when waking up from sleep (/showthread.php?tid=13145)



eg25manager always turns on GPS when waking up from sleep - dcinoz - 02-16-2021

Hi,

I've just realised eg25manager always turns GPS on using the command:

AT+QGPS=1

when resuming from sleep.

You can check via:

Code:
mmcli -m any --command="AT+QGPS?"

1 is on, 0 off.

To turn off use the command:

Code:
mmcli -m any --command="AT+QGPSEND"

I've spotted this bug report:
https://gitlab.com/mobian1/devices/eg25-manager/-/issues/2

I don't understand the "GPS management is now disabled by default with 79974bc9 and can be activated with the -g command line option.
Leaving this issue open as it's just a workaround, I'll have to come up with a better solution later on."

That would suggest GPS should be OFF, no?

I tried to use systemd system-sleep by adding a shell script to send the OFF command to the modem but eg25manager always runs after system-sleep. Adding sleep 5 or 10 or 20 seconds just delays eg25manager running so modem is not found and the OFF command fails. eg25manager would turn it on anyway.

Note that Privacy -> Location Services is switched OFF. I assumed that meant the GPS was OFF too....
It doesn't help battery life, has this just changed explaining the larger battery drain noticed recently? Or is that something else?

How can I prevent eg25manager from sending the GPS ON command (other than running a script manually every time I wake up the Pinephone)?

Command to see eg25manager log from systemd:
Code:
sudo journalctl -b | grep eg25

Just did a few IMS tests.

Reboot phone, IMS is on, check via command:
Code:
mmcli -m any --command='AT+QCFG="IMS"'

If you disable it via:
Code:
mmcli -m any --command='AT+QCFG="IMS",0'
then the setting is kept when the phone wakes from sleep.

No idea why eg25manager would enable IMS by default. Guess phone still works with a non-IMS enable operator (no VoLTE).

Here is systemd log from boot showing the IMS on part:

Feb 17 16:34:56 mobian eg25manager[362]: Response: [+QCFG: "ims",0,0
Feb 17 16:34:56 mobian eg25manager[362]: Got a different result than expected, changing value...
Feb 17 16:34:56 mobian eg25manager[362]: (null)
Feb 17 16:34:56 mobian eg25manager[362]: Sending command: AT+QCFG="ims",1
Feb 17 16:34:56 mobian eg25manager[362]: Response: [OK]

Further look at eg25manager logs, at least the GPS is turned OFF when it suspends:

eg25manager[362]: system is about to suspend
eg25manager[362]: Sending command: AT+QGPSEND
eg25manager[362]: Response: [OK]


RE: eg25manager always turns on GPS when waking up from sleep - fdlamotte - 02-17-2021

it's all in at.c ...

I had the same problem because my phone works better with ims set to 0. I just recompiled my own eg25-manager with my own settings ...

It seems that lately voice is more reliable with ims set to 1 than before. Maybe because of the latest gnome-calls or the updates in callaudio ... I just received a new pp and am testing ims=1 on it, so far it hasn't failed


RE: eg25manager always turns on GPS when waking up from sleep - dcinoz - 02-17-2021

@fdlamotte

Yes, sure, recompile, but surely both IMS and GPS should be left alone, i.e. leave the modem as is? No doubt you agree, too.
And why should IMS be enabled by eg25manager? There should be a toggle in phosh. How many operators have VoLTE enabled?

Presumably you want GPS to stay on while you move around / have it on, even after the phone goes to sleep, no? Otherwise you turn GPS off. Should be a toggle in phosh like the Android location services toggle - presume that turns GPS on / off?! As it is the GPS is switched off as soon as the phone sleeps....

I understand the Privacy Location Services is simply supposed to control whether or not apps have access to location data, not technically whether the GPS is on or off. Hence missing GPS on / off toggle.

Annoying systemd system-sleep runs *before* eg25manager daemon - any idea how to overcome that? Other than modifying the code and recompiling my local version?

Thinking about the GPS a bit more, I presume there is no point in it being on when the phone is asleep as there is no buffer in the modem? Does it just return the GPS fix when queried at a given time? Not sure.


RE: eg25manager always turns on GPS when waking up from sleep - fdlamotte - 02-17-2021

in my opinion current eg25manager is just a workaround.

It seems that sometimes, modem parameters are lost and so a-wai idea is to force a consistent set of parameters to overcome the problem (and I think it was also megi's take but done in the kernel).

There should be a global consensus to do that (store and restore parameters) in a convenient way. eg25manager should in no way be tied to phosh as there are other UIs around (and official pinephone ui will be based on kde), phosh should not be tied to eg25 since it is used with other modems Wink

From latest pine64 news, it seems there is a work in progress that should make the modem work reliably. Maybe they are waiting on that before going further (that's what I would do)

To force your settings "above" eg25manager, as you say, you need to run your script after ... don't know exactly how to do it, but I presume udev has some priority mecanism in the executions at wakeup, I would dig that way


RE: eg25manager always turns on GPS when waking up from sleep - dcinoz - 02-18-2021

(02-17-2021, 03:24 AM)fdlamotte Wrote: To force your settings "above" eg25manager, as you say, you need to run your script after ... don't know exactly how to do it, but I presume udev has some priority mecanism in the executions at wakeup, I would dig that way

I've created a systemd service to run a script after resume from suspend:

/usr/lib/systemd/system/afterresume.service:
Code:
[Unit]
Description=After resume from suspend
After=suspend.target

[Service]
Type=simple
ExecStart=/usr/bin/aftersuspend.sh
Restart=on-failure

[Install]
WantedBy=suspend.target

Not sure about the Restart. I tried using eg25-manager.service in After but that doesn't run it when eg25manager runs after coming out of suspend.

As a 'hack' the script aftersuspend.sh has a 10 s sleep to make sure it runs the commands after eg25manager has sent its command.

/usr/bin/aftersuspend.sh:
Code:
#!/bin/sh

logger "After suspend script"
sleep 10
# send GPS off command
logger "After EG25-manager service: sending AT+QGSPEND"
mmcli -m any --command="AT+QGPSEND"
# send IMS off command
logger 'After EG25-manager service: sending AT+QCFG="ims",0'
mmcli -m any --command='AT+QCFG="ims",0'

Not exactly elegant, wish there was a way to run it after coming out of suspend and after eg25manager is run.

Chech GPS using:
Code:
mmcli -m any --command="AT+QGPS?"

Check IMS / VoLTE using:
Code:
mmcli -m any --command='AT+QCFG="ims"'

Systemd logs using:
Code:
sudo journalctl --since "2 minutes ago"
sudo journalctl -b (since boot)

You also have:
Code:
systemctl daemon-reload
systemctl enable afterresume.service
not sure if you also need
Code:
systemctl start afterresume.service



RE: eg25manager always turns on GPS when waking up from sleep - dcinoz - 02-21-2021

Update: Excellent work from eg25-manager author, there is now a configuration file for eg25-manager that can be used for this, see:
https://gitlab.com/mobian1/issues/-/issues/254
https://gitlab.com/mobian1/devices/eg25-manager

I've used

{ cmd = "QGPSEND" }

to turn GPS off (end) and

{ cmd = "QCFG", subcmd = "ims", value = "0" }

to turn off IMS / VoLTE.

I renamed the toml files in /usr/share/eg25-manager
and copied the 1.2.toml file to /etc/eg25-manager (create the directory)
and edited it as required.

I did a
Code:
sudo service eg25-manager restart
to make sure new settings are read.