manager: only toggle GPIOs for suspend after executing all AT commands

This commit is contained in:
Arnaud Ferraris
2020-12-30 16:20:32 +01:00
parent d990ab667e
commit abc05e86e5
4 changed files with 12 additions and 6 deletions

View File

@@ -80,8 +80,7 @@ static gboolean send_at_command(struct EG25Manager *manager)
else else
manager->modem_state = EG25_STATE_CONFIGURED; manager->modem_state = EG25_STATE_CONFIGURED;
} else if (manager->modem_state == EG25_STATE_SUSPENDING) { } else if (manager->modem_state == EG25_STATE_SUSPENDING) {
g_message("suspend sequence is over, drop inhibitor"); modem_suspend_post(manager);
suspend_inhibit(manager, FALSE);
} else if (manager->modem_state == EG25_STATE_RESETTING) { } else if (manager->modem_state == EG25_STATE_RESETTING) {
manager->modem_state = EG25_STATE_POWERED; manager->modem_state = EG25_STATE_POWERED;
} }

View File

@@ -162,10 +162,16 @@ error:
at_sequence_reset(manager); at_sequence_reset(manager);
} }
void modem_suspend(struct EG25Manager *manager) void modem_suspend_pre(struct EG25Manager *manager)
{
at_sequence_suspend(manager);
}
void modem_suspend_post(struct EG25Manager *manager)
{ {
gpio_sequence_suspend(manager); gpio_sequence_suspend(manager);
at_sequence_suspend(manager); g_message("suspend sequence is over, drop inhibitor");
suspend_inhibit(manager, FALSE);
} }
void modem_resume_pre(struct EG25Manager *manager) void modem_resume_pre(struct EG25Manager *manager)

View File

@@ -54,7 +54,8 @@ struct EG25Manager {
void modem_configure(struct EG25Manager *data); void modem_configure(struct EG25Manager *data);
void modem_reset(struct EG25Manager *data); void modem_reset(struct EG25Manager *data);
void modem_suspend(struct EG25Manager *data); void modem_suspend_pre(struct EG25Manager *data);
void modem_suspend_post(struct EG25Manager *data);
void modem_resume_pre(struct EG25Manager *data); void modem_resume_pre(struct EG25Manager *data);
void modem_resume_post(struct EG25Manager *data); void modem_resume_post(struct EG25Manager *data);
void modem_update_state(struct EG25Manager *data, MMModemState state); void modem_update_state(struct EG25Manager *data, MMModemState state);

View File

@@ -94,7 +94,7 @@ static void signal_cb(GDBusProxy *proxy,
if (is_about_to_suspend) { if (is_about_to_suspend) {
g_message("system is about to suspend"); g_message("system is about to suspend");
manager->modem_state = EG25_STATE_SUSPENDING; manager->modem_state = EG25_STATE_SUSPENDING;
modem_suspend(manager); modem_suspend_pre(manager);
} else { } else {
g_message("system is resuming"); g_message("system is resuming");
take_inhibitor(manager); take_inhibitor(manager);