cli: report modem removal in --monitor-state

If the modem ends up not being managed by ModemManager, detect it
during the '--monitor-state' mmcli operation and report it.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/106
This commit is contained in:
Aleksander Morgado
2019-02-11 15:08:09 +01:00
parent 0f6f89801e
commit de81520c43
+18
View File
@@ -900,6 +900,19 @@ state_changed (MMModem *modem,
fflush (stdout);
}
static void
device_removed (MMManager *manager,
MMObject *object)
{
if (object != ctx->object)
return;
g_print ("\t%s: Removed\n", mm_object_get_path (object));
fflush (stdout);
mmcli_async_operation_done ();
}
static void
get_modem_ready (GObject *source,
GAsyncResult *result,
@@ -930,6 +943,11 @@ get_modem_ready (GObject *source,
G_CALLBACK (state_changed),
NULL);
g_signal_connect (ctx->manager,
"object-removed",
G_CALLBACK (device_removed),
NULL);
current = mm_modem_get_state (ctx->modem);
g_print ("\t%s: Initial state, '%s'\n",
mm_object_get_path (ctx->object),