From a046b539418958eeb2ee26ec5ef273835c98d0d2 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Thu, 15 Apr 2021 20:11:03 +0200 Subject: [PATCH 1/2] config: synchronize with modem-power We cannot assume default factory values if other drivers change them --- data/pine64,pinephone-1.0.toml | 13 +++++++++++-- data/pine64,pinephone-1.1.toml | 13 +++++++++++-- data/pine64,pinephone-1.2.toml | 12 ++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/data/pine64,pinephone-1.0.toml b/data/pine64,pinephone-1.0.toml index e1f5b24..6e21bda 100644 --- a/data/pine64,pinephone-1.0.toml +++ b/data/pine64,pinephone-1.0.toml @@ -39,12 +39,21 @@ configure = [ { cmd = "QCFG", subcmd = "risignaltype", expect = "\"physical\"" }, { cmd = "QCFG", subcmd = "ims", expect = "1" }, { cmd = "QCFG", subcmd = "urc/ri/ring", expect = "\"pulse\",2000,1000,5000,\"off\",1" }, - { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000" }, - { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1" }, + { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000,1" }, + { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1,1" }, { cmd = "QCFG", subcmd = "urc/delay", expect = "1" }, { cmd = "QURCCFG", subcmd = "urcport", expect = "\"all\"" }, { cmd = "QGPS", value = "1" }, { cmd = "QSCLK", value = "1" }, +# Reset modem-power configurations to what we expect + { cmd = "QCFG", subcmd = "urc/cache", expect = "0" }, + { cmd = "QCFG", subcmd = "fast/poweroff", expect = "1" }, + { cmd = "QCFG", subcmd = "apready", expect = "0,0,500" }, + { cmd = "QCFG", subcmd = "sleepind/level", expect = "0" }, + { cmd = "QCFG", subcmd = "wakeupin/level", expect = "0,0" }, + { cmd = "QCFG", subcmd = "ApRstLevel", expect = "0" }, + { cmd = "QCFG", subcmd = "ModemRstLevel", expect = "0" }, + { cmd = "QCFG", subcmd = "urc/ri/pin", expect = "uart_ri" }, ] suspend = [ { cmd = "QGPSEND" }, diff --git a/data/pine64,pinephone-1.1.toml b/data/pine64,pinephone-1.1.toml index e1f5b24..6e21bda 100644 --- a/data/pine64,pinephone-1.1.toml +++ b/data/pine64,pinephone-1.1.toml @@ -39,12 +39,21 @@ configure = [ { cmd = "QCFG", subcmd = "risignaltype", expect = "\"physical\"" }, { cmd = "QCFG", subcmd = "ims", expect = "1" }, { cmd = "QCFG", subcmd = "urc/ri/ring", expect = "\"pulse\",2000,1000,5000,\"off\",1" }, - { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000" }, - { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1" }, + { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000,1" }, + { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1,1" }, { cmd = "QCFG", subcmd = "urc/delay", expect = "1" }, { cmd = "QURCCFG", subcmd = "urcport", expect = "\"all\"" }, { cmd = "QGPS", value = "1" }, { cmd = "QSCLK", value = "1" }, +# Reset modem-power configurations to what we expect + { cmd = "QCFG", subcmd = "urc/cache", expect = "0" }, + { cmd = "QCFG", subcmd = "fast/poweroff", expect = "1" }, + { cmd = "QCFG", subcmd = "apready", expect = "0,0,500" }, + { cmd = "QCFG", subcmd = "sleepind/level", expect = "0" }, + { cmd = "QCFG", subcmd = "wakeupin/level", expect = "0,0" }, + { cmd = "QCFG", subcmd = "ApRstLevel", expect = "0" }, + { cmd = "QCFG", subcmd = "ModemRstLevel", expect = "0" }, + { cmd = "QCFG", subcmd = "urc/ri/pin", expect = "uart_ri" }, ] suspend = [ { cmd = "QGPSEND" }, diff --git a/data/pine64,pinephone-1.2.toml b/data/pine64,pinephone-1.2.toml index 4ca1274..598ebaf 100644 --- a/data/pine64,pinephone-1.2.toml +++ b/data/pine64,pinephone-1.2.toml @@ -36,9 +36,21 @@ configure = [ { cmd = "QCFG", subcmd = "risignaltype", expect = "\"physical\"" }, { cmd = "QCFG", subcmd = "ims", expect = "1" }, { cmd = "QCFG", subcmd = "apready", expect = "1,0,500" }, + { cmd = "QCFG", subcmd = "urc/ri/ring", expect = "\"pulse\",120,1000,5000,\"off\",1" }, + { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",120,1" }, + { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1,1" }, + { cmd = "QCFG", subcmd = "urc/delay", expect = "0" }, { cmd = "QURCCFG", subcmd = "urcport", expect = "\"all\"" }, { cmd = "QGPS", value = "1" }, { cmd = "QSCLK", value = "1" }, +# Reset modem-power configurations to what we expect + { cmd = "QCFG", subcmd = "urc/cache", expect = "0" }, + { cmd = "QCFG", subcmd = "fast/poweroff", expect = "1" }, + { cmd = "QCFG", subcmd = "sleepind/level", expect = "0" }, + { cmd = "QCFG", subcmd = "wakeupin/level", expect = "0,0" }, + { cmd = "QCFG", subcmd = "ApRstLevel", expect = "0" }, + { cmd = "QCFG", subcmd = "ModemRstLevel", expect = "0" }, + { cmd = "QCFG", subcmd = "urc/ri/pin", expect = "uart_ri" }, ] suspend = [ { cmd = "QGPSEND" }, -- GitLab From 0094dea49d8bc5a60c044da1e01417c29397c7b0 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Sat, 17 Apr 2021 15:50:07 +0200 Subject: [PATCH 2/2] at: fast/poweroff is only available in newer firmware versions Do not retry the AT command of the fast/poweroff setting as it may not be supported by the firmware --- src/at.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/at.c b/src/at.c index a34025f..4469d26 100644 --- a/src/at.c +++ b/src/at.c @@ -215,7 +215,11 @@ static gboolean modem_response(gint fd, suspend_inhibit(manager, TRUE, TRUE); manager->modem_state = EG25_STATE_STARTED; } - else if (strstr(response, "ERROR")) + /* + * QCFG="fast/poweroff" configuration is only available in + * newer firmware versions + */ + else if (strstr(response, "ERROR") && !strstr(response, "fast/poweroff")) retry_at_command(manager); else if (strstr(response, "OK")) process_at_result(manager, response); -- GitLab