diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-01-02 10:40:08 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-01-30 12:10:03 +0100 |
commit | 0f6f89801e6bac35e1dbcc2df06265a078b923cc (patch) | |
tree | 945ad238ddb305ef7ddf01127636fe6099059ec2 | |
parent | 278a72643aaf8e05925b14560b4e48818a4b36a7 (diff) | |
download | ModemManager-0f6f89801e6bac35e1dbcc2df06265a078b923cc.tar.gz |
ublox: fix parser to report only bands supported by the module
We were filtering the 4G bands supported by the module when parsing
+UBANDSEL responses, e.g. so that we would not reply unsupported bands
for a given ubandsel value.
But we need the same filtering in 2G and 3G bands, because for example
some modules may support a specific 4G band with a given ubandsel
value, but NOT the associated 3G band. E.g. the TOBY-R200 supports
EUTRAN-4 but not UTRAN-4.
-rw-r--r-- | plugins/ublox/mm-modem-helpers-ublox.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/plugins/ublox/mm-modem-helpers-ublox.c b/plugins/ublox/mm-modem-helpers-ublox.c index ef84dc9fd..f6bd1c773 100644 --- a/plugins/ublox/mm-modem-helpers-ublox.c +++ b/plugins/ublox/mm-modem-helpers-ublox.c @@ -1192,30 +1192,43 @@ append_bands (GArray *bands, if (mode & MM_MODEM_MODE_2G) { band = num_to_band_2g (ubandsel_value); - if (band != MM_MODEM_BAND_UNKNOWN) - g_array_append_val (bands, band); + if (band != MM_MODEM_BAND_UNKNOWN) { + for (x = 0; x < G_N_ELEMENTS (band_configuration[i].bands_2g); x++) { + if (band_configuration[i].bands_2g[x] == band) { + g_array_append_val (bands, band); + break; + } + } + } } if (mode & MM_MODEM_MODE_3G) { band = num_to_band_3g (ubandsel_value); - if (band != MM_MODEM_BAND_UNKNOWN) - g_array_append_val (bands, band); + if (band != MM_MODEM_BAND_UNKNOWN) { + for (x = 0; x < G_N_ELEMENTS (band_configuration[i].bands_3g); x++) { + if (band_configuration[i].bands_3g[x] == band) { + g_array_append_val (bands, band); + break; + } + } + } } /* Note: The weird code segment below is to separate out specific LTE bands since * UBANDSEL? reports back the frequency of the band and not the band itself. */ - band = MM_MODEM_BAND_UNKNOWN; if (mode & MM_MODEM_MODE_4G) { for (j = 0; j < G_N_ELEMENTS (num_bands_4g); j++) { if (ubandsel_value == num_bands_4g[j].num) { for (k = 0; k < G_N_ELEMENTS (num_bands_4g[j].band); k++) { band = num_bands_4g[j].band[k]; - for (x = 0; x < G_N_ELEMENTS (band_configuration[i].bands_4g); x++) { - if (band_configuration[i].bands_4g[x] == band) { - g_array_append_val (bands, band); - break; + if (band != MM_MODEM_BAND_UNKNOWN) { + for (x = 0; x < G_N_ELEMENTS (band_configuration[i].bands_4g); x++) { + if (band_configuration[i].bands_4g[x] == band) { + g_array_append_val (bands, band); + break; + } } } } |