diff --git a/src/manager.c b/src/manager.c index 9c33e3f..47cbc11 100644 --- a/src/manager.c +++ b/src/manager.c @@ -153,7 +153,15 @@ gboolean modem_reset(struct EG25Manager *manager) int fd, ret, len; /* reset sequence started, cannot be canceled anymore */ - manager->schedule_reset_timer = 0; + if (manager->schedule_reset_timer) { + g_source_remove(manager->schedule_reset_timer); + manager->schedule_reset_timer = 0; + } + + if (manager->modem_recovery_timer) { + g_source_remove(manager->modem_recovery_timer); + manager->modem_recovery_timer = 0; + } if (manager->complete_reset_timer) { g_message("modem_reset: timer already setup, skipping..."); @@ -170,11 +178,6 @@ gboolean modem_reset(struct EG25Manager *manager) return G_SOURCE_REMOVE; } - if (manager->modem_recovery_timer) { - g_source_remove(manager->modem_recovery_timer); - manager->modem_recovery_timer = 0; - } - if (!manager->modem_usb_id) { g_warning("Empty modem USB ID"); goto error;