From b9ca16486e0dafa6d3081c43fc2e8a2fbbe8864c Mon Sep 17 00:00:00 2001 From: Carlo Lobrano Date: Mon, 13 Jun 2022 13:34:10 +0200 Subject: [PATCH] telit:broadband-mbim: save MBIM originated revision into software_package_version Currently, MBIM broadband Telit modem does not store firmware revision into 'software_package_version', so it won't be possible to specialize behavior based on modem model (using mm_telit_model_from_revision). This change overloads load-revision in MBIM broadband Telit in order to call parent's loading and store the returned 'caps_firmware_info' into 'software_package_version' via mm_shared_telit_store_revision. --- plugins/telit/mm-broadband-modem-mbim-telit.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/plugins/telit/mm-broadband-modem-mbim-telit.c b/plugins/telit/mm-broadband-modem-mbim-telit.c index 62c8d087..8437c841 100644 --- a/plugins/telit/mm-broadband-modem-mbim-telit.c +++ b/plugins/telit/mm-broadband-modem-mbim-telit.c @@ -129,6 +129,51 @@ load_supported_modes (MMIfaceModem *self, task); } +/*****************************************************************************/ +/* Load revision (Modem interface) */ + +static gchar * +load_revision_finish (MMIfaceModem *self, + GAsyncResult *res, + GError **error) +{ + return g_task_propagate_pointer (G_TASK (res), error); +} + +static void +parent_load_revision_ready (MMIfaceModem *self, + GAsyncResult *res, + GTask *task) +{ + GError *error = NULL; + gchar *revision = NULL; + + revision = iface_modem_parent->load_revision_finish (self, res, &error); + if (!revision) { + g_task_return_error (task, error); + g_object_unref (task); + return; + } + mm_shared_telit_store_revision (MM_SHARED_TELIT (self), revision); + g_task_return_pointer (task, revision, g_free); + g_object_unref (task); +} + +static void +load_revision (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + /* Run parent's loading */ + /* Telit's custom revision loading (in telit/mm-shared) is AT-only and the + * MBIM modem might not have an AT port available, so we call the parent's + * load_revision and store the revision taken from the firmware info capabilities. */ + iface_modem_parent->load_revision ( + MM_IFACE_MODEM (self), + (GAsyncReadyCallback)parent_load_revision_ready, + g_task_new (self, NULL, callback, user_data)); +} + /*****************************************************************************/ MMBroadbandModemMbimTelit * @@ -175,6 +220,8 @@ iface_modem_init (MMIfaceModem *iface) iface->load_current_modes_finish = mm_shared_telit_load_current_modes_finish; iface->set_current_modes = mm_shared_telit_set_current_modes; iface->set_current_modes_finish = mm_shared_telit_set_current_modes_finish; + iface->load_revision_finish = load_revision_finish; + iface->load_revision = load_revision; } static MMIfaceModem *