Fix
This commit is contained in:
		@@ -30,15 +30,20 @@ DEPEND="
 | 
			
		||||
RDEPEND="${DEPEND}"
 | 
			
		||||
 | 
			
		||||
PATCHES=(
 | 
			
		||||
		${FILESDIR}/18.patch
 | 
			
		||||
		${FILESDIR}/15.patch
 | 
			
		||||
	#	${FILESDIR}/11.patch
 | 
			
		||||
	#	${FILESDIR}/12.patch
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
src_install() {
 | 
			
		||||
	meson_src_install
 | 
			
		||||
	systemd_dounit "${FILESDIR}"/eg25-manager.service
 | 
			
		||||
	insinto /etc/eg25-manager
 | 
			
		||||
	newins "${FILESDIR}"/eg25-pinephone-1.0.toml pine64,pinephone-1.0.toml
 | 
			
		||||
	newins "${FILESDIR}"/eg25-pinephone-1.1.toml pine64,pinephone-1.1.toml
 | 
			
		||||
	newins "${FILESDIR}"/eg25-pinephone-1.2.toml pine64,pinephone-1.2.toml
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pkg_postinst() {
 | 
			
		||||
	systemd_reenable --all eg25-manager
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,28 +0,0 @@
 | 
			
		||||
From 705950bb399781a291a3998014f916fc1effce16 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Bhushan Shah <bhush94@gmail.com>
 | 
			
		||||
Date: Thu, 15 Apr 2021 09:29:36 +0530
 | 
			
		||||
Subject: [PATCH] mm-iface: clean out modem_iface if mm disappears
 | 
			
		||||
 | 
			
		||||
otherwise we will be stuck in state where restarting of mm will not
 | 
			
		||||
reset the modem_iface and it will loop through hard resetting modem
 | 
			
		||||
---
 | 
			
		||||
 src/mm-iface.c | 3 +++
 | 
			
		||||
 1 file changed, 3 insertions(+)
 | 
			
		||||
 | 
			
		||||
diff --git a/src/mm-iface.c b/src/mm-iface.c
 | 
			
		||||
index d6a74f8..0409236 100644
 | 
			
		||||
--- a/src/mm-iface.c
 | 
			
		||||
+++ b/src/mm-iface.c
 | 
			
		||||
@@ -183,6 +183,9 @@ static void mm_iface_clean(struct EG25Manager *manager)
 | 
			
		||||
         g_free(manager->modem_usb_id);
 | 
			
		||||
         manager->modem_usb_id = NULL;
 | 
			
		||||
     }
 | 
			
		||||
+    if (manager->modem_iface == MODEM_IFACE_MODEMMANAGER) {
 | 
			
		||||
+        manager->modem_iface = MODEM_IFACE_NONE;
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static void mm_vanished_cb(GDBusConnection    *connection,
 | 
			
		||||
-- 
 | 
			
		||||
GitLab
 | 
			
		||||
 | 
			
		||||
@@ -1,101 +0,0 @@
 | 
			
		||||
diff --git a/data/pine64,pinephone-1.0.toml b/data/pine64,pinephone-1.0.toml
 | 
			
		||||
index e127f1a..5269fc2 100644
 | 
			
		||||
--- a/data/pine64,pinephone-1.0.toml
 | 
			
		||||
+++ b/data/pine64,pinephone-1.0.toml
 | 
			
		||||
@@ -39,8 +39,8 @@ 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 = "QSCLK", value = "1" },
 | 
			
		||||
@@ -62,6 +62,15 @@ configure = [
 | 
			
		||||
     { cmd = "QGPSCFG", subcmd = "galileonmeatype", expect = "0" },
 | 
			
		||||
     { cmd = "QGPSCFG", subcmd = "beidounmeatype", expect = "0" },
 | 
			
		||||
     { cmd = "QGPSCFG", subcmd = "autogps", expect = "0" },
 | 
			
		||||
+# 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 = [
 | 
			
		||||
 ]
 | 
			
		||||
diff --git a/data/pine64,pinephone-1.1.toml b/data/pine64,pinephone-1.1.toml
 | 
			
		||||
index e127f1a..c2ee8bd 100644
 | 
			
		||||
--- a/data/pine64,pinephone-1.1.toml
 | 
			
		||||
+++ b/data/pine64,pinephone-1.1.toml
 | 
			
		||||
@@ -39,11 +39,20 @@ 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 = "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" },
 | 
			
		||||
 # GNSS configuration:
 | 
			
		||||
 #   * Enable A-GPS data upload support (XTRA)
 | 
			
		||||
 #   * Disable On-Demand-Positioning (ODP) mode 
 | 
			
		||||
diff --git a/data/pine64,pinephone-1.2.toml b/data/pine64,pinephone-1.2.toml
 | 
			
		||||
index e16f4f5..a45c7ec 100644
 | 
			
		||||
--- a/data/pine64,pinephone-1.2.toml
 | 
			
		||||
+++ b/data/pine64,pinephone-1.2.toml
 | 
			
		||||
@@ -36,8 +36,20 @@ 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 = "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" },
 | 
			
		||||
 # GNSS configuration:
 | 
			
		||||
 #   * Enable A-GPS data upload support (XTRA)
 | 
			
		||||
 #   * Disable On-Demand-Positioning (ODP) mode 
 | 
			
		||||
diff --git a/src/at.c b/src/at.c
 | 
			
		||||
index f694507..7c5f092 100644
 | 
			
		||||
--- a/src/at.c
 | 
			
		||||
+++ b/src/at.c
 | 
			
		||||
@@ -222,7 +222,12 @@ static gboolean modem_response(gint fd,
 | 
			
		||||
         else if (strstr(response, "QGPSURC: \"xtradataexpire\""))
 | 
			
		||||
             gnss_upload_assistance_data(manager);
 | 
			
		||||
         /* AT command failed, retry */
 | 
			
		||||
-        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);
 | 
			
		||||
         /*
 | 
			
		||||
          * Successfull AT responses contain 'OK', except for AT+QFUPL which also
 | 
			
		||||
@@ -1,129 +0,0 @@
 | 
			
		||||
From a046b539418958eeb2ee26ec5ef273835c98d0d2 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Dylan Van Assche <me@dylanvanassche.be>
 | 
			
		||||
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 <me@dylanvanassche.be>
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
@@ -1,152 +0,0 @@
 | 
			
		||||
From e690e2a17d9798ad22d961bd4ee2613593d68e44 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Dylan Van Assche <me@dylanvanassche.be>
 | 
			
		||||
Date: Sun, 23 May 2021 20:00:42 +0200
 | 
			
		||||
Subject: [PATCH] at: wake only when sending AT commands
 | 
			
		||||
 | 
			
		||||
Allow the modem to enter soft sleep when
 | 
			
		||||
we don't talk to the modem using AT commands.
 | 
			
		||||
This was already the case in suspend, but
 | 
			
		||||
not during runtime. By only waking the modem
 | 
			
		||||
from soft sleep when we need to send
 | 
			
		||||
an AT command, we can save some power.
 | 
			
		||||
---
 | 
			
		||||
 src/at.c   | 36 +++++++++++++++++++++++-------------
 | 
			
		||||
 src/gpio.c | 24 ++++++++++++++++++++++--
 | 
			
		||||
 src/gpio.h |  2 ++
 | 
			
		||||
 3 files changed, 47 insertions(+), 15 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/src/at.c b/src/at.c
 | 
			
		||||
index a34025f..358d95a 100644
 | 
			
		||||
--- a/src/at.c
 | 
			
		||||
+++ b/src/at.c
 | 
			
		||||
@@ -6,6 +6,7 @@
 | 
			
		||||
 
 | 
			
		||||
 #include "at.h"
 | 
			
		||||
 #include "suspend.h"
 | 
			
		||||
+#include "gpio.h"
 | 
			
		||||
 #include "gnss.h"
 | 
			
		||||
 
 | 
			
		||||
 #include <fcntl.h>
 | 
			
		||||
@@ -52,6 +53,10 @@ gboolean at_send_command(struct EG25Mana
 | 
			
		||||
     int ret, len = 0;
 | 
			
		||||
 
 | 
			
		||||
     if (at_cmd) {
 | 
			
		||||
+    	/* Wake up the modem from soft sleep before sending an AT command */
 | 
			
		||||
+    	gpio_sequence_wake(manager);
 | 
			
		||||
+
 | 
			
		||||
+	/* Send AT command */
 | 
			
		||||
         if (at_cmd->subcmd == NULL && at_cmd->value == NULL && at_cmd->expected == NULL)
 | 
			
		||||
             len = sprintf(command, "AT+%s\r\n", at_cmd->cmd);
 | 
			
		||||
         else if (at_cmd->subcmd == NULL && at_cmd->value == NULL)
 | 
			
		||||
@@ -69,23 +74,28 @@ gboolean at_send_command(struct EG25Mana
 | 
			
		||||
             g_warning("Couldn't write full AT command: wrote %d/%d bytes", ret, len);
 | 
			
		||||
 
 | 
			
		||||
         g_message("Sending command: %s", g_strstrip(command));
 | 
			
		||||
-    } else if (manager->modem_state < EG25_STATE_CONFIGURED) {
 | 
			
		||||
-        if (manager->modem_iface == MODEM_IFACE_MODEMMANAGER) {
 | 
			
		||||
+    } else {
 | 
			
		||||
+    	/* Allow the modem to enter soft sleep again when we sent the AT command*/
 | 
			
		||||
+    	gpio_sequence_sleep(manager);
 | 
			
		||||
+	
 | 
			
		||||
+	if (manager->modem_state < EG25_STATE_CONFIGURED) {
 | 
			
		||||
+	    if (manager->modem_iface == MODEM_IFACE_MODEMMANAGER) {
 | 
			
		||||
 #ifdef HAVE_MMGLIB
 | 
			
		||||
-            MMModemState modem_state = mm_modem_get_state(manager->mm_modem);
 | 
			
		||||
+                MMModemState modem_state = mm_modem_get_state(manager->mm_modem);
 | 
			
		||||
 
 | 
			
		||||
-            if (manager->mm_modem && modem_state >= MM_MODEM_STATE_REGISTERED)
 | 
			
		||||
-                modem_update_state(manager, modem_state);
 | 
			
		||||
-            else
 | 
			
		||||
-                manager->modem_state = EG25_STATE_CONFIGURED;
 | 
			
		||||
+		if (manager->mm_modem && modem_state >= MM_MODEM_STATE_REGISTERED)
 | 
			
		||||
+                    modem_update_state(manager, modem_state);
 | 
			
		||||
+		else
 | 
			
		||||
+                    manager->modem_state = EG25_STATE_CONFIGURED;
 | 
			
		||||
 #endif
 | 
			
		||||
-        } else {
 | 
			
		||||
-            manager->modem_state = EG25_STATE_CONFIGURED;
 | 
			
		||||
+            } else {
 | 
			
		||||
+                manager->modem_state = EG25_STATE_CONFIGURED;
 | 
			
		||||
+	    }
 | 
			
		||||
+        } else if (manager->modem_state == EG25_STATE_SUSPENDING) {
 | 
			
		||||
+            modem_suspend_post(manager);
 | 
			
		||||
+        } else if (manager->modem_state == EG25_STATE_RESETTING) {
 | 
			
		||||
+            manager->modem_state = EG25_STATE_POWERED;
 | 
			
		||||
         }
 | 
			
		||||
-    } else if (manager->modem_state == EG25_STATE_SUSPENDING) {
 | 
			
		||||
-        modem_suspend_post(manager);
 | 
			
		||||
-    } else if (manager->modem_state == EG25_STATE_RESETTING) {
 | 
			
		||||
-        manager->modem_state = EG25_STATE_POWERED;
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     return FALSE;
 | 
			
		||||
diff --git a/src/gpio.c b/src/gpio.c
 | 
			
		||||
index a5d3bf0..617b69e 100644
 | 
			
		||||
--- a/src/gpio.c
 | 
			
		||||
+++ b/src/gpio.c
 | 
			
		||||
@@ -6,6 +6,8 @@
 | 
			
		||||
 
 | 
			
		||||
 #include "gpio.h"
 | 
			
		||||
 
 | 
			
		||||
+#include <unistd.h>
 | 
			
		||||
+
 | 
			
		||||
 #define GPIO_CHIP1_LABEL "1c20800.pinctrl"
 | 
			
		||||
 #define GPIO_CHIP2_LABEL "1f02c00.pinctrl"
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +54,6 @@ int gpio_sequence_shutdown(struct EG25Manager *manager)
 | 
			
		||||
 int gpio_sequence_suspend(struct EG25Manager *manager)
 | 
			
		||||
 {
 | 
			
		||||
     gpiod_line_set_value(manager->gpio_out[GPIO_OUT_APREADY], 1);
 | 
			
		||||
-    gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 1);
 | 
			
		||||
 
 | 
			
		||||
     g_message("Executed suspend sequence");
 | 
			
		||||
 
 | 
			
		||||
@@ -62,13 +63,32 @@ int gpio_sequence_suspend(struct EG25Manager *manager)
 | 
			
		||||
 int gpio_sequence_resume(struct EG25Manager *manager)
 | 
			
		||||
 {
 | 
			
		||||
     gpiod_line_set_value(manager->gpio_out[GPIO_OUT_APREADY], 0);
 | 
			
		||||
-    gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 0);
 | 
			
		||||
 
 | 
			
		||||
     g_message("Executed resume sequence");
 | 
			
		||||
 
 | 
			
		||||
     return 0;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+int gpio_sequence_wake(struct EG25Manager *manager)
 | 
			
		||||
+{
 | 
			
		||||
+    gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 0);
 | 
			
		||||
+
 | 
			
		||||
+    /* Give the modem 5ms to wake from soft sleep */
 | 
			
		||||
+    usleep(5000);
 | 
			
		||||
+
 | 
			
		||||
+    g_message("Executed soft wake sequence");
 | 
			
		||||
+
 | 
			
		||||
+    return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+int gpio_sequence_sleep(struct EG25Manager *manager)
 | 
			
		||||
+{
 | 
			
		||||
+    gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 1);
 | 
			
		||||
+    g_message("Executed soft sleep sequence");
 | 
			
		||||
+
 | 
			
		||||
+    return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static guint get_config_gpio(toml_table_t *config, const char *id)
 | 
			
		||||
 {
 | 
			
		||||
     toml_datum_t value = toml_int_in(config, id);
 | 
			
		||||
diff --git a/src/gpio.h b/src/gpio.h
 | 
			
		||||
index 8d94013..a041bdc 100644
 | 
			
		||||
--- a/src/gpio.h
 | 
			
		||||
+++ b/src/gpio.h
 | 
			
		||||
@@ -15,5 +15,7 @@ int gpio_sequence_poweron(struct EG25Manager *state);
 | 
			
		||||
 int gpio_sequence_shutdown(struct EG25Manager *state);
 | 
			
		||||
 int gpio_sequence_suspend(struct EG25Manager *state);
 | 
			
		||||
 int gpio_sequence_resume(struct EG25Manager *state);
 | 
			
		||||
+int gpio_sequence_wake(struct EG25Manager *state);
 | 
			
		||||
+int gpio_sequence_sleep(struct EG25Manager *state);
 | 
			
		||||
 
 | 
			
		||||
 gboolean gpio_check_poweroff(struct EG25Manager *manager, gboolean keep_down);
 | 
			
		||||
-- 
 | 
			
		||||
GitLab
 | 
			
		||||
 | 
			
		||||
@@ -6,24 +6,6 @@ Before=ModemManager.service
 | 
			
		||||
Type=simple
 | 
			
		||||
ExecStart=/usr/bin/eg25manager
 | 
			
		||||
Restart=on-failure
 | 
			
		||||
ProtectControlGroups=true
 | 
			
		||||
ProtectHome=true
 | 
			
		||||
ProtectKernelTunables=true
 | 
			
		||||
ProtectSystem=strict
 | 
			
		||||
RestrictSUIDSGID=true
 | 
			
		||||
PrivateTmp=true
 | 
			
		||||
ProtectedKernelModules=true
 | 
			
		||||
MemoryDenyWriteExecute=true
 | 
			
		||||
PrivateMounts=true
 | 
			
		||||
NoNewPrivileges=true
 | 
			
		||||
CapabilityBoundingSet=
 | 
			
		||||
ProtectProc=true
 | 
			
		||||
ProtectDevices=true
 | 
			
		||||
DeviceAllow=/dev/ttyS2
 | 
			
		||||
LockPersonality=true
 | 
			
		||||
PrivateNetwork=true
 | 
			
		||||
ProtectClock=true
 | 
			
		||||
ProtectKernelLog=true
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=multi-user.target
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										49
									
								
								net-misc/eg25-manager/files/eg25-pinephone-1.0.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								net-misc/eg25-manager/files/eg25-pinephone-1.0.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
[manager]
 | 
			
		||||
need_libusb = true
 | 
			
		||||
usb_vid = 0x2c7c
 | 
			
		||||
usb_pid = 0x0125
 | 
			
		||||
 | 
			
		||||
# Uncomment the following if you need to change the modem detection timeout on
 | 
			
		||||
# resume and/or the time during which suspend is blocked after modem boot
 | 
			
		||||
#[suspend]
 | 
			
		||||
#boot_timeout = 120
 | 
			
		||||
#recovery_timeout = 9
 | 
			
		||||
 | 
			
		||||
[gpio]
 | 
			
		||||
dtr = 358
 | 
			
		||||
pwrkey = 35
 | 
			
		||||
reset = 68
 | 
			
		||||
apready = 231
 | 
			
		||||
disable = 232
 | 
			
		||||
 | 
			
		||||
[at]
 | 
			
		||||
uart = "/dev/ttyS2"
 | 
			
		||||
configure = [
 | 
			
		||||
# Each command has 4 possible elements:
 | 
			
		||||
#   * `cmd`   : the AT command itself, which will be translated to "AT+`cmd`"
 | 
			
		||||
#   * `subcmd`: the subcommand in case a single AT command can be used
 | 
			
		||||
#               to change multiple parameters, such as QCFG (optional)
 | 
			
		||||
#   * `value` : the commands, argument, usually used to set the value of
 | 
			
		||||
#               a specific parameter (optional)
 | 
			
		||||
#   * `expect`: the expected return value; the command is first executed
 | 
			
		||||
#               without any value in order to query the current state. This
 | 
			
		||||
#               state is then compared to the `expect` string; if they don't
 | 
			
		||||
#               match, the command is then executed with value `expect` in
 | 
			
		||||
#               order to set the parameter to the configured value (optional)
 | 
			
		||||
# A command can have `expect` OR `value` configured, but it shouldn't have both
 | 
			
		||||
    { cmd = "QGMR" },
 | 
			
		||||
    { cmd = "QDAI", expect = "1,1,0,1,0,0,1,1" },
 | 
			
		||||
    { 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/delay", expect = "1" },
 | 
			
		||||
    { cmd = "QURCCFG", subcmd = "urcport", expect = "\"usbat\"" },
 | 
			
		||||
    { cmd = "QSCLK", value = "1" },
 | 
			
		||||
]
 | 
			
		||||
suspend = [
 | 
			
		||||
]
 | 
			
		||||
resume = [
 | 
			
		||||
]
 | 
			
		||||
reset = [ { cmd = "CFUN", value = "1,1" } ]
 | 
			
		||||
							
								
								
									
										50
									
								
								net-misc/eg25-manager/files/eg25-pinephone-1.1.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								net-misc/eg25-manager/files/eg25-pinephone-1.1.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
[manager]
 | 
			
		||||
need_libusb = true
 | 
			
		||||
usb_vid = 0x2c7c
 | 
			
		||||
usb_pid = 0x0125
 | 
			
		||||
 | 
			
		||||
# Uncomment the following if you need to change the modem detection timeout on
 | 
			
		||||
# resume and/or the time during which suspend is blocked after modem boot
 | 
			
		||||
#[suspend]
 | 
			
		||||
#boot_timeout = 120
 | 
			
		||||
#recovery_timeout = 9
 | 
			
		||||
 | 
			
		||||
[gpio]
 | 
			
		||||
dtr = 358
 | 
			
		||||
pwrkey = 35
 | 
			
		||||
reset = 68
 | 
			
		||||
apready = 231
 | 
			
		||||
disable = 232
 | 
			
		||||
 | 
			
		||||
[at]
 | 
			
		||||
uart = "/dev/ttyS2"
 | 
			
		||||
configure = [
 | 
			
		||||
# Each command has 4 possible elements:
 | 
			
		||||
#   * `cmd`   : the AT command itself, which will be translated to "AT+`cmd`"
 | 
			
		||||
#   * `subcmd`: the subcommand in case a single AT command can be used
 | 
			
		||||
#               to change multiple parameters, such as QCFG (optional)
 | 
			
		||||
#   * `value` : the commands, argument, usually used to set the value of
 | 
			
		||||
#               a specific parameter (optional)
 | 
			
		||||
#   * `expect`: the expected return value; the command is first executed
 | 
			
		||||
#               without any value in order to query the current state. This
 | 
			
		||||
#               state is then compared to the `expect` string; if they don't
 | 
			
		||||
#               match, the command is then executed with value `expect` in
 | 
			
		||||
#               order to set the parameter to the configured value (optional)
 | 
			
		||||
# A command can have `expect` OR `value` configured, but it shouldn't have both
 | 
			
		||||
    { cmd = "QGMR" },
 | 
			
		||||
    { cmd = "QDAI", expect = "1,1,0,1,0,0,1,1" },
 | 
			
		||||
    { 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/delay", expect = "1" },
 | 
			
		||||
    { cmd = "QURCCFG", subcmd = "urcport", expect = "\"usbat\"" },
 | 
			
		||||
    { cmd = "QSCLK", value = "1" },
 | 
			
		||||
]
 | 
			
		||||
suspend = [
 | 
			
		||||
]
 | 
			
		||||
resume = [
 | 
			
		||||
]
 | 
			
		||||
reset = [ { cmd = "CFUN", value = "1,1" } ]
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										42
									
								
								net-misc/eg25-manager/files/eg25-pinephone-1.2.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								net-misc/eg25-manager/files/eg25-pinephone-1.2.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
# Uncomment the following if you need to change the modem detection timeout on
 | 
			
		||||
# resume and/or the time during which suspend is blocked after modem boot
 | 
			
		||||
#[suspend]
 | 
			
		||||
#boot_timeout = 120
 | 
			
		||||
#recovery_timeout = 9
 | 
			
		||||
 | 
			
		||||
[gpio]
 | 
			
		||||
dtr = 34
 | 
			
		||||
pwrkey = 35
 | 
			
		||||
reset = 68
 | 
			
		||||
apready = 231
 | 
			
		||||
disable = 232
 | 
			
		||||
status = 233
 | 
			
		||||
 | 
			
		||||
[at]
 | 
			
		||||
uart = "/dev/ttyS2"
 | 
			
		||||
configure = [
 | 
			
		||||
# Each command has 4 possible elements:
 | 
			
		||||
#   * `cmd`   : the AT command itself, which will be translated to "AT+`cmd`"
 | 
			
		||||
#   * `subcmd`: the subcommand in case a single AT command can be used
 | 
			
		||||
#               to change multiple parameters, such as QCFG (optional)
 | 
			
		||||
#   * `value` : the commands, argument, usually used to set the value of
 | 
			
		||||
#               a specific parameter (optional)
 | 
			
		||||
#   * `expect`: the expected return value; the command is first executed
 | 
			
		||||
#               without any value in order to query the current state. This
 | 
			
		||||
#               state is then compared to the `expect` string; if they don't
 | 
			
		||||
#               match, the command is then executed with value `expect` in
 | 
			
		||||
#               order to set the parameter to the configured value (optional)
 | 
			
		||||
# A command can have `expect` OR `value` configured, but it shouldn't have both
 | 
			
		||||
    { cmd = "QGMR" },
 | 
			
		||||
    { cmd = "QDAI", expect = "1,1,0,1,0,0,1,1" },
 | 
			
		||||
    { cmd = "QCFG", subcmd = "risignaltype", expect = "\"physical\"" },
 | 
			
		||||
    { cmd = "QCFG", subcmd = "ims", expect = "1" },
 | 
			
		||||
    { cmd = "QCFG", subcmd = "apready", expect = "1,0,500" },
 | 
			
		||||
    { cmd = "QURCCFG", subcmd = "urcport", expect = "\"usbat\"" },
 | 
			
		||||
    { cmd = "QSCLK", value = "1" },
 | 
			
		||||
]
 | 
			
		||||
suspend = [
 | 
			
		||||
]
 | 
			
		||||
resume = [
 | 
			
		||||
]
 | 
			
		||||
reset = [ { cmd = "CFUN", value = "1,1" } ]
 | 
			
		||||
		Reference in New Issue
	
	Block a user