diff options
-rw-r--r-- | plugins/telit/77-mm-telit-port-types.rules | 4 | ||||
-rw-r--r-- | plugins/telit/mm-modem-helpers-telit.c | 14 | ||||
-rw-r--r-- | plugins/telit/mm-modem-helpers-telit.h | 2 | ||||
-rw-r--r-- | plugins/telit/mm-shared-telit.c | 24 | ||||
-rw-r--r-- | plugins/telit/tests/test-mm-modem-helpers-telit.c | 4 |
5 files changed, 20 insertions, 28 deletions
diff --git a/plugins/telit/77-mm-telit-port-types.rules b/plugins/telit/77-mm-telit-port-types.rules index 01a44613..18c270a5 100644 --- a/plugins/telit/77-mm-telit-port-types.rules +++ b/plugins/telit/77-mm-telit-port-types.rules @@ -107,10 +107,6 @@ ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1051", ENV{ID_MM_TELIT_BND_ALTERNATE ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1060", ENV{ID_MM_TELIT_BND_ALTERNATE}="1" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1061", ENV{ID_MM_TELIT_BND_ALTERNATE}="1" -# LN920 use extended 4G bands and 4G bands configured as hex mask -ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1060", ENV{ID_MM_TELIT_BND_EXT}="1" -ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1061", ENV{ID_MM_TELIT_BND_EXT}="1" - # LM940/960 initial port delay ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1040", ENV{ID_MM_TELIT_PORT_DELAY}="1" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1041", ENV{ID_MM_TELIT_PORT_DELAY}="1" diff --git a/plugins/telit/mm-modem-helpers-telit.c b/plugins/telit/mm-modem-helpers-telit.c index 1d6b5194..d163bf1f 100644 --- a/plugins/telit/mm-modem-helpers-telit.c +++ b/plugins/telit/mm-modem-helpers-telit.c @@ -658,6 +658,15 @@ typedef enum { LOAD_BANDS_TYPE_CURRENT, } LoadBandsType; +static gboolean +bnd_response_has_ext_4g_bands (const gchar *response) +{ + g_auto(GStrv) tokens = NULL; + + tokens = mm_split_string_groups (response); + return g_strv_length (tokens) == 4; +} + static GArray * common_parse_bnd_response (const gchar *response, gboolean modem_is_2g, @@ -756,14 +765,15 @@ mm_telit_parse_bnd_test_response (const gchar *response, gboolean modem_is_3g, gboolean modem_is_4g, gboolean modem_alternate_3g_bands, - gboolean modem_ext_4g_bands, + gboolean *modem_ext_4g_bands, gpointer log_object, GError **error) { + *modem_ext_4g_bands = bnd_response_has_ext_4g_bands (response); return common_parse_bnd_response (response, modem_is_2g, modem_is_3g, modem_is_4g, modem_alternate_3g_bands, - modem_ext_4g_bands, + *modem_ext_4g_bands, LOAD_BANDS_TYPE_SUPPORTED, log_object, error); diff --git a/plugins/telit/mm-modem-helpers-telit.h b/plugins/telit/mm-modem-helpers-telit.h index 6710f4c1..718bb60d 100644 --- a/plugins/telit/mm-modem-helpers-telit.h +++ b/plugins/telit/mm-modem-helpers-telit.h @@ -33,7 +33,7 @@ GArray *mm_telit_parse_bnd_test_response (const gchar *response, gboolean modem_is_3g, gboolean modem_is_4g, gboolean modem_alternate_3g_bands, - gboolean modem_ext_4g_bands, + gboolean *modem_ext_4g_bands, gpointer log_object, GError **error); gchar *mm_telit_build_bnd_request (GArray *bands_array, diff --git a/plugins/telit/mm-shared-telit.c b/plugins/telit/mm-shared-telit.c index e391746e..91d04ec2 100644 --- a/plugins/telit/mm-shared-telit.c +++ b/plugins/telit/mm-shared-telit.c @@ -69,24 +69,6 @@ initialize_alternate_3g_band (MMSharedTelit *self, } } -static void -initialize_ext_4g_band (MMSharedTelit *self, - Private *priv) -{ - MMPort *primary; - MMKernelDevice *port; - - primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self))); - if (primary) { - port = mm_port_peek_kernel_device (primary); - - /* Lookup for the tag specifying that we're using the ext 4G band mapping */ - priv->ext_4g_bands = mm_kernel_device_get_global_property_as_boolean (port, "ID_MM_TELIT_BND_EXT"); - if (priv->ext_4g_bands) - mm_obj_dbg (self, "telit modem using extended 4G band setup"); - } -} - static Private * get_private (MMSharedTelit *self) { @@ -99,7 +81,7 @@ get_private (MMSharedTelit *self) if (!priv) { priv = g_slice_new0 (Private); initialize_alternate_3g_band (self, priv); - initialize_ext_4g_band (self, priv); + /* ext_4g_bands field is initialized inside #BND=? response handler */ g_object_set_qdata_full (G_OBJECT (self), private_quark, priv, (GDestroyNotify)private_free); } @@ -219,7 +201,7 @@ mm_shared_telit_load_supported_bands_ready (MMBaseModem *self, mm_iface_modem_is_3g (MM_IFACE_MODEM (self)), mm_iface_modem_is_4g (MM_IFACE_MODEM (self)), priv->alternate_3g_bands, - priv->ext_4g_bands, + &priv->ext_4g_bands, self, &error); if (!bands) @@ -227,6 +209,8 @@ mm_shared_telit_load_supported_bands_ready (MMBaseModem *self, else { /* Store supported bands to be able to build ANY when setting */ priv->supported_bands = g_array_ref (bands); + if (priv->ext_4g_bands) + mm_obj_dbg (self, "telit modem using extended 4G band setup"); g_task_return_pointer (task, bands, (GDestroyNotify)g_array_unref); } } diff --git a/plugins/telit/tests/test-mm-modem-helpers-telit.c b/plugins/telit/tests/test-mm-modem-helpers-telit.c index 16cd776e..e957f7d6 100644 --- a/plugins/telit/tests/test-mm-modem-helpers-telit.c +++ b/plugins/telit/tests/test-mm-modem-helpers-telit.c @@ -182,17 +182,19 @@ test_parse_supported_bands_response (void) for (i = 0; i < G_N_ELEMENTS (supported_band_mapping_tests); i++) { GError *error = NULL; GArray *bands = NULL; + gboolean modem_ext_4g_bands; bands = mm_telit_parse_bnd_test_response (supported_band_mapping_tests[i].response, supported_band_mapping_tests[i].modem_is_2g, supported_band_mapping_tests[i].modem_is_3g, supported_band_mapping_tests[i].modem_is_4g, supported_band_mapping_tests[i].modem_alternate_3g_bands, - supported_band_mapping_tests[i].modem_ext_4g_bands, + &modem_ext_4g_bands, NULL, &error); g_assert_no_error (error); g_assert (bands); + g_assert (supported_band_mapping_tests[i].modem_ext_4g_bands == modem_ext_4g_bands); mm_test_helpers_compare_bands (bands, supported_band_mapping_tests[i].mm_bands, |