diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-12-09 13:54:31 +0100 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2019-01-03 18:53:52 +0000 |
commit | 8e342cf1204379a11bfe55941d4e722575cb364f (patch) | |
tree | 2c5ee65fd67cba8d833d7fddf60f6c63a109e9a0 /cli/mmcli-modem-firmware.c | |
parent | edf8d349390ec5be8d35f6e7105cde483849aae0 (diff) |
api,firmware: new UpdateSettings property
Diffstat (limited to 'cli/mmcli-modem-firmware.c')
-rw-r--r-- | cli/mmcli-modem-firmware.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/cli/mmcli-modem-firmware.c b/cli/mmcli-modem-firmware.c index 008de8de..b5d474b6 100644 --- a/cli/mmcli-modem-firmware.c +++ b/cli/mmcli-modem-firmware.c @@ -45,10 +45,15 @@ typedef struct { static Context *ctx; /* Options */ +static gboolean status_flag; static gboolean list_flag; static gchar *select_str; static GOptionEntry entries[] = { + { "firmware-status", 0, 0, G_OPTION_ARG_NONE, &status_flag, + "Show status of firmware management.", + NULL + }, { "firmware-list", 0, 0, G_OPTION_ARG_NONE, &list_flag, "List firmware images installed in a given modem", NULL @@ -84,7 +89,8 @@ mmcli_modem_firmware_options_enabled (void) if (checked) return !!n_actions; - n_actions = (list_flag + + n_actions = (status_flag + + list_flag + !!select_str); if (n_actions > 1) { @@ -92,6 +98,9 @@ mmcli_modem_firmware_options_enabled (void) exit (EXIT_FAILURE); } + if (status_flag) + mmcli_force_sync_operation (); + checked = TRUE; return !!n_actions; } @@ -131,6 +140,34 @@ mmcli_modem_firmware_shutdown (void) } static void +print_firmware_status (void) +{ + MMFirmwareUpdateSettings *update_settings; + const gchar *method = NULL; + const gchar *fastboot_at = NULL; + + update_settings = mm_modem_firmware_peek_update_settings (ctx->modem_firmware); + if (update_settings) { + MMModemFirmwareUpdateMethod m; + + m = mm_firmware_update_settings_get_method (update_settings); + method = mm_modem_firmware_update_method_get_string (m); + + switch (m) { + case MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT: + fastboot_at = mm_firmware_update_settings_get_fastboot_at (update_settings); + break; + default: + break; + } + } + + mmcli_output_string (MMC_F_FIRMWARE_METHOD, method); + mmcli_output_string (MMC_F_FIRMWARE_FASTBOOT_AT, fastboot_at); + mmcli_output_dump (); +} + +static void list_process_reply (MMFirmwareProperties *selected, GList *result, const GError *error) @@ -205,6 +242,9 @@ get_modem_ready (GObject *source, ensure_modem_firmware (); + if (status_flag) + g_assert_not_reached (); + /* Request to list images? */ if (list_flag) { g_debug ("Asynchronously listing firmware images in modem..."); @@ -264,6 +304,13 @@ mmcli_modem_firmware_run_synchronous (GDBusConnection *connection) ensure_modem_firmware (); + /* Request to get firmware status? */ + if (status_flag) { + g_debug ("Printing firmware status..."); + print_firmware_status (); + return; + } + /* Request to list firmware images? */ if (list_flag) { GList *installed = NULL; |