aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mm-broadband-modem-qmi.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index 3a04e993..541a24cb 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -1157,6 +1157,82 @@ modem_load_revision (MMIfaceModem *self,
}
/*****************************************************************************/
+/* Hardware Revision loading (Modem interface) */
+
+static gchar *
+modem_load_hardware_revision_finish (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ gchar *revision;
+
+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
+ return NULL;
+
+ revision = g_strdup (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+ mm_dbg ("loaded hardware revision: %s", revision);
+ return revision;
+}
+
+static void
+dms_get_hardware_revision_ready (QmiClientDms *client,
+ GAsyncResult *res,
+ GSimpleAsyncResult *simple)
+{
+ QmiMessageDmsGetHardwareRevisionOutput *output = NULL;
+ GError *error = NULL;
+
+ output = qmi_client_dms_get_hardware_revision_finish (client, res, &error);
+ if (!output) {
+ g_prefix_error (&error, "QMI operation failed: ");
+ g_simple_async_result_take_error (simple, error);
+ } else if (!qmi_message_dms_get_hardware_revision_output_get_result (output, &error)) {
+ g_prefix_error (&error, "Couldn't get Hardware Revision: ");
+ g_simple_async_result_take_error (simple, error);
+ } else {
+ const gchar *str;
+
+ qmi_message_dms_get_hardware_revision_output_get_revision (output, &str, NULL);
+ g_simple_async_result_set_op_res_gpointer (simple,
+ g_strdup (str),
+ g_free);
+ }
+
+ if (output)
+ qmi_message_dms_get_hardware_revision_output_unref (output);
+
+ g_simple_async_result_complete (simple);
+ g_object_unref (simple);
+}
+
+static void
+modem_load_hardware_revision (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *result;
+ QmiClient *client = NULL;
+
+ if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
+ QMI_SERVICE_DMS, &client,
+ callback, user_data))
+ return;
+
+ result = g_simple_async_result_new (G_OBJECT (self),
+ callback,
+ user_data,
+ modem_load_hardware_revision);
+
+ mm_dbg ("loading hardware revision...");
+ qmi_client_dms_get_hardware_revision (QMI_CLIENT_DMS (client),
+ NULL,
+ 5,
+ NULL,
+ (GAsyncReadyCallback)dms_get_hardware_revision_ready,
+ result);
+}
+
+/*****************************************************************************/
/* Equipment Identifier loading (Modem interface) */
typedef struct {
@@ -11419,6 +11495,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_model_finish = modem_load_model_finish;
iface->load_revision = modem_load_revision;
iface->load_revision_finish = modem_load_revision_finish;
+ iface->load_hardware_revision = modem_load_hardware_revision;
+ iface->load_hardware_revision_finish = modem_load_hardware_revision_finish;
iface->load_equipment_identifier = modem_load_equipment_identifier;
iface->load_equipment_identifier_finish = modem_load_equipment_identifier_finish;
iface->load_device_identifier = modem_load_device_identifier;