src: add udev watcher to improve modem recovery

Most of the modem issues follow a (incomplete) USB device reset. Instead 
of relying solely on the existing timer, this patch adds a udev monitor 
which resets the modem as soon as its associated USB device is reset, 
which greatly improves recovery time.
This commit is contained in:
Arnaud Ferraris
2020-12-18 01:37:06 +01:00
parent 74b91c7d58
commit 62a07f9c51
7 changed files with 64 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include "manager.h"
#include "mm-iface.h"
#include "suspend.h"
#include "udev.h"
#include <fcntl.h>
#include <signal.h>
@@ -30,6 +31,7 @@ static gboolean quit_app(struct EG25Manager *manager)
at_destroy(manager);
mm_iface_destroy(manager);
suspend_destroy(manager);
udev_destroy(manager);
if (manager->modem_state >= EG25_STATE_STARTED) {
g_message("Powering down the modem...");
@@ -202,6 +204,7 @@ int main(int argc, char *argv[])
gpio_init(&manager);
mm_iface_init(&manager);
suspend_init(&manager);
udev_init(&manager);
g_idle_add(G_SOURCE_FUNC(modem_start), &manager);