telit: override load revision

Currently, firmware revision string is obtained via AT+CGMR or AT+GMR
commands from the default mm-broadband-modem. For a class of Telit
modems however this command does not return the actual Telit Software
Package version, but the "Modem FW Version", which is only a component
of the whole firmware. For this class of modems, the correct string is
obtained with "AT#SWPKGV" command.

This change overrides load_revision* functions to add the ability to
parse "AT#SWPKGV" command for the modems that support it, and falls back
to the same logic that was implemented in mm-broadband-modem otherwise.
This commit is contained in:
Carlo Lobrano
2022-03-29 14:18:55 +00:00
committed by Aleksander Morgado
parent afd3ce86c9
commit 3df96a4255
6 changed files with 175 additions and 0 deletions
@@ -611,6 +611,33 @@ test_telit_parse_qss_query (void)
}
}
static void
test_telit_parse_swpkgv_response (void)
{
static struct {
const gchar *response;
const gchar *expected;
} tt [] = {
{"\n\r12.34.567\n\rM0F.223004-B001\n\rP0F.224700\n\rA0F.223004-B001\n\r\n\rOK\n\r", "12.34.567"},
{"\n\r13.35.568-A123\n\rM0F.223004-B001\n\rP0F.224700\n\rA0F.223004-B001\n\r\n\rOK\n\r", "13.35.568-A123"},
{"\n\r14.36.569-B124\n\rM0F.223004-B001\n\rP0F.224700\n\rA0F.223004-B001\n\r\n\rOK\n\r", "14.36.569-B124"},
{"\n\r15.37.570-T125\n\rM0F.223004-B001\n\rP0F.224700\n\rA0F.223004-B001\n\r\n\rOK\n\r", "15.37.570-T125"},
{"\n\r16.38.571-P0F.224700\n\rM0F.223004-B001\n\rP0F.224700\n\rA0F.223004-B001\n\r\n\rOK\n\r", "16.38.571-P0F.224700"},
/* real example from LE910C1-EUX */
{"\n\r25.30.224-B001-P0F.224700\n\rM0F.223004-B001\n\rP0F.224700\n\rA0F.223004-B001\n\r\n\rOK\n\r", "25.30.224-B001-P0F.224700"},
};
guint i;
for (i = 0; i < G_N_ELEMENTS (tt); i++) {
gchar *actual = NULL;
actual = mm_telit_parse_swpkgv_response(tt[i].response);
g_assert_cmpstr (tt[i].expected, ==, actual);
g_free (actual);
}
}
/******************************************************************************/
int main (int argc, char **argv)
@@ -625,5 +652,6 @@ int main (int argc, char **argv)
g_test_add_func ("/MM/telit/bands/current/set_bands/3g", test_telit_get_3g_bnd_flag);
g_test_add_func ("/MM/telit/bands/current/set_bands/4g", test_telit_get_4g_bnd_flag);
g_test_add_func ("/MM/telit/qss/query", test_telit_parse_qss_query);
g_test_add_func ("/MM/telit/swpkv/parse_response", test_telit_parse_swpkgv_response);
return g_test_run ();
}