diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-11 15:21:35 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-16 11:24:16 +0100 |
commit | 4822e554694cf4a87990e9a246b102d29bcbfd53 (patch) | |
tree | e818c7c33cacf1515e12fecbc38be6209da22944 /src/qmicli | |
parent | 84e48c9911bc1fc855da8c457d4bba05395dd76e (diff) | |
download | external_libqmi-4822e554694cf4a87990e9a246b102d29bcbfd53.zip external_libqmi-4822e554694cf4a87990e9a246b102d29bcbfd53.tar.gz external_libqmi-4822e554694cf4a87990e9a246b102d29bcbfd53.tar.bz2 |
qmicli,dms: new '--dms-get-software-version' operation
Diffstat (limited to 'src/qmicli')
-rw-r--r-- | src/qmicli/qmicli-dms.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c index 4d02850..27c4614 100644 --- a/src/qmicli/qmicli-dms.c +++ b/src/qmicli/qmicli-dms.c @@ -85,6 +85,7 @@ static gboolean get_firmware_preference_flag; static gchar *set_firmware_preference_str; static gboolean get_boot_image_download_mode_flag; static gchar *set_boot_image_download_mode_str; +static gboolean get_software_version_flag; static gboolean set_fcc_authentication_flag; static gboolean get_supported_messages_flag; static gchar *change_device_download_mode_str; @@ -264,6 +265,10 @@ static GOptionEntry entries[] = { "Set boot image download mode", "[normal|boot-and-recovery]" }, + { "dms-get-software-version", 0, 0, G_OPTION_ARG_NONE, &get_software_version_flag, + "Get software version", + NULL + }, { "dms-set-fcc-authentication", 0, 0, G_OPTION_ARG_NONE, &set_fcc_authentication_flag, "Set FCC authentication", NULL @@ -354,6 +359,7 @@ qmicli_dms_options_enabled (void) !!set_firmware_preference_str + get_boot_image_download_mode_flag + !!set_boot_image_download_mode_str + + get_software_version_flag + set_fcc_authentication_flag + get_supported_messages_flag + !!change_device_download_mode_str + @@ -3229,6 +3235,40 @@ set_boot_image_download_mode_ready (QmiClientDms *client, } static void +get_software_version_ready (QmiClientDms *client, + GAsyncResult *res) +{ + QmiMessageDmsGetSoftwareVersionOutput *output; + GError *error = NULL; + const gchar *version; + + output = qmi_client_dms_get_software_version_finish (client, res, &error); + if (!output) { + g_printerr ("error: operation failed: %s\n", error->message); + g_error_free (error); + operation_shutdown (FALSE); + return; + } + + if (!qmi_message_dms_get_software_version_output_get_result (output, &error)) { + g_printerr ("error: couldn't get boot image download mode: %s\n", error->message); + g_error_free (error); + qmi_message_dms_get_software_version_output_unref (output); + operation_shutdown (FALSE); + return; + } + + qmi_message_dms_get_software_version_output_get_version (output, &version, NULL); + + g_print ("[%s] Software version: %s\n", + qmi_device_get_path_display (ctx->device), + version); + + qmi_message_dms_get_software_version_output_unref (output); + operation_shutdown (TRUE); +} + +static void set_fcc_authentication_ready (QmiClientDms *client, GAsyncResult *res) { @@ -4050,6 +4090,18 @@ qmicli_dms_run (QmiDevice *device, return; } + /* Get software version */ + if (get_software_version_flag) { + g_debug ("Asynchronously getting software version..."); + qmi_client_dms_get_software_version (ctx->client, + NULL, + 10, + ctx->cancellable, + (GAsyncReadyCallback)get_software_version_ready, + NULL); + return; + } + /* Set FCC authentication */ if (set_fcc_authentication_flag) { g_debug ("Asynchronously setting FCC auth..."); |