From 692f9134f8057e3a8573366de4ed3f772ca315de Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Sat, 23 Jan 2021 11:14:41 +0100 Subject: [PATCH] suspend: handle case when MM doesn't manage suspend/resume --- src/suspend.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/suspend.c b/src/suspend.c index 6d34594..4b1a026 100644 --- a/src/suspend.c +++ b/src/suspend.c @@ -99,8 +99,18 @@ static void signal_cb(GDBusProxy *proxy, g_message("system is resuming"); take_inhibitor(manager); modem_resume_pre(manager); - manager->modem_state = EG25_STATE_RESUMING; - manager->suspend_timer = g_timeout_add_seconds(9, G_SOURCE_FUNC(check_modem_resume), manager); + if (manager->mm_modem) { + /* + * On some systems ModemManager doesn't handle suspend/resume, so + * we still have a valid/managed modem when resuming. In this case, + * do the whole resume sequence immediately. + */ + manager->modem_state = EG25_STATE_CONFIGURED; + modem_resume_post(manager); + } else { + manager->modem_state = EG25_STATE_RESUMING; + manager->suspend_timer = g_timeout_add_seconds(9, G_SOURCE_FUNC(check_modem_resume), manager); + } } }