From 5fa345ec927171ce7c45f38cbd2040e2d4838faa Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 14:31:20 +0100 Subject: [PATCH 1/4] mm-iface: don't reset USB ID unless quitting As ModemManager releases the modem while going to sleep, we clear the USB ID too, which causes a segfault when trying to recover the modem. --- src/mm-iface.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/mm-iface.c b/src/mm-iface.c index f1021de..f6ec6eb 100644 --- a/src/mm-iface.c +++ b/src/mm-iface.c @@ -84,13 +84,8 @@ static void interface_removed_cb(struct EG25Manager *manager, g_message("ModemManager interface `%s' removed on object `%s'", info->name, path); - if (g_strcmp0(info->name, MM_DBUS_INTERFACE_MODEM) == 0) { + if (g_strcmp0(info->name, MM_DBUS_INTERFACE_MODEM) == 0) manager->mm_modem = NULL; - if (manager->modem_usb_id) { - g_free(manager->modem_usb_id); - manager->modem_usb_id = NULL; - } - } } @@ -133,10 +128,6 @@ static void object_removed_cb(struct EG25Manager *manager, GDBusObject *object) g_message("ModemManager object `%s' removed", path); manager->mm_modem = NULL; - if (manager->modem_usb_id) { - g_free(manager->modem_usb_id); - manager->modem_usb_id = NULL; - } } @@ -196,6 +187,10 @@ void mm_iface_destroy(struct EG25Manager *manager) g_clear_object(&manager->mm_manager); manager->mm_manager = NULL; } + if (manager->modem_usb_id) { + g_free(manager->modem_usb_id); + manager->modem_usb_id = NULL; + } if (manager->mm_watch != 0) { g_bus_unwatch_name(manager->mm_watch); manager->mm_watch = 0; From fd6a292a8f90bb5aba9f55936a4884f8693bd002 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 15:04:40 +0100 Subject: [PATCH 2/4] manager: don't change modem state after reset This makes sure the resume commands (disable URC cache and enable GPS) are executed. --- src/manager.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/manager.c b/src/manager.c index 2b466e3..739a8f0 100644 --- a/src/manager.c +++ b/src/manager.c @@ -126,7 +126,6 @@ void modem_reset(struct EG25Manager *manager) write(fd, manager->modem_usb_id, strlen(manager->modem_usb_id)); close(fd); - manager->modem_state = EG25_STATE_CONFIGURED; return; error: From 5715138a96fb04245bcd6bea4b3094e424e68272 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 15:09:10 +0100 Subject: [PATCH 3/4] suspend: reset sleep inhibitor if already present upon resume --- src/suspend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/suspend.c b/src/suspend.c index 8296696..873a985 100644 --- a/src/suspend.c +++ b/src/suspend.c @@ -66,7 +66,8 @@ static void take_inhibitor(struct EG25Manager *manager) { GVariant *variant_arg; - g_assert(manager->suspend_inhibit_fd == -1); + if(manager->suspend_inhibit_fd != -1) + drop_inhibitor(manager); variant_arg = g_variant_new ("(ssss)", "sleep", "eg25manager", "eg25manager needs to prepare modem for sleep", "delay"); From ff60016e5d476df930d6ae2db10d1ab5055f5fe0 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 11 Dec 2020 15:10:13 +0100 Subject: [PATCH 4/4] release version 0.0.6 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 918acb6..ba38ca3 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,7 @@ project ( 'eg25manager', 'c', - version : '0.0.5', + version : '0.0.6', license : 'GPLv3+', meson_version : '>= 0.50.0', default_options :