summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-01-13 10:47:44 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-01-16 11:24:16 +0100
commitbdc0a1e71e18419dd15f8d6865425cb6884e77c0 (patch)
tree9d2934170fc83de2e4cd28c033399c9a0724d92e
parent4822e554694cf4a87990e9a246b102d29bcbfd53 (diff)
downloadlibqmi-bdc0a1e71e18419dd15f8d6865425cb6884e77c0.tar.gz
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.
-rw-r--r--data/qmi-service-dms.json8
-rw-r--r--docs/reference/libqmi-glib/libqmi-glib-docs.xml1
-rw-r--r--src/qmicli/qmicli-dms.c48
3 files changed, 57 insertions, 0 deletions
diff --git a/data/qmi-service-dms.json b/data/qmi-service-dms.json
index c04582b7..cebf6217 100644
--- a/data/qmi-service-dms.json
+++ b/data/qmi-service-dms.json
@@ -765,6 +765,14 @@
"prerequisites": [ { "common-ref" : "Success" } ] } ] },
// *********************************************************************************
+ { "name" : "Set Firmware ID",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x003E",
+ "version" : "1.1",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
{ "name" : "UIM Get CK Status",
"type" : "Message",
"service" : "DMS",
diff --git a/docs/reference/libqmi-glib/libqmi-glib-docs.xml b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
index 71d4372c..49581146 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-docs.xml
+++ b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
@@ -94,6 +94,7 @@
<xi:include href="xml/qmi-message-dms-restore-factory-defaults.xml"/>
<xi:include href="xml/qmi-message-dms-validate-service-programming-code.xml"/>
<xi:include href="xml/qmi-message-dms-uim-get-iccid.xml"/>
+ <xi:include href="xml/qmi-message-dms-set-firmware-id.xml"/>
<xi:include href="xml/qmi-message-dms-uim-get-ck-status.xml"/>
<xi:include href="xml/qmi-message-dms-uim-set-ck-protection.xml"/>
<xi:include href="xml/qmi-message-dms-uim-unblock-ck.xml"/>
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c
index 27c46146..0f994ec6 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;