diff options
Diffstat (limited to 'cli/mmcli-modem-firmware.c')
-rw-r--r-- | cli/mmcli-modem-firmware.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cli/mmcli-modem-firmware.c b/cli/mmcli-modem-firmware.c index b5d474b6..ffcceb6a 100644 --- a/cli/mmcli-modem-firmware.c +++ b/cli/mmcli-modem-firmware.c @@ -151,7 +151,8 @@ print_firmware_status (void) MMModemFirmwareUpdateMethod m; m = mm_firmware_update_settings_get_method (update_settings); - method = mm_modem_firmware_update_method_get_string (m); + if (m != MM_MODEM_FIRMWARE_UPDATE_METHOD_UNKNOWN) + method = mm_modem_firmware_update_method_get_string (m); switch (m) { case MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT: @@ -162,6 +163,18 @@ print_firmware_status (void) } } + /* There's not much to print in this status info, and if the modem + * does not support any firmware update method, we would just be returning + * an empty response to the --firmware-status action. So, instead, just + * return an error message explicitly when in human output type. + * We can remove this error message as soon as there is some parameter + * that will always be printed. + */ + if (!method && !fastboot_at && mmcli_output_get () == MMC_OUTPUT_TYPE_HUMAN) { + g_printerr ("error: firmware status unsupported\n"); + exit (EXIT_FAILURE); + } + mmcli_output_string (MMC_F_FIRMWARE_METHOD, method); mmcli_output_string (MMC_F_FIRMWARE_FASTBOOT_AT, fastboot_at); mmcli_output_dump (); |