diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-28 16:36:37 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-28 17:15:18 +0200 |
commit | 8225dec907adaca45eb7c2c1c8205401499e3d1d (patch) | |
tree | 1c5915065599c97e895b8931c67c3ac8f7668c91 /src | |
parent | 9dbf9a8d0ec50be69b2b0f09634f12e04a4efd15 (diff) |
iface-modem: supported bands may be reported as UNKNOWN if couldn't be loaded
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 04c95be0..da2371a6 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -1592,19 +1592,26 @@ mm_iface_modem_set_bands (MMIfaceModem *self, if (bands_array->len == 1 && g_array_index (bands_array, MMModemBand, 0) == MM_MODEM_BAND_ANY) { guint i; - ctx->bands_array = g_array_sized_new (FALSE, - FALSE, - sizeof (MMModemBand), - supported_bands_array->len); + for (i = 0; i < supported_bands_array->len; i++) { MMModemBand band = g_array_index (supported_bands_array, MMModemBand, i); - if (band != MM_MODEM_BAND_ANY) + + if (band != MM_MODEM_BAND_ANY && + band != MM_MODEM_BAND_UNKNOWN) { + if (!ctx->bands_array) + ctx->bands_array = g_array_sized_new (FALSE, + FALSE, + sizeof (MMModemBand), + supported_bands_array->len); + g_array_insert_val (ctx->bands_array, i, band); + } } - } else { - ctx->bands_array = g_array_ref (bands_array); } + if (!ctx->bands_array) + ctx->bands_array = g_array_ref (bands_array); + /* Simply return if target list of bands equals to current list of bands */ current_bands_array = (mm_common_bands_variant_to_garray ( mm_gdbus_modem_get_bands (ctx->skeleton))); |