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.
This commit is contained in:
Aleksander Morgado
2019-01-02 10:40:08 +01:00
parent 278a72643a
commit 0f6f89801e

View File

@@ -1192,26 +1192,38 @@ append_bands (GArray *bands,
if (mode & MM_MODEM_MODE_2G) { if (mode & MM_MODEM_MODE_2G) {
band = num_to_band_2g (ubandsel_value); band = num_to_band_2g (ubandsel_value);
if (band != MM_MODEM_BAND_UNKNOWN) 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); g_array_append_val (bands, band);
break;
}
}
}
} }
if (mode & MM_MODEM_MODE_3G) { if (mode & MM_MODEM_MODE_3G) {
band = num_to_band_3g (ubandsel_value); band = num_to_band_3g (ubandsel_value);
if (band != MM_MODEM_BAND_UNKNOWN) 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); g_array_append_val (bands, band);
break;
}
}
}
} }
/* Note: The weird code segment below is to separate out specific LTE bands since /* 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. * UBANDSEL? reports back the frequency of the band and not the band itself.
*/ */
band = MM_MODEM_BAND_UNKNOWN;
if (mode & MM_MODEM_MODE_4G) { if (mode & MM_MODEM_MODE_4G) {
for (j = 0; j < G_N_ELEMENTS (num_bands_4g); j++) { for (j = 0; j < G_N_ELEMENTS (num_bands_4g); j++) {
if (ubandsel_value == num_bands_4g[j].num) { if (ubandsel_value == num_bands_4g[j].num) {
for (k = 0; k < G_N_ELEMENTS (num_bands_4g[j].band); k++) { for (k = 0; k < G_N_ELEMENTS (num_bands_4g[j].band); k++) {
band = num_bands_4g[j].band[k]; band = num_bands_4g[j].band[k];
if (band != MM_MODEM_BAND_UNKNOWN) {
for (x = 0; x < G_N_ELEMENTS (band_configuration[i].bands_4g); x++) { for (x = 0; x < G_N_ELEMENTS (band_configuration[i].bands_4g); x++) {
if (band_configuration[i].bands_4g[x] == band) { if (band_configuration[i].bands_4g[x] == band) {
g_array_append_val (bands, band); g_array_append_val (bands, band);
@@ -1219,6 +1231,7 @@ append_bands (GArray *bands,
} }
} }
} }
}
break; break;
} }
} }