diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2014-02-27 11:32:05 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-02-28 16:37:32 +0100 |
commit | f2024b78b297079c61f51d1a7f6cd73611bc7de2 (patch) | |
tree | af429f3427f6ba9330ba824ad5191a61997fb89e /plugins/cinterion/mm-modem-helpers-cinterion.c | |
parent | c1e2a3a5bc686f310a705724e806d058f3cee68c (diff) |
cinterion: consolidate setting current bands in 2G and 3G devices
Diffstat (limited to 'plugins/cinterion/mm-modem-helpers-cinterion.c')
-rw-r--r-- | plugins/cinterion/mm-modem-helpers-cinterion.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.c b/plugins/cinterion/mm-modem-helpers-cinterion.c index a7d1b86d..97eb7115 100644 --- a/plugins/cinterion/mm-modem-helpers-cinterion.c +++ b/plugins/cinterion/mm-modem-helpers-cinterion.c @@ -48,6 +48,18 @@ static const CinterionBand cinterion_bands[] = { { (1 << 8), MM_MODEM_BAND_U800 } }; +/* Check valid combinations in 2G-only devices */ +#define VALIDATE_2G_BAND(cinterion_mask) \ + (cinterion_mask == 1 || \ + cinterion_mask == 2 || \ + cinterion_mask == 4 || \ + cinterion_mask == 8 || \ + cinterion_mask == 3 || \ + cinterion_mask == 5 || \ + cinterion_mask == 10 || \ + cinterion_mask == 12 || \ + cinterion_mask == 15) + /*****************************************************************************/ /* ^SCFG (3G) test parser * @@ -228,6 +240,7 @@ mm_cinterion_parse_scfg_response (const gchar *response, gboolean mm_cinterion_build_band (GArray *bands, guint supported, + gboolean only_2g, guint *out_band, GError **error) { @@ -249,6 +262,12 @@ mm_cinterion_build_band (GArray *bands, } } } + + /* 2G-only modems only support a subset of the possible band + * combinations. Detect it early and error out. + */ + if (only_2g && !VALIDATE_2G_BAND (band)) + band = 0; } if (band == 0) { |