From 664f82d5707ff539a81a488c85939405d1644189 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 12:58:35 +0100 Subject: [PATCH 1/4] at: add default handling for unrecognized responses --- src/at.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/at.c b/src/at.c index c0cd92b..5654062 100644 --- a/src/at.c +++ b/src/at.c @@ -195,6 +195,9 @@ static gboolean modem_response(gint fd, retry_at_command(manager); else if (strstr(response, "OK")) process_at_result(manager, response); + else + // Not a recognized response, try running next command, just in case + next_at_command(manager); } return TRUE; From 9713af7ca8d7f9bfc7e3d4462fc22758cb599a55 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 13:30:36 +0100 Subject: [PATCH 2/4] at: fix GPS disabling on suspend --- src/at.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/at.c b/src/at.c index 5654062..742f50e 100644 --- a/src/at.c +++ b/src/at.c @@ -55,7 +55,9 @@ static gboolean send_at_command(struct EG25Manager *manager) struct AtCommand *at_cmd = g_list_nth_data(manager->at_cmds, 0); if (at_cmd) { - if (at_cmd->subcmd == NULL && at_cmd->value == NULL) + if (at_cmd->subcmd == NULL && at_cmd->value == NULL && at_cmd->expected == NULL) + sprintf(command, "AT+%s\r\n", at_cmd->cmd); + else if (at_cmd->subcmd == NULL && at_cmd->value == NULL) sprintf(command, "AT+%s?\r\n", at_cmd->cmd); else if (at_cmd->subcmd == NULL && at_cmd->value) sprintf(command, "AT+%s=%s\r\n", at_cmd->cmd, at_cmd->value); @@ -262,7 +264,7 @@ void at_sequence_configure(struct EG25Manager *manager) void at_sequence_suspend(struct EG25Manager *manager) { - append_at_command(manager, "QGPS", NULL, "0", NULL); + append_at_command(manager, "QGPSEND", NULL, NULL, NULL); append_at_command(manager, "QCFG", "urc/cache", "1", NULL); send_at_command(manager); } From 75b0920e9d39e41592f5b64072bba46b3ad37c9e Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 13:36:28 +0100 Subject: [PATCH 3/4] Revert "manager: split modem_suspend() into _pre() and _post() functions" This reverts commit ff9b26b8315709b99f97b33e3119394190b2e7ed. --- src/manager.c | 8 +------- src/manager.h | 3 +-- src/mm-iface.c | 3 --- src/suspend.c | 4 +++- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/manager.c b/src/manager.c index 78bf98b..2b466e3 100644 --- a/src/manager.c +++ b/src/manager.c @@ -135,20 +135,14 @@ error: manager->modem_state = EG25_STATE_RESETTING; } -void modem_suspend_pre(struct EG25Manager *manager) +void modem_suspend(struct EG25Manager *manager) { - manager->modem_state = EG25_STATE_SUSPENDING; gpio_sequence_suspend(manager); -} - -void modem_suspend_post(struct EG25Manager *manager) -{ at_sequence_suspend(manager); } void modem_resume_pre(struct EG25Manager *manager) { - manager->modem_state = EG25_STATE_RESUMING; gpio_sequence_resume(manager); } diff --git a/src/manager.h b/src/manager.h index be92a09..714a812 100644 --- a/src/manager.h +++ b/src/manager.h @@ -51,8 +51,7 @@ struct EG25Manager { void modem_configure(struct EG25Manager *data); void modem_reset(struct EG25Manager *data); -void modem_suspend_pre(struct EG25Manager *data); -void modem_suspend_post(struct EG25Manager *data); +void modem_suspend(struct EG25Manager *data); void modem_resume_pre(struct EG25Manager *data); void modem_resume_post(struct EG25Manager *data); void modem_update_state(struct EG25Manager *data, MMModemState state); diff --git a/src/mm-iface.c b/src/mm-iface.c index 9bf9209..f1021de 100644 --- a/src/mm-iface.c +++ b/src/mm-iface.c @@ -132,9 +132,6 @@ static void object_removed_cb(struct EG25Manager *manager, GDBusObject *object) path = g_dbus_object_get_object_path(object); g_message("ModemManager object `%s' removed", path); - if (manager->modem_state == EG25_STATE_SUSPENDING) - modem_suspend_post(manager); - manager->mm_modem = NULL; if (manager->modem_usb_id) { g_free(manager->modem_usb_id); diff --git a/src/suspend.c b/src/suspend.c index 42a18f7..8296696 100644 --- a/src/suspend.c +++ b/src/suspend.c @@ -92,11 +92,13 @@ static void signal_cb(GDBusProxy *proxy, if (is_about_to_suspend) { g_message("system is about to suspend"); - modem_suspend_pre(manager); + manager->modem_state = EG25_STATE_SUSPENDING; + modem_suspend(manager); } else { g_message("system is resuming"); take_inhibitor(manager); modem_resume_pre(manager); + manager->modem_state = EG25_STATE_RESUMING; manager->suspend_source = g_timeout_add_seconds(8, G_SOURCE_FUNC(check_modem_resume), manager); } } From a9725243ec43387a12751da9519b7c20112e116c Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 13:37:40 +0100 Subject: [PATCH 4/4] meson.build: bump version --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 9834573..918acb6 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,7 @@ project ( 'eg25manager', 'c', - version : '0.0.1', + version : '0.0.5', license : 'GPLv3+', meson_version : '>= 0.50.0', default_options :