diff options
author | Mark-Jablonsky <mjablonsky1@gmail.com> | 2018-11-28 13:28:00 -0600 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-01-30 12:10:03 +0100 |
commit | c1aa658802940327369a6a4cc50d35a4a6a9b04e (patch) | |
tree | 43da81f94f2855020620a86710016f65c3450328 /plugins/ublox/tests/test-modem-helpers-ublox.c | |
parent | 2d80dbfbfedbb849dad09981f253d788aac9e5cd (diff) |
ublox: add band detection support for additional modems
The u-blox plugin was originally written to support the TOBY-L4 only.
This caused issues with mmcli reporting the correct supported and
current bands because the logic was based only for the TOBY-L4 and
the AT commands used in the implementaion are only supported by
a couple of modems.
There is now a hard-coded modem list that contains the supported bands
and the supported modes. A hard-coded list was chosen over a logic
based list because ublox modems only report the frequency of the bands
they support in the current mode they are in. For further justification,
the reported frequency could relate to multiple bands that are not all
supported by the modem, and not all the supported bands are always caught
depending on the mode the modem is in (e.g. 2G, 3G, 4G). The only
realiable way to retrieve the correct supported bands is to have the list
hard-coded. Based off of the modem, the code chooses whether it is
appropriate to issue +UACT or +UBANDSEL to retrieve the current bands list.
Additionally, the appropriate AT command of +CFUN=4 or +COPS=2 is chosen
to detach from the network when the mmcli --set-current-bands command is
issued. The new setup also adds a header file that contains the modem list.
This should make adding support for future additional modems easier as long
as future modems stick to the same AT command interface that is currently
supported by the plugin.
Diffstat (limited to 'plugins/ublox/tests/test-modem-helpers-ublox.c')
-rw-r--r-- | plugins/ublox/tests/test-modem-helpers-ublox.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/plugins/ublox/tests/test-modem-helpers-ublox.c b/plugins/ublox/tests/test-modem-helpers-ublox.c index e8b19220..4ba61c22 100644 --- a/plugins/ublox/tests/test-modem-helpers-ublox.c +++ b/plugins/ublox/tests/test-modem-helpers-ublox.c @@ -616,12 +616,13 @@ test_supported_bands_sara_u280 (void) static void common_validate_ubandsel_response (const gchar *str, const MMModemBand *expected_bands, + const gchar *model, guint n_expected_bands) { GError *error = NULL; GArray *bands; - bands = mm_ublox_parse_ubandsel_response (str, &error); + bands = mm_ublox_parse_ubandsel_response (str, model, &error); g_assert_no_error (error); g_assert (bands); @@ -632,36 +633,38 @@ static void test_ubandsel_response_four (void) { const MMModemBand expected_bands[] = { - /* 850 */ MM_MODEM_BAND_G850, MM_MODEM_BAND_UTRAN_5, MM_MODEM_BAND_EUTRAN_5, - /* 900 */ MM_MODEM_BAND_EGSM, MM_MODEM_BAND_UTRAN_8, MM_MODEM_BAND_EUTRAN_8, - /* 1800 */ MM_MODEM_BAND_DCS, MM_MODEM_BAND_UTRAN_3, MM_MODEM_BAND_EUTRAN_3, - /* 1900 */ MM_MODEM_BAND_PCS, MM_MODEM_BAND_UTRAN_2, MM_MODEM_BAND_EUTRAN_2, + /* 700 */ MM_MODEM_BAND_EUTRAN_4, + /* 1700 */ MM_MODEM_BAND_EUTRAN_13 }; - common_validate_ubandsel_response ("+UBANDSEL: 850,900,1800,1900\r\n", expected_bands, G_N_ELEMENTS (expected_bands)); + common_validate_ubandsel_response ("+UBANDSEL: 700,1700\r\n", expected_bands, "LARA-R204", G_N_ELEMENTS (expected_bands)); } static void test_ubandsel_response_three (void) { const MMModemBand expected_bands[] = { - /* 850 */ MM_MODEM_BAND_G850, MM_MODEM_BAND_UTRAN_5, MM_MODEM_BAND_EUTRAN_5, - /* 900 */ MM_MODEM_BAND_EGSM, MM_MODEM_BAND_UTRAN_8, MM_MODEM_BAND_EUTRAN_8, - /* 1800 */ MM_MODEM_BAND_DCS, MM_MODEM_BAND_UTRAN_3, MM_MODEM_BAND_EUTRAN_3, + /* 800 */ MM_MODEM_BAND_UTRAN_6, + /* 850 */ MM_MODEM_BAND_G850, MM_MODEM_BAND_UTRAN_5, + /* 900 */ MM_MODEM_BAND_EGSM, MM_MODEM_BAND_UTRAN_8, + /* 1900 */ MM_MODEM_BAND_PCS, MM_MODEM_BAND_UTRAN_2, + /* 2100 */ MM_MODEM_BAND_UTRAN_1 }; - common_validate_ubandsel_response ("+UBANDSEL: 850,900,1800\r\n", expected_bands, G_N_ELEMENTS (expected_bands)); + common_validate_ubandsel_response ("+UBANDSEL: 800,850,900,1900,2100\r\n", expected_bands, "SARA-U201", G_N_ELEMENTS (expected_bands)); } static void test_ubandsel_response_two (void) { const MMModemBand expected_bands[] = { - /* 850 */ MM_MODEM_BAND_G850, MM_MODEM_BAND_UTRAN_5, MM_MODEM_BAND_EUTRAN_5, - /* 900 */ MM_MODEM_BAND_EGSM, MM_MODEM_BAND_UTRAN_8, MM_MODEM_BAND_EUTRAN_8, + /* 850 */ MM_MODEM_BAND_G850, + /* 900 */ MM_MODEM_BAND_EGSM, + /* 1800 */ MM_MODEM_BAND_DCS, + /* 1900 */ MM_MODEM_BAND_PCS }; - common_validate_ubandsel_response ("+UBANDSEL: 850,900\r\n", expected_bands, G_N_ELEMENTS (expected_bands)); + common_validate_ubandsel_response ("+UBANDSEL: 850,900,1800,1900\r\n", expected_bands, "SARA-G310", G_N_ELEMENTS (expected_bands)); } static void @@ -669,9 +672,11 @@ test_ubandsel_response_one (void) { const MMModemBand expected_bands[] = { /* 850 */ MM_MODEM_BAND_G850, MM_MODEM_BAND_UTRAN_5, MM_MODEM_BAND_EUTRAN_5, + /* 1700 */ MM_MODEM_BAND_EUTRAN_4, + /* 1900 */ MM_MODEM_BAND_UTRAN_2, MM_MODEM_BAND_EUTRAN_2 }; - common_validate_ubandsel_response ("+UBANDSEL: 850\r\n", expected_bands, G_N_ELEMENTS (expected_bands)); + common_validate_ubandsel_response ("+UBANDSEL: 850,1700,1900\r\n", expected_bands, "TOBY-R200", G_N_ELEMENTS (expected_bands)); } /*****************************************************************************/ @@ -680,6 +685,7 @@ test_ubandsel_response_one (void) static void common_validate_ubandsel_request (const MMModemBand *bands, guint n_bands, + const gchar *model, const gchar *expected_request) { GError *error = NULL; @@ -689,7 +695,7 @@ common_validate_ubandsel_request (const MMModemBand *bands, bands_array = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), n_bands); g_array_append_vals (bands_array, bands, n_bands); - request = mm_ublox_build_ubandsel_set_command (bands_array, &error); + request = mm_ublox_build_ubandsel_set_command (bands_array, model, &error); g_assert_no_error (error); g_assert (request); @@ -706,7 +712,7 @@ test_ubandsel_request_any (void) MM_MODEM_BAND_ANY }; - common_validate_ubandsel_request (bands, G_N_ELEMENTS (bands), "+UBANDSEL=0"); + common_validate_ubandsel_request (bands, G_N_ELEMENTS (bands), "TOBY-R200", "+UBANDSEL=0"); } static void @@ -716,7 +722,7 @@ test_ubandsel_request_2g (void) MM_MODEM_BAND_G850, MM_MODEM_BAND_EGSM, MM_MODEM_BAND_DCS, MM_MODEM_BAND_PCS }; - common_validate_ubandsel_request (bands, G_N_ELEMENTS (bands), "+UBANDSEL=850,900,1800,1900"); + common_validate_ubandsel_request (bands, G_N_ELEMENTS (bands), "SARA-G310", "+UBANDSEL=850,900,1800,1900"); } static void @@ -726,7 +732,7 @@ test_ubandsel_request_1800 (void) MM_MODEM_BAND_DCS, MM_MODEM_BAND_UTRAN_3, MM_MODEM_BAND_EUTRAN_3 }; - common_validate_ubandsel_request (bands, G_N_ELEMENTS (bands), "+UBANDSEL=1800"); + common_validate_ubandsel_request (bands, G_N_ELEMENTS (bands), "TOBY-R200", "+UBANDSEL=1800"); } /*****************************************************************************/ |