[PATCH] sim7100: enable ppp-reset workaround
Sean Nyekjaer <[email protected]> Tue, 19 Aug 2025 12:46:59 +0200
| Newsgroups | dev.linux.lists.ofono |
|---|---|
| Message-ID | <[email protected]> |
Implement AT+PPPTIM command handling for A76XX modems to enable PPP
state reset when powering off (AT+CFUN=0). This is needed because the
internal PPP engine doesn't shutdown when powering off and makes it
impossible to create a new PPP session before the old have timed out.
(15 sec)
---
plugins/sim7100.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index cec3b35d..02f5b537 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -106,13 +106,49 @@ static void sim7100_remove(struct ofono_modem *modem)
g_free(data);
}
+static void ppptim_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+
+ DBG("");
+
+ ofono_modem_set_powered(modem, TRUE);
+}
+
+static void ppptim_support_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct sim7100_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ if (ok) {
+ /* enable reset of PPP state upon AT+CFUN=0 for A76XX modems */
+ g_at_chat_send(data->at, "AT+PPPTIM=1", NULL, ppptim_cb,
+ modem, NULL);
+ } else {
+ ofono_warn("modem doesn't support ppp reset on disable; is the "
+ "firmware up to date?");
+ ofono_modem_set_powered(modem, TRUE);
+ }
+}
+
static void cfun_set_on_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
+ struct sim7100_data *data = ofono_modem_get_data(modem);
DBG("");
- if (ok)
+ if (!ok)
+ return;
+
+ if (data->model == SIMCOM_A76XX)
+ /* does the modem support reset of PPP state upon AT+CFUN=0? */
+ g_at_chat_send(data->at, "AT+PPPTIM?", NULL, ppptim_support_cb,
+ modem, NULL);
+ else
ofono_modem_set_powered(modem, TRUE);
}
--
2.50.1