diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-02-11 15:04:53 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-02-11 15:08:09 +0100 |
commit | de81520c4347f5203a179eeedb9f5188d89ab7c6 (patch) | |
tree | 95422700a85ab47dfaf14b219d251eabac8f0e6c /cli/mmcli-modem.c | |
parent | 0f6f89801e6bac35e1dbcc2df06265a078b923cc (diff) |
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
Diffstat (limited to 'cli/mmcli-modem.c')
-rw-r--r-- | cli/mmcli-modem.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c index 2b7e3569..9c964294 100644 --- a/cli/mmcli-modem.c +++ b/cli/mmcli-modem.c @@ -901,6 +901,19 @@ state_changed (MMModem *modem, } 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, gpointer none) @@ -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), |