aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Palmas <dnlplm@gmail.com>2022-12-28 16:10:54 +0100
committerDaniele Palmas <dnlplm@gmail.com>2023-01-30 16:00:45 +0100
commit6748fb7c2c3e1935c581eb0a0f50e2f30fd6235e (patch)
tree9519f894ae8cc3eb3713c586efe0372a290c5005
parenta9e841e9316740545686fb0d41cbc71708b4b506 (diff)
telit: fallback to AT commands in case of MBIM loading revision failure
Some firmware versions return an empty string for the revision when using the device caps MBIM request, so use AT commands as a fallback in case this happens.
-rw-r--r--src/plugins/telit/mm-broadband-modem-mbim-telit.c28
-rw-r--r--src/plugins/telit/tests/test-mm-modem-helpers-telit.c1
2 files changed, 27 insertions, 2 deletions
diff --git a/src/plugins/telit/mm-broadband-modem-mbim-telit.c b/src/plugins/telit/mm-broadband-modem-mbim-telit.c
index 8437c841..d14dd94a 100644
--- a/src/plugins/telit/mm-broadband-modem-mbim-telit.c
+++ b/src/plugins/telit/mm-broadband-modem-mbim-telit.c
@@ -141,15 +141,16 @@ load_revision_finish (MMIfaceModem *self,
}
static void
-parent_load_revision_ready (MMIfaceModem *self,
+load_revision_ready_shared (MMIfaceModem *self,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
gchar *revision = NULL;
- revision = iface_modem_parent->load_revision_finish (self, res, &error);
+ revision = mm_shared_telit_modem_load_revision_finish (self, res, &error);
if (!revision) {
+ /* give up */
g_task_return_error (task, error);
g_object_unref (task);
return;
@@ -160,6 +161,29 @@ parent_load_revision_ready (MMIfaceModem *self,
}
static void
+parent_load_revision_ready (MMIfaceModem *self,
+ GAsyncResult *res,
+ GTask *task)
+{
+ gchar *revision = NULL;
+
+ revision = iface_modem_parent->load_revision_finish (self, res, NULL);
+ if (!revision || !strlen (revision)) {
+ /* Some firmware versions do not properly populate the revision in the
+ * MBIM response, so try using the AT ports */
+ g_free (revision);
+ mm_shared_telit_modem_load_revision (
+ self,
+ (GAsyncReadyCallback)load_revision_ready_shared,
+ 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)
diff --git a/src/plugins/telit/tests/test-mm-modem-helpers-telit.c b/src/plugins/telit/tests/test-mm-modem-helpers-telit.c
index e14ba6ba..b17a01f7 100644
--- a/src/plugins/telit/tests/test-mm-modem-helpers-telit.c
+++ b/src/plugins/telit/tests/test-mm-modem-helpers-telit.c
@@ -633,6 +633,7 @@ test_telit_parse_swpkgv_response (void)
{"\r\n16.38.571-P0F.224700\r\nM0F.223004-B001\r\nP0F.224700\r\nA0F.223004-B001\r\n\r\nOK\r\n", "16.38.571-P0F.224700"},
/* real example from LE910C1-EUX */
{"\r\n25.30.224-B001-P0F.224700\r\nM0F.223004-B001\r\nP0F.224700\r\nA0F.223004-B001\r\n\r\nOK\r\n", "25.30.224-B001-P0F.224700"},
+ {"\r\n45.00.010-B022-P0R.001600\r\nM0R.010000-B022\r\nP0R.001600\r\nA0R.000000-B022\r\n\r\nOK\r\n", "45.00.010-B022-P0R.001600"},
};
guint i;