From fcf3832f525ec3a6a5262674bf06f1bf9d739e46 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Tue, 5 Oct 2021 11:23:06 +0200 Subject: [PATCH] gpio: don't execute soft wake sequence if already woken up This add an unnecessary 200ms delay and pollute logs. --- src/gpio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gpio.c b/src/gpio.c index aae9b94..c97c57f 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -71,12 +71,14 @@ int gpio_sequence_resume(struct EG25Manager *manager) int gpio_sequence_wake(struct EG25Manager *manager) { - gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 0); + if (gpiod_line_get_value(manager->gpio_out[GPIO_OUT_DTR])) { + gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 0); - /* Give the modem 200ms to wake from soft sleep */ - usleep(200000); + /* Give the modem 200ms to wake from soft sleep */ + usleep(200000); - g_message("Executed soft wake sequence"); + g_message("Executed soft wake sequence"); + } return 0; }