diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-13 10:47:44 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-16 11:24:16 +0100 |
commit | bdc0a1e71e18419dd15f8d6865425cb6884e77c0 (patch) | |
tree | 9d2934170fc83de2e4cd28c033399c9a0724d92e /src/qmicli | |
parent | 4822e554694cf4a87990e9a246b102d29bcbfd53 (diff) | |
download | external_libqmi-bdc0a1e71e18419dd15f8d6865425cb6884e77c0.zip external_libqmi-bdc0a1e71e18419dd15f8d6865425cb6884e77c0.tar.gz external_libqmi-bdc0a1e71e18419dd15f8d6865425cb6884e77c0.tar.bz2 |
dms: add support for 'Set firmware id'
This command is the one used by Sierra modems to get into Boot & Hold
mode, and very likely has a set of TLVs that we don't know about. For
now, just an empty message.
Diffstat (limited to 'src/qmicli')
-rw-r--r-- | src/qmicli/qmicli-dms.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c index 27c4614..0f994ec 100644 --- a/src/qmicli/qmicli-dms.c +++ b/src/qmicli/qmicli-dms.c @@ -76,6 +76,7 @@ static gchar *write_user_data_str; static gboolean read_eri_file_flag; static gchar *restore_factory_defaults_str; static gchar *validate_service_programming_code_str; +static gboolean set_firmware_id_flag; static gboolean get_band_capabilities_flag; static gboolean get_factory_sku_flag; static gboolean list_stored_images_flag; @@ -229,6 +230,10 @@ static GOptionEntry entries[] = { "Validate the Service Programming Code", "[(Service Programming Code)]", }, + { "dms-set-firmware-id", 0, 0, G_OPTION_ARG_NONE, &set_firmware_id_flag, + "Set firmware id", + NULL + }, { "dms-get-band-capabilities", 0, 0, G_OPTION_ARG_NONE, &get_band_capabilities_flag, "Get band capabilities", NULL @@ -350,6 +355,7 @@ qmicli_dms_options_enabled (void) read_eri_file_flag + !!restore_factory_defaults_str + !!validate_service_programming_code_str + + set_firmware_id_flag + get_band_capabilities_flag + get_factory_sku_flag + list_stored_images_flag + @@ -2316,6 +2322,36 @@ validate_service_programming_code_ready (QmiClientDms *client, } static void +set_firmware_id_ready (QmiClientDms *client, + GAsyncResult *res) +{ + QmiMessageDmsSetFirmwareIdOutput *output; + GError *error = NULL; + + output = qmi_client_dms_set_firmware_id_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_set_firmware_id_output_get_result (output, &error)) { + g_printerr ("error: couldn't set firmware id: %s\n", error->message); + g_error_free (error); + qmi_message_dms_set_firmware_id_output_unref (output); + operation_shutdown (FALSE); + return; + } + + g_print ("[%s] Firmware id set\n", + qmi_device_get_path_display (ctx->device)); + + qmi_message_dms_set_firmware_id_output_unref (output); + operation_shutdown (TRUE); +} + +static void get_band_capabilities_ready (QmiClientDms *client, GAsyncResult *res) { @@ -3904,6 +3940,18 @@ qmicli_dms_run (QmiDevice *device, return; } + /* Set firmware id? */ + if (set_firmware_id_flag) { + g_debug ("Asynchronously setting firmware id..."); + qmi_client_dms_set_firmware_id (ctx->client, + NULL, + 10, + ctx->cancellable, + (GAsyncReadyCallback)set_firmware_id_ready, + NULL); + return; + } + /* Request to get CK status? */ if (uim_get_ck_status_str) { QmiMessageDmsUimGetCkStatusInput *input; |