Merge request !1461 from 'dp/fix-me310g1-bnd'
ME910G1 and ME310M1 bands support and fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1461
This commit is contained in:
@@ -207,6 +207,7 @@ mm_telit_build_bnd_request (GArray *bands_array,
|
||||
gint flag2g = -1;
|
||||
gint64 flag3g = -1;
|
||||
gint64 flag4g = -1;
|
||||
gint64 flag4gext = -1;
|
||||
gchar *cmd;
|
||||
gboolean modem_is_2g = config->modem_is_2g;
|
||||
gboolean modem_is_3g = config->modem_is_3g;
|
||||
@@ -291,9 +292,8 @@ mm_telit_build_bnd_request (GArray *bands_array,
|
||||
|
||||
/* Get 4G-specific telit band bitmask */
|
||||
flag4g = (mask4g != 0) ? ((gint64)mask4g) : -1;
|
||||
flag4gext = (mask4gext != 0) ? ((gint64)mask4gext) : -1;
|
||||
|
||||
/* If the modem supports a given access tech, we must always give band settings
|
||||
* for the specific tech */
|
||||
if (modem_is_2g && flag2g == -1) {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
|
||||
"None or invalid 2G bands combination in the provided list");
|
||||
@@ -304,12 +304,19 @@ mm_telit_build_bnd_request (GArray *bands_array,
|
||||
"None or invalid 3G bands combination in the provided list");
|
||||
return NULL;
|
||||
}
|
||||
if (modem_is_4g && mask4g == 0 && mask4gext == 0) {
|
||||
/* At least one technology must have valid bands */
|
||||
if (flag2g == -1 && flag3g == -1 && flag4g == -1 && flag4gext == -1) {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
|
||||
"None or invalid 4G bands combination in the provided list");
|
||||
"No valid bands combination in the provided list");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 4g bands could be disabled */
|
||||
if (modem_is_4g && flag4g == -1)
|
||||
flag4g = 0;
|
||||
if (config->modem_ext_4g_bands && flag4gext == -1)
|
||||
flag4gext = 0;
|
||||
|
||||
if (modem_is_2g && !modem_is_3g && !modem_is_4g)
|
||||
cmd = g_strdup_printf ("#BND=%d", flag2g);
|
||||
else if (!modem_is_2g && modem_is_3g && !modem_is_4g)
|
||||
@@ -318,24 +325,72 @@ mm_telit_build_bnd_request (GArray *bands_array,
|
||||
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT, flag2g, flag3g);
|
||||
else if (!modem_is_2g && !modem_is_3g && modem_is_4g) {
|
||||
if (!config->modem_ext_4g_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_MODIFIER "x", mask4g);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_FORMAT, flag4g);
|
||||
else
|
||||
if (config->modem_has_tdscdma_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_MODIFIER "x" ",0,%" G_GINT64_MODIFIER "x", mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_FORMAT ",0,%" G_GINT64_FORMAT, flag4g, flag4gext);
|
||||
else
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag4g, flag4gext);
|
||||
} else if (!modem_is_2g && modem_is_3g && modem_is_4g) {
|
||||
if (!config->modem_ext_4g_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x", flag3g, mask4g);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag3g, flag4g);
|
||||
else
|
||||
if (config->modem_has_tdscdma_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x" ",0,%" G_GINT64_MODIFIER "x", flag3g, mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT ",0,%" G_GINT64_FORMAT, flag3g, flag4g, flag4gext);
|
||||
else
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", flag3g, mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag3g, flag4g, flag4gext);
|
||||
} else if (modem_is_2g && !modem_is_3g && modem_is_4g) {
|
||||
if (!config->modem_ext_4g_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_MODIFIER "x", flag2g, mask4g);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_FORMAT, flag2g, flag4g);
|
||||
else
|
||||
if (config->modem_has_tdscdma_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_MODIFIER "x" ",0,%" G_GINT64_MODIFIER "x", flag2g, mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_FORMAT ",0,%" G_GINT64_FORMAT, flag2g, flag4g, flag4gext);
|
||||
else
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", flag2g, mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag2g, flag4g, flag4gext);
|
||||
} else if (modem_is_2g && modem_is_3g && modem_is_4g) {
|
||||
if (!config->modem_ext_4g_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x", flag2g, flag3g, mask4g);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag2g, flag3g, flag4g);
|
||||
else
|
||||
if (config->modem_has_tdscdma_bands)
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x" ",0,%" G_GINT64_MODIFIER "x", flag2g, flag3g, mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT ",0,%" G_GINT64_FORMAT, flag2g, flag3g, flag4g, flag4gext);
|
||||
else
|
||||
if (config->modem_has_hex_format_4g_bands)
|
||||
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", flag2g, flag3g, mask4g, mask4gext);
|
||||
else
|
||||
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag2g, flag3g, flag4g, flag4gext);
|
||||
} else
|
||||
g_assert_not_reached ();
|
||||
|
||||
@@ -435,6 +490,46 @@ mm_telit_build_bnd_request (GArray *bands_array,
|
||||
* AT#BND?
|
||||
* #BND: 0,18,87A03B0F38DF,42
|
||||
*
|
||||
* ----------------
|
||||
*
|
||||
* Modems like ME910G1 and ME910M1 have yet another #BND configuration/response:
|
||||
*
|
||||
* AT#BND=<GSM_band>[,<UMTS_band>[,<LTE_band>[,<TDSCDMA_band>[,<LTE_band_ext>]]]]
|
||||
*
|
||||
* <LTE_band>: decimal: Indicates the LTE supported bands expressed as the sum of Band number (1+2+8 ...) calculated as shown in the table (mask of 32 bits):
|
||||
*
|
||||
* Band number(Decimal) Band i
|
||||
* 0 disable
|
||||
* 1 B1
|
||||
* 2 B2
|
||||
* 4 B3
|
||||
* 8 B4
|
||||
* ...
|
||||
* 2147483648 B32
|
||||
*
|
||||
* It can take value, 0 - 4294967295: range of the sum of Band number (1+2+4 ...)
|
||||
*
|
||||
* <TDSCDMA_band>: used just for backward compatibility with older models, it is always 0
|
||||
*
|
||||
* <LTE_band_ext>: decimal: Indicates the LTE supported bands from B65 expressed as the sum of Band number (1+2+8 ...) calculated as shown in the table (mask of 32 bits):
|
||||
*
|
||||
* Band number(Decimal) Band i
|
||||
* 0 disable
|
||||
* 1 B65
|
||||
* 2 B66
|
||||
* ...
|
||||
* (2exp(i-64-1)) B(i)
|
||||
*
|
||||
* It can take value, 0 - 4294967295: range of the sum of Band number (1+2+4 ...)
|
||||
*
|
||||
* Example output:
|
||||
*
|
||||
* AT#BND=?
|
||||
* #BND: (0-5),(0),(1-252582047),(0),(0,2-1048578)
|
||||
*
|
||||
* AT#BND?
|
||||
* #BND: 0,0,252582047,0,1048578
|
||||
*
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
@@ -614,19 +709,33 @@ telit_get_ext_4g_mm_bands (GMatchInfo *match_info,
|
||||
GError *inner_error = NULL;
|
||||
MMModemBand band;
|
||||
gchar *match_str = NULL;
|
||||
gchar *match_str_ext = NULL;
|
||||
gchar *match_str_ext_hex = NULL;
|
||||
guint64 value;
|
||||
g_auto(GStrv) tokens = NULL;
|
||||
gboolean hex_format = FALSE;
|
||||
gboolean ok;
|
||||
|
||||
match_str = g_match_info_fetch_named (match_info, "Bands4GDec");
|
||||
if (!match_str) {
|
||||
match_str = g_match_info_fetch_named (match_info, "Bands4GHex");
|
||||
hex_format = match_str != NULL;
|
||||
}
|
||||
if (!match_str || match_str[0] == '\0') {
|
||||
g_set_error (&inner_error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Could not find 4G band hex mask flag from response");
|
||||
"Could not find 4G band mask flag from response");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!mm_get_u64_from_hex_str (match_str, &value)) {
|
||||
/* splitting will never return NULL as string is not empty */
|
||||
tokens = g_strsplit (match_str, "-", -1);
|
||||
|
||||
/* If this is a range, get upper threshold, which contains the total supported mask */
|
||||
ok = hex_format ?
|
||||
mm_get_u64_from_hex_str (tokens[1] ? tokens[1] : tokens[0], &value) :
|
||||
mm_get_u64_from_str (tokens[1] ? tokens[1] : tokens[0], &value);
|
||||
if (!ok) {
|
||||
g_set_error (&inner_error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Could not parse 4G band hex mask from string: '%s'", match_str);
|
||||
"Could not parse 4G band mask from string: '%s'", match_str);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -636,12 +745,22 @@ telit_get_ext_4g_mm_bands (GMatchInfo *match_info,
|
||||
}
|
||||
|
||||
/* extended bands */
|
||||
match_str_ext = g_match_info_fetch_named (match_info, "Bands4GExt");
|
||||
if (match_str_ext) {
|
||||
match_str_ext_hex = g_match_info_fetch_named (match_info, "Bands4GExtDec");
|
||||
if (!match_str_ext_hex)
|
||||
match_str_ext_hex = g_match_info_fetch_named (match_info, "Bands4GExtHex");
|
||||
if (match_str_ext_hex) {
|
||||
g_auto(GStrv) tokens_ext = NULL;
|
||||
|
||||
if (!mm_get_u64_from_hex_str (match_str_ext, &value)) {
|
||||
/* splitting will never return NULL as string is not empty */
|
||||
tokens_ext = g_strsplit (match_str_ext_hex, "-", -1);
|
||||
|
||||
/* hex_format is the same for both 4G and ext 4G (same regex) */
|
||||
ok = hex_format ?
|
||||
mm_get_u64_from_hex_str (tokens_ext[1] ? tokens_ext[1] : tokens_ext[0], &value) :
|
||||
mm_get_u64_from_str (tokens_ext[1] ? tokens_ext[1] : tokens_ext[0], &value);
|
||||
if (!ok) {
|
||||
g_set_error (&inner_error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Could not parse 4G ext band mask from string: '%s'", match_str_ext);
|
||||
"Could not parse 4G ext band mask from string: '%s'", match_str_ext_hex);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -653,7 +772,7 @@ telit_get_ext_4g_mm_bands (GMatchInfo *match_info,
|
||||
|
||||
out:
|
||||
g_free (match_str);
|
||||
g_free (match_str_ext);
|
||||
g_free (match_str_ext_hex);
|
||||
|
||||
if (inner_error) {
|
||||
g_propagate_error (error, inner_error);
|
||||
@@ -672,12 +791,16 @@ typedef enum {
|
||||
#define MM_SUPPORTED_BANDS_3G "(,\\s*\\((?P<Bands3G>[0-9\\-,]*)\\))?"
|
||||
#define MM_SUPPORTED_BANDS_4G_HEX "(,\\s*\\((?P<Bands4GHex>[0-9A-F\\-,]*)\\))?"
|
||||
#define MM_SUPPORTED_BANDS_4G_DEC "(,\\s*\\((?P<Bands4GDec>[0-9\\-,]*)\\))?"
|
||||
#define MM_SUPPORTED_BANDS_4G_EXT "(,\\s*\\((?P<Bands4GHex>[0-9A-F]+)\\))?(,\\s*\\((?P<Bands4GExt>[0-9A-F]+)\\))?"
|
||||
#define MM_SUPPORTED_BANDS_4G_EXT_HEX "(,\\s*\\((?P<Bands4GHex>[0-9A-F]+)\\))?(,\\s*\\((?P<Bands4GExtHex>[0-9A-F]+)\\))?"
|
||||
#define MM_SUPPORTED_BANDS_TDSCDMA "(,\\s*\\((?P<BandsTDSCDMA>[0-9\\-,]*)\\))?"
|
||||
#define MM_SUPPORTED_BANDS_4G_EXT_DEC "(,\\s*\\((?P<Bands4GExtDec>[0-9\\-,]*)\\))?"
|
||||
#define MM_CURRENT_BANDS_2G "\\s*(?P<Bands2G>\\d+)"
|
||||
#define MM_CURRENT_BANDS_3G "(,\\s*(?P<Bands3G>\\d+))?"
|
||||
#define MM_CURRENT_BANDS_4G_HEX "(,\\s*(?P<Bands4GHex>[0-9A-F]+))?"
|
||||
#define MM_CURRENT_BANDS_4G_DEC "(,\\s*(?P<Bands4GDec>\\d+))?"
|
||||
#define MM_CURRENT_BANDS_4G_EXT "(,\\s*(?P<Bands4GHex>[0-9A-F]+))?(,\\s*(?P<Bands4GExt>[0-9A-F]+))?"
|
||||
#define MM_CURRENT_BANDS_4G_EXT_HEX "(,\\s*(?P<Bands4GHex>[0-9A-F]+))?(,\\s*(?P<Bands4GExtHex>[0-9A-F]+))?"
|
||||
#define MM_CURRENT_BANDS_TDSCDMA "(,\\s*(?P<BandsTDSCDMA>\\d+))?"
|
||||
#define MM_CURRENT_BANDS_4G_EXT_DEC "(,\\s*(?P<Bands4GExtDec>\\d+))?"
|
||||
|
||||
static GArray *
|
||||
common_parse_bnd_response (const gchar *response,
|
||||
@@ -701,13 +824,19 @@ common_parse_bnd_response (const gchar *response,
|
||||
[LOAD_BANDS_TYPE_SUPPORTED] = "#BND:"MM_SUPPORTED_BANDS_2G MM_SUPPORTED_BANDS_3G MM_SUPPORTED_BANDS_4G_DEC,
|
||||
[LOAD_BANDS_TYPE_CURRENT] = "#BND:"MM_CURRENT_BANDS_2G MM_CURRENT_BANDS_3G MM_CURRENT_BANDS_4G_DEC,
|
||||
};
|
||||
static const gchar *load_bands_regex_4g_ext[] = {
|
||||
[LOAD_BANDS_TYPE_SUPPORTED] = "#BND:"MM_SUPPORTED_BANDS_2G MM_SUPPORTED_BANDS_3G MM_SUPPORTED_BANDS_4G_EXT,
|
||||
[LOAD_BANDS_TYPE_CURRENT] = "#BND:"MM_CURRENT_BANDS_2G MM_CURRENT_BANDS_3G MM_CURRENT_BANDS_4G_EXT,
|
||||
static const gchar *load_bands_regex_4g_ext_hex[] = {
|
||||
[LOAD_BANDS_TYPE_SUPPORTED] = "#BND:"MM_SUPPORTED_BANDS_2G MM_SUPPORTED_BANDS_3G MM_SUPPORTED_BANDS_4G_EXT_HEX,
|
||||
[LOAD_BANDS_TYPE_CURRENT] = "#BND:"MM_CURRENT_BANDS_2G MM_CURRENT_BANDS_3G MM_CURRENT_BANDS_4G_EXT_HEX,
|
||||
};
|
||||
static const gchar *load_bands_regex_tdscdma_4g_ext_dec[] = {
|
||||
[LOAD_BANDS_TYPE_SUPPORTED] = "#BND:"MM_SUPPORTED_BANDS_2G MM_SUPPORTED_BANDS_3G MM_SUPPORTED_BANDS_4G_DEC MM_SUPPORTED_BANDS_TDSCDMA MM_SUPPORTED_BANDS_4G_EXT_DEC,
|
||||
[LOAD_BANDS_TYPE_CURRENT] = "#BND:"MM_CURRENT_BANDS_2G MM_CURRENT_BANDS_3G MM_CURRENT_BANDS_4G_DEC MM_CURRENT_BANDS_TDSCDMA MM_CURRENT_BANDS_4G_EXT_DEC,
|
||||
};
|
||||
|
||||
if (config->modem_ext_4g_bands)
|
||||
load_bands_regex = load_bands_regex_4g_ext[load_type];
|
||||
if (config->modem_ext_4g_bands && config->modem_has_hex_format_4g_bands)
|
||||
load_bands_regex = load_bands_regex_4g_ext_hex[load_type];
|
||||
else if (config->modem_ext_4g_bands && config->modem_has_tdscdma_bands)
|
||||
load_bands_regex = load_bands_regex_tdscdma_4g_ext_dec[load_type];
|
||||
else if (config->modem_has_hex_format_4g_bands)
|
||||
load_bands_regex = load_bands_regex_4g_hex[load_type];
|
||||
else
|
||||
@@ -920,9 +1049,11 @@ mm_telit_model_from_revision (const gchar *revision)
|
||||
{"24.01", MM_TELIT_MODEL_LM940},
|
||||
{"25.", MM_TELIT_MODEL_LE910C1},
|
||||
{"32.", MM_TELIT_MODEL_LM960},
|
||||
{"37.", MM_TELIT_MODEL_ME910G1},
|
||||
{"38.", MM_TELIT_MODEL_FN980},
|
||||
{"40.", MM_TELIT_MODEL_LN920},
|
||||
{"45.00", MM_TELIT_MODEL_FN990},
|
||||
{"48.", MM_TELIT_MODEL_ME310M1},
|
||||
};
|
||||
|
||||
if (!revision)
|
||||
|
||||
@@ -27,6 +27,8 @@ typedef enum {
|
||||
MM_TELIT_MODEL_LM960,
|
||||
MM_TELIT_MODEL_LN920,
|
||||
MM_TELIT_MODEL_FN990,
|
||||
MM_TELIT_MODEL_ME910G1,
|
||||
MM_TELIT_MODEL_ME310M1,
|
||||
} MMTelitModel;
|
||||
|
||||
typedef struct {
|
||||
@@ -36,6 +38,7 @@ typedef struct {
|
||||
gboolean modem_alternate_3g_bands;
|
||||
gboolean modem_has_hex_format_4g_bands;
|
||||
gboolean modem_ext_4g_bands;
|
||||
gboolean modem_has_tdscdma_bands;
|
||||
} MMTelitBNDParseConfig;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef struct {
|
||||
MMIfaceModemInterface *iface_modem_parent;
|
||||
gboolean alternate_3g_bands;
|
||||
gboolean ext_4g_bands;
|
||||
gboolean tdscdma_bands;
|
||||
GArray *supported_bands;
|
||||
GArray *supported_modes;
|
||||
gchar *software_package_version;
|
||||
@@ -100,7 +101,20 @@ has_extended_4g_bands (const gchar *revision)
|
||||
return (model == MM_TELIT_MODEL_FN980 ||
|
||||
model == MM_TELIT_MODEL_FN990 ||
|
||||
model == MM_TELIT_MODEL_LM960 ||
|
||||
model == MM_TELIT_MODEL_LN920);
|
||||
model == MM_TELIT_MODEL_LN920 ||
|
||||
model == MM_TELIT_MODEL_ME910G1 ||
|
||||
model == MM_TELIT_MODEL_ME310M1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
has_tdscdma_bands (const gchar *revision)
|
||||
{
|
||||
MMTelitModel model;
|
||||
|
||||
model = mm_telit_model_from_revision (revision);
|
||||
|
||||
return (model == MM_TELIT_MODEL_ME910G1 ||
|
||||
model == MM_TELIT_MODEL_ME310M1);
|
||||
}
|
||||
|
||||
static Private *
|
||||
@@ -145,6 +159,7 @@ mm_shared_telit_store_revision (MMSharedTelit *self,
|
||||
priv->software_package_version = g_strdup (revision);
|
||||
priv->alternate_3g_bands = has_alternate_3g_bands (revision);
|
||||
priv->ext_4g_bands = has_extended_4g_bands (revision);
|
||||
priv->tdscdma_bands = has_tdscdma_bands (revision);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -160,6 +175,7 @@ mm_shared_telit_get_bnd_parse_config (MMIfaceModem *self, MMTelitBNDParseConfig
|
||||
config->modem_alternate_3g_bands = priv->alternate_3g_bands;
|
||||
config->modem_has_hex_format_4g_bands = is_bnd_4g_format_hex (priv->software_package_version);
|
||||
config->modem_ext_4g_bands = priv->ext_4g_bands;
|
||||
config->modem_has_tdscdma_bands = priv->tdscdma_bands;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#define MAX_BANDS_LIST_LEN 17
|
||||
#define MAX_BANDS_LIST_LEN 18
|
||||
|
||||
typedef struct {
|
||||
const gchar *response;
|
||||
@@ -183,7 +183,50 @@ static BndResponseTest supported_band_mapping_tests [] = {
|
||||
MM_MODEM_BAND_EUTRAN_8,
|
||||
MM_MODEM_BAND_EUTRAN_20,
|
||||
MM_MODEM_BAND_EUTRAN_28 }
|
||||
}
|
||||
},
|
||||
/* ME910G1, decimal 4G ext band settings with TDSCDMA field */
|
||||
{
|
||||
"#BND: (0),(0),(1-252582047),(0),(0,2-1048578)", {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE}, 17,
|
||||
{ MM_MODEM_BAND_EUTRAN_1,
|
||||
MM_MODEM_BAND_EUTRAN_2,
|
||||
MM_MODEM_BAND_EUTRAN_3,
|
||||
MM_MODEM_BAND_EUTRAN_4,
|
||||
MM_MODEM_BAND_EUTRAN_5,
|
||||
MM_MODEM_BAND_EUTRAN_8,
|
||||
MM_MODEM_BAND_EUTRAN_12,
|
||||
MM_MODEM_BAND_EUTRAN_13,
|
||||
MM_MODEM_BAND_EUTRAN_18,
|
||||
MM_MODEM_BAND_EUTRAN_19,
|
||||
MM_MODEM_BAND_EUTRAN_20,
|
||||
MM_MODEM_BAND_EUTRAN_25,
|
||||
MM_MODEM_BAND_EUTRAN_26,
|
||||
MM_MODEM_BAND_EUTRAN_27,
|
||||
MM_MODEM_BAND_EUTRAN_28,
|
||||
MM_MODEM_BAND_EUTRAN_66,
|
||||
MM_MODEM_BAND_EUTRAN_85 }
|
||||
},
|
||||
/* ME310M1, decimal 4G ext band settings with TDSCDMA field */
|
||||
{
|
||||
"#BND: (0),(0),(0,1-252590239),(0),(0,2-1048578)", {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE}, 18,
|
||||
{ MM_MODEM_BAND_EUTRAN_1,
|
||||
MM_MODEM_BAND_EUTRAN_2,
|
||||
MM_MODEM_BAND_EUTRAN_3,
|
||||
MM_MODEM_BAND_EUTRAN_4,
|
||||
MM_MODEM_BAND_EUTRAN_5,
|
||||
MM_MODEM_BAND_EUTRAN_8,
|
||||
MM_MODEM_BAND_EUTRAN_12,
|
||||
MM_MODEM_BAND_EUTRAN_13,
|
||||
MM_MODEM_BAND_EUTRAN_14,
|
||||
MM_MODEM_BAND_EUTRAN_18,
|
||||
MM_MODEM_BAND_EUTRAN_19,
|
||||
MM_MODEM_BAND_EUTRAN_20,
|
||||
MM_MODEM_BAND_EUTRAN_25,
|
||||
MM_MODEM_BAND_EUTRAN_26,
|
||||
MM_MODEM_BAND_EUTRAN_27,
|
||||
MM_MODEM_BAND_EUTRAN_28,
|
||||
MM_MODEM_BAND_EUTRAN_66,
|
||||
MM_MODEM_BAND_EUTRAN_85 }
|
||||
},
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -292,7 +335,7 @@ static BndResponseTest current_band_mapping_tests [] = {
|
||||
},
|
||||
/* 4G ext band settings: devices such as LN920 */
|
||||
{
|
||||
"#BND: 0,0,1003100185A,42", {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE}, 13,
|
||||
"#BND: 0,0,1003100185A,42", {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE}, 13,
|
||||
{ MM_MODEM_BAND_UTRAN_1,
|
||||
MM_MODEM_BAND_EUTRAN_2,
|
||||
MM_MODEM_BAND_EUTRAN_4,
|
||||
@@ -306,7 +349,55 @@ static BndResponseTest current_band_mapping_tests [] = {
|
||||
MM_MODEM_BAND_EUTRAN_41,
|
||||
MM_MODEM_BAND_EUTRAN_66,
|
||||
MM_MODEM_BAND_EUTRAN_71 }
|
||||
}
|
||||
},
|
||||
/* ME910G1, decimal 4G ext band settings with TDSCDMA field */
|
||||
{
|
||||
"#BND: 0,0,252582047,0,1048578", {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE}, 17,
|
||||
{ MM_MODEM_BAND_EUTRAN_1,
|
||||
MM_MODEM_BAND_EUTRAN_2,
|
||||
MM_MODEM_BAND_EUTRAN_3,
|
||||
MM_MODEM_BAND_EUTRAN_4,
|
||||
MM_MODEM_BAND_EUTRAN_5,
|
||||
MM_MODEM_BAND_EUTRAN_8,
|
||||
MM_MODEM_BAND_EUTRAN_12,
|
||||
MM_MODEM_BAND_EUTRAN_13,
|
||||
MM_MODEM_BAND_EUTRAN_18,
|
||||
MM_MODEM_BAND_EUTRAN_19,
|
||||
MM_MODEM_BAND_EUTRAN_20,
|
||||
MM_MODEM_BAND_EUTRAN_25,
|
||||
MM_MODEM_BAND_EUTRAN_26,
|
||||
MM_MODEM_BAND_EUTRAN_27,
|
||||
MM_MODEM_BAND_EUTRAN_28,
|
||||
MM_MODEM_BAND_EUTRAN_66,
|
||||
MM_MODEM_BAND_EUTRAN_85 }
|
||||
},
|
||||
/* ME310M1, decimal 4G ext band settings with TDSCDMA field */
|
||||
{
|
||||
"#BND: 0,0,252590239,0,1048578", {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE}, 18,
|
||||
{ MM_MODEM_BAND_EUTRAN_1,
|
||||
MM_MODEM_BAND_EUTRAN_2,
|
||||
MM_MODEM_BAND_EUTRAN_3,
|
||||
MM_MODEM_BAND_EUTRAN_4,
|
||||
MM_MODEM_BAND_EUTRAN_5,
|
||||
MM_MODEM_BAND_EUTRAN_8,
|
||||
MM_MODEM_BAND_EUTRAN_12,
|
||||
MM_MODEM_BAND_EUTRAN_13,
|
||||
MM_MODEM_BAND_EUTRAN_14,
|
||||
MM_MODEM_BAND_EUTRAN_18,
|
||||
MM_MODEM_BAND_EUTRAN_19,
|
||||
MM_MODEM_BAND_EUTRAN_20,
|
||||
MM_MODEM_BAND_EUTRAN_25,
|
||||
MM_MODEM_BAND_EUTRAN_26,
|
||||
MM_MODEM_BAND_EUTRAN_27,
|
||||
MM_MODEM_BAND_EUTRAN_28,
|
||||
MM_MODEM_BAND_EUTRAN_66,
|
||||
MM_MODEM_BAND_EUTRAN_85 }
|
||||
},
|
||||
/* ME310M1, only extended 4g bands */
|
||||
{
|
||||
"#BND: 0,0,0,0,2", {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE}, 1,
|
||||
{ MM_MODEM_BAND_EUTRAN_66 }
|
||||
},
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -579,6 +670,161 @@ test_telit_get_4g_bnd_flag (void)
|
||||
g_array_unref (bands_array);
|
||||
}
|
||||
|
||||
static void test_telit_bnd_cmd_multitech(void)
|
||||
{
|
||||
GArray *bands_array;
|
||||
gchar *cmd;
|
||||
GError *error = NULL;
|
||||
MMTelitBNDParseConfig config = { TRUE, TRUE, TRUE, FALSE, FALSE, FALSE };
|
||||
MMModemBand egsm = MM_MODEM_BAND_EGSM;
|
||||
MMModemBand dcs = MM_MODEM_BAND_DCS;
|
||||
MMModemBand u2100 = MM_MODEM_BAND_UTRAN_1;
|
||||
MMModemBand eutran1 = MM_MODEM_BAND_EUTRAN_1;
|
||||
MMModemBand pcs = MM_MODEM_BAND_PCS;
|
||||
|
||||
/* No bands specified */
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_error(error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND);
|
||||
g_assert(cmd == NULL);
|
||||
g_clear_error(&error);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
/* Only 2G bands for a 2G, 3G, 4G modem */
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, egsm);
|
||||
g_array_append_val(bands_array, dcs);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_error(error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND);
|
||||
g_assert(cmd == NULL);
|
||||
g_clear_error(&error);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
/* Only 3G bands for a 2G, 3G, 4G modem */
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, u2100);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_error(error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND);
|
||||
g_assert(cmd == NULL);
|
||||
g_clear_error(&error);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
/* Only 4G bands for a 2G, 3G, 4G modem */
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, eutran1);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_error(error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND);
|
||||
g_assert(cmd == NULL);
|
||||
g_clear_error(&error);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
/* 2G+3G+4G bands for a 2G, 3G, 4G modem */
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, egsm);
|
||||
g_array_append_val(bands_array, dcs);
|
||||
g_array_append_val(bands_array, u2100);
|
||||
g_array_append_val(bands_array, eutran1);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_cmpstr(cmd, ==, "#BND=0,0,1");
|
||||
g_free(cmd);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
/* 2G+3G bands for a 2G, 3G, 4G modem */
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, egsm);
|
||||
g_array_append_val(bands_array, pcs);
|
||||
g_array_append_val(bands_array, u2100);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_cmpstr(cmd, ==, "#BND=1,0,0");
|
||||
g_free(cmd);
|
||||
g_array_unref(bands_array);
|
||||
}
|
||||
|
||||
static void
|
||||
test_telit_bnd_cmd_me910g1_2g_4gext(void)
|
||||
{
|
||||
GArray *bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
GError *error = NULL;
|
||||
gchar *cmd;
|
||||
MMTelitBNDParseConfig config = {
|
||||
.modem_is_2g = TRUE,
|
||||
.modem_is_3g = FALSE,
|
||||
.modem_is_4g = TRUE,
|
||||
.modem_alternate_3g_bands = FALSE,
|
||||
.modem_ext_4g_bands = TRUE,
|
||||
.modem_has_tdscdma_bands = TRUE
|
||||
};
|
||||
|
||||
MMModemBand dcs = MM_MODEM_BAND_DCS;
|
||||
MMModemBand g850 = MM_MODEM_BAND_G850;
|
||||
MMModemBand eutran_66 = MM_MODEM_BAND_EUTRAN_66;
|
||||
MMModemBand eutran_85 = MM_MODEM_BAND_EUTRAN_85;
|
||||
MMModemBand eutran1 = MM_MODEM_BAND_EUTRAN_1;
|
||||
g_array_append_val(bands_array, dcs);
|
||||
g_array_append_val(bands_array, g850);
|
||||
g_array_append_val(bands_array, eutran_66);
|
||||
g_array_append_val(bands_array, eutran_85);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_cmpstr(cmd, ==, "#BND=2,0,0,0,1048578");
|
||||
g_free(cmd);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, dcs);
|
||||
g_array_append_val(bands_array, g850);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_cmpstr(cmd, ==, "#BND=2,0,0,0,0");
|
||||
g_free(cmd);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, dcs);
|
||||
g_array_append_val(bands_array, g850);
|
||||
g_array_append_val(bands_array, eutran1);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_cmpstr(cmd, ==, "#BND=2,0,1,0,0");
|
||||
g_free(cmd);
|
||||
g_array_unref(bands_array);
|
||||
}
|
||||
|
||||
static void
|
||||
test_telit_bnd_cmd_4g_only(void)
|
||||
{
|
||||
GArray *bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
GError *error = NULL;
|
||||
gchar *cmd;
|
||||
MMTelitBNDParseConfig config = {
|
||||
.modem_is_2g = FALSE,
|
||||
.modem_is_3g = FALSE,
|
||||
.modem_is_4g = TRUE,
|
||||
.modem_alternate_3g_bands = FALSE,
|
||||
.modem_ext_4g_bands = TRUE,
|
||||
.modem_has_tdscdma_bands = TRUE
|
||||
};
|
||||
MMModemBand eutran1 = MM_MODEM_BAND_EUTRAN_1;
|
||||
MMModemBand eutran_85 = MM_MODEM_BAND_EUTRAN_85;
|
||||
|
||||
g_array_append_val(bands_array, eutran_85);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_cmpstr(cmd, ==, "#BND=0,0,0,0,1048576");
|
||||
g_free(cmd);
|
||||
g_array_unref(bands_array);
|
||||
|
||||
bands_array = g_array_new(FALSE, FALSE, sizeof(MMModemBand));
|
||||
g_array_append_val(bands_array, eutran1);
|
||||
cmd = mm_telit_build_bnd_request(bands_array, &config, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_cmpstr(cmd, ==, "#BND=0,0,1,0,0");
|
||||
g_free(cmd);
|
||||
g_array_unref(bands_array);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
@@ -678,8 +924,7 @@ test_telit_compare_software_revision_string (void)
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int main (int argc, char **argv){
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
@@ -689,6 +934,9 @@ int main (int argc, char **argv)
|
||||
g_test_add_func ("/MM/telit/bands/current/set_bands/2g", test_telit_get_2g_bnd_flag);
|
||||
g_test_add_func ("/MM/telit/bands/current/set_bands/3g", test_telit_get_3g_bnd_flag);
|
||||
g_test_add_func ("/MM/telit/bands/current/set_bands/4g", test_telit_get_4g_bnd_flag);
|
||||
g_test_add_func ("/MM/telit/bands/current/set_bands/multitech", test_telit_bnd_cmd_multitech);
|
||||
g_test_add_func ("/MM/telit/bands/current/set_bands/4g_only", test_telit_bnd_cmd_4g_only);
|
||||
g_test_add_func ("/MM/telit/bands/current/set_bands/me910g1_2g_4gext", test_telit_bnd_cmd_me910g1_2g_4gext);
|
||||
g_test_add_func ("/MM/telit/qss/query", test_telit_parse_qss_query);
|
||||
g_test_add_func ("/MM/telit/swpkv/parse_response", test_telit_parse_swpkgv_response);
|
||||
g_test_add_func ("/MM/telit/revision/compare", test_telit_compare_software_revision_string);
|
||||
|
||||
Reference in New Issue
Block a user