diff options
author | Giacinto Cifelli <gciofono@gmail.com> | 2020-05-19 11:09:26 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-05-26 15:05:52 +0200 |
commit | 793132d56d346ea1968c92c67156f3d8759bd395 (patch) | |
tree | 4a46237d24358dea22bfe8a50736e824569eb653 | |
parent | 09260311196c110493dd1d713d7341f3a2c02c14 (diff) |
cinterion: radio/band handling for LTE modems
-rw-r--r-- | plugins/cinterion/77-mm-cinterion-port-types.rules | 2 | ||||
-rw-r--r-- | plugins/cinterion/mm-broadband-modem-cinterion.c | 171 | ||||
-rw-r--r-- | plugins/cinterion/mm-modem-helpers-cinterion.c | 495 | ||||
-rw-r--r-- | plugins/cinterion/mm-modem-helpers-cinterion.h | 67 | ||||
-rw-r--r-- | plugins/cinterion/tests/test-modem-helpers-cinterion.c | 588 |
5 files changed, 1133 insertions, 190 deletions
diff --git a/plugins/cinterion/77-mm-cinterion-port-types.rules b/plugins/cinterion/77-mm-cinterion-port-types.rules index a3bab858..4883f764 100644 --- a/plugins/cinterion/77-mm-cinterion-port-types.rules +++ b/plugins/cinterion/77-mm-cinterion-port-types.rules @@ -20,6 +20,8 @@ ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="04", ENV{ ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="06", ENV{ID_MM_PORT_IGNORE}="1" ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="08", ENV{ID_MM_PORT_IGNORE}="1" +# PLS62 family non-mbim enumeration uses alternate settings for 2G band management +ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005b", ENV{ID_MM_CINTERION_MODEM_FAMILY}="imt" # PLS62 family non-mbim enumeration # ttyACM0 (if #0): AT port # ttyACM1 (if #2): AT port diff --git a/plugins/cinterion/mm-broadband-modem-cinterion.c b/plugins/cinterion/mm-broadband-modem-cinterion.c index 6e526ad3..f931dc58 100644 --- a/plugins/cinterion/mm-broadband-modem-cinterion.c +++ b/plugins/cinterion/mm-broadband-modem-cinterion.c @@ -79,7 +79,7 @@ struct _MMBroadbandModemCinterionPrivate { gchar *sleep_mode_cmd; /* Cached supported bands in Cinterion format */ - guint supported_bands; + guint supported_bands[MM_CINTERION_RB_BLOCK_N]; /* Cached supported modes for SMS setup */ GArray *cnmi_supported_mode; @@ -95,6 +95,13 @@ struct _MMBroadbandModemCinterionPrivate { FeatureSupport swwan_support; FeatureSupport sind_psinfo_support; FeatureSupport smoni_support; + + /* Flags for model-based behaviors */ + MMCinterionModemFamily modem_family; + MMCinterionRadioBandFormat rb_format; + + /* Command sequence */ + MMBaseModemAtCommandAlloc *cmds; }; /*****************************************************************************/ @@ -1150,27 +1157,61 @@ scfg_test_ready (MMBaseModem *_self, response = mm_base_modem_at_command_finish (_self, res, &error); if (!response || !mm_cinterion_parse_scfg_test (response, + self->priv->modem_family, mm_broadband_modem_get_current_charset (MM_BROADBAND_MODEM (self)), &bands, + &self->priv->rb_format, &error)) g_task_return_error (task, error); else { - mm_cinterion_build_band (bands, 0, FALSE, &self->priv->supported_bands, NULL); - g_assert (self->priv->supported_bands != 0); - g_task_return_pointer (task, bands, (GDestroyNotify)g_array_unref); + if (!mm_cinterion_build_band (bands, + NULL, + FALSE, + self->priv->rb_format, + self->priv->modem_family, + self->priv->supported_bands, + &error)) + g_task_return_error (task, error); + else + g_task_return_pointer (task, bands, (GDestroyNotify)g_array_unref); } g_object_unref (task); } static void -load_supported_bands (MMIfaceModem *self, +load_supported_bands (MMIfaceModem *_self, GAsyncReadyCallback callback, gpointer user_data) { - GTask *task; + MMBroadbandModemCinterion *self = MM_BROADBAND_MODEM_CINTERION (_self); + GTask *task; + MMPort *primary; + MMKernelDevice *port; + const gchar *family = NULL; + + /* Lookup for the tag specifying which modem family the current device belongs */ + primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self))); + port = mm_port_peek_kernel_device (primary); + family = mm_kernel_device_get_global_property (port, "ID_MM_CINTERION_MODEM_FAMILY"); + + /* if the property is not set, default family */ + self->priv->modem_family = MM_CINTERION_MODEM_FAMILY_DEFAULT; + + /* set used family also in the string for mm_obj_dbg */ + if (!family) + family = "default"; + + if (g_ascii_strcasecmp (family, "imt") == 0) + self->priv->modem_family = MM_CINTERION_MODEM_FAMILY_IMT; + else if (g_ascii_strcasecmp (family, "default") != 0) { + mm_obj_dbg (self, "cinterion modem family '%s' unknown", family); + family = "default"; + } - task = g_task_new (self, NULL, callback, user_data); - mm_base_modem_at_command (MM_BASE_MODEM (self), + mm_obj_dbg (self, "Using cinterion %s modem family", family); + + task = g_task_new (_self, NULL, callback, user_data); + mm_base_modem_at_command (MM_BASE_MODEM (_self), "AT^SCFG=?", 3, FALSE, @@ -1190,19 +1231,22 @@ load_current_bands_finish (MMIfaceModem *self, } static void -get_band_ready (MMBaseModem *self, +get_band_ready (MMBaseModem *_self, GAsyncResult *res, GTask *task) { + MMBroadbandModemCinterion *self = MM_BROADBAND_MODEM_CINTERION (_self); const gchar *response; GError *error = NULL; GArray *bands = NULL; - response = mm_base_modem_at_command_finish (self, res, &error); + response = mm_base_modem_at_command_finish (_self, res, &error); if (!response || !mm_cinterion_parse_scfg_response (response, + self->priv->modem_family, mm_broadband_modem_get_current_charset (MM_BROADBAND_MODEM (self)), &bands, + self->priv->rb_format, &error)) g_task_return_error (task, error); else @@ -1220,7 +1264,7 @@ load_current_bands (MMIfaceModem *self, task = g_task_new (self, NULL, callback, user_data); mm_base_modem_at_command (MM_BASE_MODEM (self), - "AT^SCFG=\"Radio/Band\"", + "AT^SCFG?", 3, FALSE, (GAsyncReadyCallback)get_band_ready, @@ -1253,43 +1297,100 @@ scfg_set_ready (MMBaseModem *self, } static void +scfg_set_ready_sequence (MMBaseModem *_self, + GAsyncResult *res, + GTask *task) +{ + GError *error = NULL; + gpointer ctx = NULL; + guint i; + MMBroadbandModemCinterion *self; + + self = g_task_get_source_object (task); + for (i = 0; self->priv->cmds[i].command; i++) + mm_base_modem_at_command_alloc_clear (&self->priv->cmds[i]); + g_free(self->priv->cmds); + self->priv->cmds = NULL; + + mm_base_modem_at_sequence_finish (_self, res, &ctx, &error); + g_task_return_boolean (task, TRUE); + g_object_unref (task); +} + +static void set_bands_3g (GTask *task, GArray *bands_array) { MMBroadbandModemCinterion *self; GError *error = NULL; - guint band = 0; - gchar *cmd; + guint band[MM_CINTERION_RB_BLOCK_N] = { 0 }; self = g_task_get_source_object (task); if (!mm_cinterion_build_band (bands_array, self->priv->supported_bands, FALSE, /* 2G and 3G */ - &band, + self->priv->rb_format, + self->priv->modem_family, + band, &error)) { g_task_return_error (task, error); g_object_unref (task); return; } - /* Following the setup: - * AT^SCFG="Radion/Band",<rba> - * We will set the preferred band equal to the allowed band, so that we force - * the modem to connect at that specific frequency only. Note that we will be - * passing a number here! - * - * The optional <rbe> field is set to 1, so that changes take effect - * immediately. - */ - cmd = g_strdup_printf ("^SCFG=\"Radio/Band\",%u,1", band); - mm_base_modem_at_command (MM_BASE_MODEM (self), - cmd, - 15, - FALSE, - (GAsyncReadyCallback)scfg_set_ready, - task); - g_free (cmd); + if (self->priv->rb_format == MM_CINTERION_RADIO_BAND_FORMAT_SINGLE) { + g_autofree gchar *cmd = NULL; + + /* Following the setup: + * AT^SCFG="Radion/Band",<rba> + * We will set the preferred band equal to the allowed band, so that we force + * the modem to connect at that specific frequency only. Note that we will be + * passing a number here! + * + * The optional <rbe> field is set to 1, so that changes take effect + * immediately. + */ + cmd = g_strdup_printf ("^SCFG=\"Radio/Band\",%u,1", band[MM_CINTERION_RB_BLOCK_LEGACY]); + mm_base_modem_at_command (MM_BASE_MODEM (self), + cmd, + 15, + FALSE, + (GAsyncReadyCallback)scfg_set_ready, + task); + } else { /* self->priv->rb_format == MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE */ + if (self->priv->modem_family == MM_CINTERION_MODEM_FAMILY_IMT) { + g_autofree gchar *bandstr2G = NULL; + g_autofree gchar *bandstr3G = NULL; + g_autofree gchar *bandstr4G = NULL; + + bandstr2G = g_strdup_printf ("0x%08X", band[MM_CINTERION_RB_BLOCK_GSM]); + bandstr3G = g_strdup_printf ("0x%08X", band[MM_CINTERION_RB_BLOCK_UMTS]); + bandstr4G = g_strdup_printf ("0x%08X", band[MM_CINTERION_RB_BLOCK_LTE_LOW]); + bandstr2G = mm_broadband_modem_take_and_convert_to_current_charset (MM_BROADBAND_MODEM (self), bandstr2G); + bandstr3G = mm_broadband_modem_take_and_convert_to_current_charset (MM_BROADBAND_MODEM (self), bandstr3G); + bandstr4G = mm_broadband_modem_take_and_convert_to_current_charset (MM_BROADBAND_MODEM (self), bandstr4G); + self->priv->cmds = g_new0 (MMBaseModemAtCommandAlloc, 3 + 1); + self->priv->cmds[0].command = g_strdup_printf ("^SCFG=\"Radio/Band/2G\",\"%s\"", bandstr2G); + self->priv->cmds[1].command = g_strdup_printf ("^SCFG=\"Radio/Band/3G\",\"%s\"", bandstr3G); + self->priv->cmds[2].command = g_strdup_printf ("^SCFG=\"Radio/Band/4G\",\"%s\"", bandstr4G); + self->priv->cmds[0].timeout = self->priv->cmds[1].timeout = self->priv->cmds[2].timeout = 60; + } else { + self->priv->cmds = g_new0 (MMBaseModemAtCommandAlloc, 3 + 1); + self->priv->cmds[0].command = g_strdup_printf ("^SCFG=\"Radio/Band/2G\",\"%08x\",1", band[MM_CINTERION_RB_BLOCK_GSM]); + self->priv->cmds[1].command = g_strdup_printf ("^SCFG=\"Radio/Band/3G\",\"%08x\",1", band[MM_CINTERION_RB_BLOCK_UMTS]); + self->priv->cmds[2].command = g_strdup_printf ("^SCFG=\"Radio/Band/4G\",\"%08x\",\"%08x\",1", band[MM_CINTERION_RB_BLOCK_LTE_LOW], band[MM_CINTERION_RB_BLOCK_LTE_HIGH]); + self->priv->cmds[0].timeout = self->priv->cmds[1].timeout = self->priv->cmds[2].timeout = 15; + } + + mm_base_modem_at_sequence (MM_BASE_MODEM (self), + (const MMBaseModemAtCommand *)self->priv->cmds, + NULL, + NULL, + (GAsyncReadyCallback)scfg_set_ready_sequence, + task); + } + } static void @@ -1298,7 +1399,7 @@ set_bands_2g (GTask *task, { MMBroadbandModemCinterion *self; GError *error = NULL; - guint band = 0; + guint band[MM_CINTERION_RB_BLOCK_N] = { 0 }; gchar *cmd; gchar *bandstr; @@ -1307,7 +1408,9 @@ set_bands_2g (GTask *task, if (!mm_cinterion_build_band (bands_array, self->priv->supported_bands, TRUE, /* 2G only */ - &band, + MM_CINTERION_RADIO_BAND_FORMAT_SINGLE, + 0, + band, &error)) { g_task_return_error (task, error); g_object_unref (task); @@ -1315,7 +1418,7 @@ set_bands_2g (GTask *task, } /* Build string with the value, in the proper charset */ - bandstr = g_strdup_printf ("%u", band); + bandstr = g_strdup_printf ("%u", band[MM_CINTERION_RB_BLOCK_LEGACY]); bandstr = mm_broadband_modem_take_and_convert_to_current_charset (MM_BROADBAND_MODEM (self), bandstr); if (!bandstr) { g_task_return_new_error (task, diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.c b/plugins/cinterion/mm-modem-helpers-cinterion.c index 1bc43c61..6a1364ae 100644 --- a/plugins/cinterion/mm-modem-helpers-cinterion.c +++ b/plugins/cinterion/mm-modem-helpers-cinterion.c @@ -37,6 +37,12 @@ typedef struct { MMModemBand mm_band; } CinterionBand; +typedef struct { + MMCinterionRbBlock cinterion_band_block; + guint32 cinterion_band_flag; + MMModemBand mm_band; +} CinterionBandEx; + /* Table checked in PLS8-X/E/J/V/US, HC25 & PHS8 references. The table includes 2/3/4G * frequencies. Depending on which one is configured, one access technology or * the other will be used. This may conflict with the allowed mode configuration @@ -68,6 +74,68 @@ static const CinterionBand cinterion_bands[] = { { (1 << 24), MM_MODEM_BAND_EUTRAN_19 } }; +static const CinterionBandEx cinterion_bands_ex[] = { + { MM_CINTERION_RB_BLOCK_GSM, 0x00000001, MM_MODEM_BAND_EGSM }, + { MM_CINTERION_RB_BLOCK_GSM, 0x00000002, MM_MODEM_BAND_DCS }, + { MM_CINTERION_RB_BLOCK_GSM, 0x00000004, MM_MODEM_BAND_G850 }, + { MM_CINTERION_RB_BLOCK_GSM, 0x00000008, MM_MODEM_BAND_PCS }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000001, MM_MODEM_BAND_UTRAN_1 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000002, MM_MODEM_BAND_UTRAN_2 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000004, MM_MODEM_BAND_UTRAN_3 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000008, MM_MODEM_BAND_UTRAN_4 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000010, MM_MODEM_BAND_UTRAN_5 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000020, MM_MODEM_BAND_UTRAN_6 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000080, MM_MODEM_BAND_UTRAN_8 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000100, MM_MODEM_BAND_UTRAN_9 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00040000, MM_MODEM_BAND_UTRAN_19 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000001, MM_MODEM_BAND_EUTRAN_1 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000002, MM_MODEM_BAND_EUTRAN_2 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000004, MM_MODEM_BAND_EUTRAN_3 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000008, MM_MODEM_BAND_EUTRAN_4 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000010, MM_MODEM_BAND_EUTRAN_5 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000040, MM_MODEM_BAND_EUTRAN_7 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000080, MM_MODEM_BAND_EUTRAN_8 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000800, MM_MODEM_BAND_EUTRAN_12 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00001000, MM_MODEM_BAND_EUTRAN_13 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00010000, MM_MODEM_BAND_EUTRAN_17 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00020000, MM_MODEM_BAND_EUTRAN_18 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00040000, MM_MODEM_BAND_EUTRAN_19 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00080000, MM_MODEM_BAND_EUTRAN_20 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x02000000, MM_MODEM_BAND_EUTRAN_26 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x08000000, MM_MODEM_BAND_EUTRAN_28 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x10000000, MM_MODEM_BAND_EUTRAN_29 }, + { MM_CINTERION_RB_BLOCK_LTE_HIGH, 0x00000020, MM_MODEM_BAND_EUTRAN_38 }, + { MM_CINTERION_RB_BLOCK_LTE_HIGH, 0x00000040, MM_MODEM_BAND_EUTRAN_39 }, + { MM_CINTERION_RB_BLOCK_LTE_HIGH, 0x00000080, MM_MODEM_BAND_EUTRAN_40 }, + { MM_CINTERION_RB_BLOCK_LTE_HIGH, 0x00000100, MM_MODEM_BAND_EUTRAN_41 } +}; + +static const CinterionBandEx cinterion_bands_imt[] = { + { MM_CINTERION_RB_BLOCK_GSM, 0x00000004, MM_MODEM_BAND_EGSM }, + { MM_CINTERION_RB_BLOCK_GSM, 0x00000010, MM_MODEM_BAND_DCS }, + { MM_CINTERION_RB_BLOCK_GSM, 0x00000020, MM_MODEM_BAND_PCS }, + { MM_CINTERION_RB_BLOCK_GSM, 0x00000040, MM_MODEM_BAND_G850 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000001, MM_MODEM_BAND_UTRAN_1 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000002, MM_MODEM_BAND_UTRAN_2 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000008, MM_MODEM_BAND_UTRAN_4 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000010, MM_MODEM_BAND_UTRAN_5 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000080, MM_MODEM_BAND_UTRAN_8 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00000100, MM_MODEM_BAND_UTRAN_9 }, + { MM_CINTERION_RB_BLOCK_UMTS, 0x00040000, MM_MODEM_BAND_UTRAN_19 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000001, MM_MODEM_BAND_EUTRAN_1 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000002, MM_MODEM_BAND_EUTRAN_2 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000004, MM_MODEM_BAND_EUTRAN_3 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000008, MM_MODEM_BAND_EUTRAN_4 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000010, MM_MODEM_BAND_EUTRAN_5 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000040, MM_MODEM_BAND_EUTRAN_7 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000080, MM_MODEM_BAND_EUTRAN_8 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00000800, MM_MODEM_BAND_EUTRAN_12 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00020000, MM_MODEM_BAND_EUTRAN_18 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00040000, MM_MODEM_BAND_EUTRAN_19 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x00080000, MM_MODEM_BAND_EUTRAN_20 }, + { MM_CINTERION_RB_BLOCK_LTE_LOW, 0x08000000, MM_MODEM_BAND_EUTRAN_28 } +}; + /* Check valid combinations in 2G-only devices */ #define VALIDATE_2G_BAND(cinterion_mask) \ (cinterion_mask == 1 || \ @@ -81,46 +149,127 @@ static const CinterionBand cinterion_bands[] = { cinterion_mask == 15) /*****************************************************************************/ -/* ^SCFG (3G) test parser +/* ^SCFG (3G+LTE) test parser * - * Example: + * Example 3G: * AT^SCFG=? * ... * ^SCFG: "MEShutdown/OnIgnition",("on","off") * ^SCFG: "Radio/Band",("1-511","0-1") * ^SCFG: "Radio/NWSM",("0","1","2") * ... - * * ^SCFG: "Radio/Band\",("1"-"147") + * + * Example LTE1 (GSM charset): + * AT^SCFG=? + * ... + * ^SCFG: "Radio/Band/2G",("0x00000004"-"0x00000074") + * ^SCFG: "Radio/Band/3G",("0x00000001"-"0x0004019B") + * ^SCFG: "Radio/Band/4G",("0x00000001"-"0x080E08DF") + * ... + * + * Example LTE1 (UCS2 charset): + * AT^SCFG=? + * ... + * ^SCFG: "Radio/Band/2G",("0030007800300030003000300030003000300034"-"0030007800300030003000300030003000370034") + * ^SCFG: "Radio/Band/3G",("0030007800300030003000300030003000300031"-"0030007800300030003000340030003100390042") + * ^SCFG: "Radio/Band/4G",("0030007800300030003000300030003000300031"-"0030007800300038003000450030003800440046") + * ... + * + * Example LTE2 (all charsets): + * AT^SCFG=? + * ... + * ^SCFG: "Radio/Band/2G",("00000001-0000000f"),,("0","1") + * ^SCFG: "Radio/Band/3G",("00000001-000400b5"),,("0","1") + * ^SCFG: "Radio/Band/4G",("00000001-8a0e00d5"),("00000002-000001e2"),("0","1") + * ... */ +static void +parse_bands (guint bandlist, + GArray **bands, + MMCinterionRbBlock block, + MMCinterionModemFamily modem_family) +{ + guint i; + const CinterionBandEx *ref_bands; + guint nb_ref_bands; + + if (!bandlist) + return; + + if (modem_family == MM_CINTERION_MODEM_FAMILY_IMT) { + ref_bands = cinterion_bands_imt; + nb_ref_bands = G_N_ELEMENTS (cinterion_bands_imt); + } else { + ref_bands = cinterion_bands_ex; + nb_ref_bands = G_N_ELEMENTS (cinterion_bands_ex); + } + + for (i = 0; i < nb_ref_bands; i++) { + if (block == ref_bands[i].cinterion_band_block && (bandlist & ref_bands[i].cinterion_band_flag)) { + if (G_UNLIKELY (!*bands)) + *bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 23); + g_array_append_val (*bands, ref_bands[i].mm_band); + } + } +} + +static guint +take_and_convert_from_matched_string (gchar *str, + MMModemCharset charset, + MMCinterionModemFamily modem_family) +{ + guint val = 0; + + if (!str) + return 0; + + if (modem_family == MM_CINTERION_MODEM_FAMILY_IMT && charset == MM_MODEM_CHARSET_UCS2) + str = mm_charset_take_and_convert_to_utf8 (str, charset); + + mm_get_uint_from_hex_str (str, &val); + g_free (str); + + return val; +} + gboolean mm_cinterion_parse_scfg_test (const gchar *response, + MMCinterionModemFamily modem_family, MMModemCharset charset, GArray **supported_bands, + MMCinterionRadioBandFormat *format, GError **error) { - GRegex *r; - GMatchInfo *match_info; + g_autoptr(GRegex) r1 = NULL; + g_autoptr(GMatchInfo) match_info1 = NULL; + g_autoptr(GRegex) r2 = NULL; + g_autoptr(GMatchInfo) match_info2 = NULL; GError *inner_error = NULL; GArray *bands = NULL; + g_assert (format); + if (!response) { g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Missing response"); return FALSE; } - r = g_regex_new ("\\^SCFG:\\s*\"Radio/Band\",\\((?:\")?([0-9]*)(?:\")?-(?:\")?([0-9]*)(?:\")?.*\\)", - G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW, - 0, NULL); - g_assert (r != NULL); + r1 = g_regex_new ("\\^SCFG:\\s*\"Radio/Band\",\\((?:\")?([0-9]*)(?:\")?-(?:\")?([0-9]*)(?:\")?.*\\)", + G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW, 0, NULL); + g_assert (r1 != NULL); - g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &inner_error); - if (!inner_error && g_match_info_matches (match_info)) { - gchar *maxbandstr; + g_regex_match_full (r1, response, strlen (response), 0, 0, &match_info1, &inner_error); + if (inner_error) + goto finish; + if (g_match_info_matches (match_info1)) { + g_autofree gchar *maxbandstr = NULL; guint maxband = 0; - maxbandstr = mm_get_string_unquoted_from_match_info (match_info, 2); + *format = MM_CINTERION_RADIO_BAND_FORMAT_SINGLE; + + maxbandstr = mm_get_string_unquoted_from_match_info (match_info1, 2); if (maxbandstr) { /* Handle charset conversion if the number is given in UCS2 */ if (charset != MM_MODEM_CHARSET_UNKNOWN) @@ -144,14 +293,47 @@ mm_cinterion_parse_scfg_test (const gchar *response, } } } - - g_free (maxbandstr); + goto finish; } - g_match_info_free (match_info); - g_regex_unref (r); + r2 = g_regex_new ("\\^SCFG:\\s*\"Radio/Band/([234]G)\",\\(\"?([0-9A-Fa-fx]*)\"?-\"?([0-9A-Fa-fx]*)\"?\\)(,*\\(\"?([0-9A-Fa-fx]*)\"?-\"?([0-9A-Fa-fx]*)\"?\\))?", + 0, 0, NULL); + g_assert (r2 != NULL); + g_regex_match_full (r2, response, strlen (response), 0, 0, &match_info2, &inner_error); + if (inner_error) + goto finish; + while (g_match_info_matches (match_info2)) { + g_autofree gchar *techstr = NULL; + guint maxband; + + *format = MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE; + + techstr = mm_get_string_unquoted_from_match_info (match_info2, 1); + if (g_strcmp0 (techstr, "2G") == 0) { + maxband = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info2, 3), charset, modem_family); + parse_bands (maxband, &bands, MM_CINTERION_RB_BLOCK_GSM, modem_family); + } else if (g_strcmp0 (techstr, "3G") == 0) { + maxband = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info2, 3), charset, modem_family); + parse_bands (maxband, &bands, MM_CINTERION_RB_BLOCK_UMTS, modem_family); + } else if (g_strcmp0 (techstr, "4G") == 0) { + maxband = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info2, 3), charset, modem_family); + parse_bands (maxband, &bands, MM_CINTERION_RB_BLOCK_LTE_LOW, modem_family); + if (modem_family == MM_CINTERION_MODEM_FAMILY_DEFAULT) { + maxband = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info2, 6), charset, modem_family); + parse_bands (maxband, &bands, MM_CINTERION_RB_BLOCK_LTE_HIGH, modem_family); + } + } else { + inner_error = g_error_new (MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Couldn't parse ^SCFG=? response"); + break; + } + + g_match_info_next (match_info2, NULL); + } - if (!bands) +finish: + if (!bands && !inner_error) /* set error only if not already given */ inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "No valid bands found in ^SCFG=? response"); @@ -168,7 +350,7 @@ mm_cinterion_parse_scfg_test (const gchar *response, } /*****************************************************************************/ -/* ^SCFG response parser +/* ^SCFG response parser (2 types: 2G/3G and LTE) * * Example (3G): * AT^SCFG="Radio/Band" @@ -181,16 +363,42 @@ mm_cinterion_parse_scfg_test (const gchar *response, * Example (2G): * AT+SCFG="Radio/Band" * ^SCFG: "Radio/Band","3","3" + * + * Example LTE1 (GSM charset): + * AT^SCFG=? + * ... + * ^SCFG: "Radio/Band/2G","0x00000074" + * ^SCFG: "Radio/Band/3G","0x0004019B" + * ^SCFG: "Radio/Band/4G","0x080E08DF" + * ... + * AT^SCFG=? + * ... + * Example LTE1 (UCS2 charset): + * AT^SCFG=? + * ... + * ^SCFG: "Radio/Band/2G","0030007800300030003000300030003000370034" + * ^SCFG: "Radio/Band/3G","0030007800300030003000340030003100390042" + * ^SCFG: "Radio/Band/4G","0030007800300038003000450030003800440046" + * ... + * Example LTE2 (all charsets): + * AT^SCFG=? + * ... + * ^SCFG: "Radio/Band/2G","0000000f" + * ^SCFG: "Radio/Band/3G","000400b5" + * ^SCFG: "Radio/Band/4G","8a0e00d5","000000e2" + * ... */ gboolean -mm_cinterion_parse_scfg_response (const gchar *response, - MMModemCharset charset, - GArray **current_bands, - GError **error) +mm_cinterion_parse_scfg_response (const gchar *response, + MMCinterionModemFamily modem_family, + MMModemCharset charset, + GArray **current_bands, + MMCinterionRadioBandFormat format, + GError **error) { - GRegex *r; - GMatchInfo *match_info; + g_autoptr(GRegex) r = NULL; + g_autoptr(GMatchInfo) match_info = NULL; GError *inner_error = NULL; GArray *bands = NULL; @@ -199,45 +407,79 @@ mm_cinterion_parse_scfg_response (const gchar *response, return FALSE; } - r = g_regex_new ("\\^SCFG:\\s*\"Radio/Band\",\\s*\"?([0-9a-fA-F]*)\"?", 0, 0, NULL); - g_assert (r != NULL); - - if (g_regex_match (r, response, 0, &match_info)) { - gchar *currentstr; - guint current = 0; - - currentstr = mm_get_string_unquoted_from_match_info (match_info, 1); - if (currentstr) { - /* Handle charset conversion if the number is given in UCS2 */ - if (charset != MM_MODEM_CHARSET_UNKNOWN) - currentstr = mm_charset_take_and_convert_to_utf8 (currentstr, charset); - - mm_get_uint_from_str (currentstr, ¤t); - } - - if (current == 0) { - inner_error = g_error_new (MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "Couldn't parse ^SCFG response"); - } else { - guint i; + if (format == MM_CINTERION_RADIO_BAND_FORMAT_SINGLE) { + r = g_regex_new ("\\^SCFG:\\s*\"Radio/Band\",\\s*\"?([0-9a-fA-F]*)\"?", 0, 0, NULL); + g_assert (r != NULL); + g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &inner_error); + if (inner_error) + goto finish; + if (g_match_info_matches (match_info)) { + g_autofree gchar *currentstr = NULL; + guint current = 0; + + currentstr = mm_get_string_unquoted_from_match_info (match_info, 1); + if (currentstr) { + /* Handle charset conversion if the number is given in UCS2 */ + if (charset != MM_MODEM_CHARSET_UNKNOWN) + currentstr = mm_charset_take_and_convert_to_utf8 (currentstr, charset); + mm_get_uint_from_str (currentstr, ¤t); + } - for (i = 0; i < G_N_ELEMENTS (cinterion_bands); i++) { - if (current & cinterion_bands[i].cinterion_band_flag) { - if (G_UNLIKELY (!bands)) - bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 9); - g_array_append_val (bands, cinterion_bands[i].mm_band); + if (current == 0) { + inner_error = g_error_new (MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Couldn't parse ^SCFG? response"); + } else { + guint i; + + for (i = 0; i < G_N_ELEMENTS (cinterion_bands); i++) { + if (current & cinterion_bands[i].cinterion_band_flag) { + if (G_UNLIKELY (!bands)) + bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 9); + g_array_append_val (bands, cinterion_bands[i].mm_band); + } } } } + } else { /* format == MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE */ + r = g_regex_new ("\\^SCFG:\\s*\"Radio/Band/([234]G)\",\"?([0-9A-Fa-fx]*)\"?,?\"?([0-9A-Fa-fx]*)?\"?", + 0, 0, NULL); + g_assert (r != NULL); + g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &inner_error); + if (inner_error) + goto finish; + while (g_match_info_matches (match_info)) { + g_autofree gchar *techstr = NULL; + guint current; + + techstr = mm_get_string_unquoted_from_match_info (match_info, 1); + if (g_strcmp0(techstr, "2G") == 0) { + current = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info, 2), charset, modem_family); + parse_bands (current, &bands, MM_CINTERION_RB_BLOCK_GSM, modem_family); + + } else if (g_strcmp0(techstr, "3G") == 0) { + current = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info, 2), charset, modem_family); + parse_bands (current, &bands, MM_CINTERION_RB_BLOCK_UMTS, modem_family); + } else if (g_strcmp0(techstr, "4G") == 0) { + current = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info, 2), charset, modem_family); + parse_bands (current, &bands, MM_CINTERION_RB_BLOCK_LTE_LOW, modem_family); + if (modem_family == MM_CINTERION_MODEM_FAMILY_DEFAULT) { + current = take_and_convert_from_matched_string (mm_get_string_unquoted_from_match_info (match_info, 3), charset, modem_family); + parse_bands (current, &bands, MM_CINTERION_RB_BLOCK_LTE_HIGH, modem_family); + } + } else { + inner_error = g_error_new (MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Couldn't parse ^SCFG? response"); + break; + } - g_free (currentstr); + g_match_info_next (match_info, NULL); + } } - g_match_info_free (match_info); - g_regex_unref (r); - - if (!bands) +finish: + if (!bands && !inner_error) /* set error only if not already given */ inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "No valid bands found in ^SCFG response"); @@ -371,52 +613,101 @@ out: /* Build Cinterion-specific band value */ gboolean -mm_cinterion_build_band (GArray *bands, - guint supported, - gboolean only_2g, - guint *out_band, - GError **error) +mm_cinterion_build_band (GArray *bands, + guint *supported, + gboolean only_2g, + MMCinterionRadioBandFormat format, + MMCinterionModemFamily modem_family, + guint *out_band, + GError **error) { - guint band = 0; + guint band[MM_CINTERION_RB_BLOCK_N] = { 0 }; - /* The special case of ANY should be treated separately. */ - if (bands->len == 1 && g_array_index (bands, MMModemBand, 0) == MM_MODEM_BAND_ANY) { - band = supported; - } else { - guint i; + if (format == MM_CINTERION_RADIO_BAND_FORMAT_SINGLE) { + /* The special case of ANY should be treated separately. */ + if (bands->len == 1 && g_array_index (bands, MMModemBand, 0) == MM_MODEM_BAND_ANY) { + if (supported) + band[MM_CINTERION_RB_BLOCK_LEGACY] = supported[MM_CINTERION_RB_BLOCK_LEGACY]; + } else { + guint i; - for (i = 0; i < G_N_ELEMENTS (cinterion_bands); i++) { - guint j; + for (i = 0; i < G_N_ELEMENTS (cinterion_bands); i++) { + guint j; - for (j = 0; j < bands->len; j++) { - if (g_array_index (bands, MMModemBand, j) == cinterion_bands[i].mm_band) { - band |= cinterion_bands[i].cinterion_band_flag; - break; + for (j = 0; j < bands->len; j++) { + if (g_array_index (bands, MMModemBand, j) == cinterion_bands[i].mm_band) { + band[MM_CINTERION_RB_BLOCK_LEGACY] |= cinterion_bands[i].cinterion_band_flag; + break; + } } } + + /* 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[MM_CINTERION_RB_BLOCK_LEGACY])) + band[MM_CINTERION_RB_BLOCK_LEGACY] = 0; } - /* 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[MM_CINTERION_RB_BLOCK_LEGACY] == 0) { + g_autofree gchar *bands_string = NULL; - if (band == 0) { - gchar *bands_string; + bands_string = mm_common_build_bands_string ((MMModemBand *)(gpointer)bands->data, bands->len); + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "The given band combination is not supported: '%s'", + bands_string); + return FALSE; + } - bands_string = mm_common_build_bands_string ((MMModemBand *)(gpointer)bands->data, bands->len); - g_set_error (error, - MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "The given band combination is not supported: '%s'", - bands_string); - g_free (bands_string); - return FALSE; + } else { /* format == MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE */ + if (bands->len == 1 && g_array_index (bands, MMModemBand, 0) == MM_MODEM_BAND_ANY) { + if (supported) + memcpy (band, supported, sizeof (guint) * MM_CINTERION_RB_BLOCK_N); + } else { + guint i; + const CinterionBandEx *ref_bands; + guint nb_ref_bands; + + if (modem_family == MM_CINTERION_MODEM_FAMILY_IMT) { + ref_bands = cinterion_bands_imt; + nb_ref_bands = G_N_ELEMENTS (cinterion_bands_imt); + } else { + ref_bands = cinterion_bands_ex; + nb_ref_bands = G_N_ELEMENTS (cinterion_bands_ex); + } + + for (i = 0; i < nb_ref_bands; i++) { + guint j; + + for (j = 0; j < bands->len; j++) { + if (g_array_index (bands, MMModemBand, j) == ref_bands[i].mm_band) { + band[ref_bands[i].cinterion_band_block] |= ref_bands[i].cinterion_band_flag; + break; + } + } + } + } + + /* this modem family does not allow disabling all bands in a given technology through this command */ + if (modem_family == MM_CINTERION_MODEM_FAMILY_IMT && + (!band[MM_CINTERION_RB_BLOCK_GSM] || + !band[MM_CINTERION_RB_BLOCK_UMTS] || + !band[MM_CINTERION_RB_BLOCK_LTE_LOW])) { + g_autofree gchar *bands_string = NULL; + + bands_string = mm_common_build_bands_string ((MMModemBand *)(gpointer)bands->data, bands->len); + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "The given band combination is not supported: '%s'", + bands_string); + return FALSE; + } } - *out_band = band; + memcpy (out_band, band, sizeof (guint) * MM_CINTERION_RB_BLOCK_N); return TRUE; } @@ -875,7 +1166,7 @@ mm_cinterion_parse_ctzu_urc (GMatchInfo *match_info, gboolean mm_cinterion_parse_smoni_query_response (const gchar *response, - MMCinterionSmoniTech *out_tech, + MMCinterionRadioGen *out_tech, gdouble *out_rssi, gdouble *out_ecn0, gdouble *out_rscp, @@ -888,7 +1179,7 @@ mm_cinterion_parse_smoni_query_response (const gchar *response, g_autoptr(GMatchInfo) match_info = NULL; g_autoptr(GMatchInfo) match_info_pre = NULL; GError *inner_error = NULL; - MMCinterionSmoniTech tech = MM_CINTERION_SMONI_NO_TECH; + MMCinterionRadioGen tech = MM_CINTERION_RADIO_GEN_NONE; gdouble rssi = -G_MAXDOUBLE; gdouble ecn0 = -G_MAXDOUBLE; gdouble rscp = -G_MAXDOUBLE; @@ -970,7 +1261,7 @@ mm_cinterion_parse_smoni_query_response (const gchar *response, } #define FLOAT "([-+]?[0-9]+\\.?[0-9]*)" switch (tech) { - case MM_CINTERION_SMONI_2G: + case MM_CINTERION_RADIO_GEN_2G: r = g_regex_new ("\\^SMONI:\\s*2G,(\\d+),"FLOAT, 0, 0, NULL); g_assert (r != NULL); g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &inner_error); @@ -982,7 +1273,7 @@ mm_cinterion_parse_smoni_query_response (const gchar *response, } } break; - case MM_CINTERION_SMONI_3G: + case MM_CINTERION_RADIO_GEN_3G: r = g_regex_new ("\\^SMONI:\\s*3G,(\\d+),(\\d+),"FLOAT","FLOAT, 0, 0, NULL); g_assert (r != NULL); g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &inner_error); @@ -999,7 +1290,7 @@ mm_cinterion_parse_smoni_query_response (const gchar *response, } } break; - case MM_CINTERION_SMONI_4G: + case MM_CINTERION_RADIO_GEN_4G: r = g_regex_new ("\\^SMONI:\\s*4G,(\\d+),(\\d+),(\\d+),(\\d+),(\\w+),(\\d+),(\\d+),(\\w+),(\\w+),(\\d+),([^,]*),"FLOAT","FLOAT, 0, 0, NULL); g_assert (r != NULL); g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &inner_error); @@ -1025,7 +1316,7 @@ mm_cinterion_parse_smoni_query_response (const gchar *response, } } break; - case MM_CINTERION_SMONI_NO_TECH: + case MM_CINTERION_RADIO_GEN_NONE: default: goto out; } @@ -1064,7 +1355,7 @@ mm_cinterion_smoni_response_to_signal_info (const gchar *response, MMSignal **out_lte, GError **error) { - MMCinterionSmoniTech tech = MM_CINTERION_SMONI_NO_TECH; + MMCinterionRadioGen tech = MM_CINTERION_RADIO_GEN_NONE; gdouble rssi = MM_SIGNAL_UNKNOWN; gdouble ecn0 = MM_SIGNAL_UNKNOWN; gdouble rscp = MM_SIGNAL_UNKNOWN; @@ -1082,21 +1373,21 @@ mm_cinterion_smoni_response_to_signal_info (const gchar *response, return FALSE; switch (tech) { - case MM_CINTERION_SMONI_2G: + case MM_CINTERION_RADIO_GEN_2G: gsm = mm_signal_new (); mm_signal_set_rssi (gsm, rssi); break; - case MM_CINTERION_SMONI_3G: + case MM_CINTERION_RADIO_GEN_3G: umts = mm_signal_new (); mm_signal_set_rscp (umts, rscp); mm_signal_set_ecio (umts, ecn0); /* UMTS EcIo (assumed EcN0) */ break; - case MM_CINTERION_SMONI_4G: + case MM_CINTERION_RADIO_GEN_4G: lte = mm_signal_new (); mm_signal_set_rsrp (lte, rsrp); mm_signal_set_rsrq (lte, rsrq); break; - case MM_CINTERION_SMONI_NO_TECH: /* not registered, searching */ + case MM_CINTERION_RADIO_GEN_NONE: /* not registered, searching */ break; /* no error case */ default: /* should not happen, so if it does, error */ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.h b/plugins/cinterion/mm-modem-helpers-cinterion.h index a939e499..c35c5b3c 100644 --- a/plugins/cinterion/mm-modem-helpers-cinterion.h +++ b/plugins/cinterion/mm-modem-helpers-cinterion.h @@ -26,21 +26,51 @@ #define _LIBMM_INSIDE_MM #include <libmm-glib.h> +typedef enum { + MM_CINTERION_MODEM_FAMILY_DEFAULT = 0, + MM_CINTERION_MODEM_FAMILY_IMT = 1, +} MMCinterionModemFamily; + +typedef enum { + MM_CINTERION_RADIO_BAND_FORMAT_SINGLE = 0, + MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE = 1, +} MMCinterionRadioBandFormat; + +typedef enum { + MM_CINTERION_RB_BLOCK_LEGACY = 0, + MM_CINTERION_RB_BLOCK_GSM = 0, + MM_CINTERION_RB_BLOCK_UMTS = 1, + MM_CINTERION_RB_BLOCK_LTE_LOW = 2, + MM_CINTERION_RB_BLOCK_LTE_HIGH = 3, + MM_CINTERION_RB_BLOCK_N = 4 +} MMCinterionRbBlock; + +typedef enum { + MM_CINTERION_RADIO_GEN_NONE = 0, + MM_CINTERION_RADIO_GEN_2G = 2, + MM_CINTERION_RADIO_GEN_3G = 3, + MM_CINTERION_RADIO_GEN_4G = 4, +} MMCinterionRadioGen; + /*****************************************************************************/ /* ^SCFG test parser */ -gboolean mm_cinterion_parse_scfg_test (const gchar *response, - MMModemCharset charset, - GArray **supported_bands, - GError **error); +gboolean mm_cinterion_parse_scfg_test (const gchar *response, + MMCinterionModemFamily modem_family, + MMModemCharset charset, + GArray **supported_bands, + MMCinterionRadioBandFormat *format, + GError **error); /*****************************************************************************/ /* ^SCFG response parser */ -gboolean mm_cinterion_parse_scfg_response (const gchar *response, - MMModemCharset charset, - GArray **bands, - GError **error); +gboolean mm_cinterion_parse_scfg_response (const gchar *response, + MMCinterionModemFamily modem_family, + MMModemCharset charset, + GArray **bands, + MMCinterionRadioBandFormat format, + GError **error); /*****************************************************************************/ /* +CNMI test parser */ @@ -56,11 +86,13 @@ gboolean mm_cinterion_parse_cnmi_test (const gchar *response, /*****************************************************************************/ /* Build Cinterion-specific band value */ -gboolean mm_cinterion_build_band (GArray *bands, - guint supported, - gboolean only_2g, - guint *out_band, - GError **error); +gboolean mm_cinterion_build_band (GArray *bands, + guint *supported, + gboolean only_2g, + MMCinterionRadioBandFormat format, + MMCinterionModemFamily modem_family, + guint *out_band, + GError **error); /*****************************************************************************/ /* Single ^SIND response parser */ @@ -116,15 +148,8 @@ gboolean mm_cinterion_parse_ctzu_urc (GMatchInfo *match_info, /*****************************************************************************/ /* ^SMONI helper */ -typedef enum { /*< underscore_name=mm_modem_port_type >*/ - MM_CINTERION_SMONI_NO_TECH = 0, - MM_CINTERION_SMONI_2G = 2, - MM_CINTERION_SMONI_3G = 3, - MM_CINTERION_SMONI_4G = 4, -} MMCinterionSmoniTech; - gboolean mm_cinterion_parse_smoni_query_response (const gchar *response, - MMCinterionSmoniTech *out_tech, + MMCinterionRadioGen *out_tech, gdouble *out_rssi, gdouble *out_ecn0, gdouble *out_rscp, diff --git a/plugins/cinterion/tests/test-modem-helpers-cinterion.c b/plugins/cinterion/tests/test-modem-helpers-cinterion.c index ff21a921..b23a356e 100644 --- a/plugins/cinterion/tests/test-modem-helpers-cinterion.c +++ b/plugins/cinterion/tests/test-modem-helpers-cinterion.c @@ -34,17 +34,22 @@ static void common_test_scfg (const gchar *response, - GArray *expected_bands) + GArray *expected_bands, + MMModemCharset charset, + MMCinterionModemFamily modem_family) { GArray *bands = NULL; gchar *expected_bands_str; gchar *bands_str; GError *error = NULL; gboolean res; + MMCinterionRadioBandFormat format; res = mm_cinterion_parse_scfg_test (response, - MM_MODEM_CHARSET_UNKNOWN, + modem_family, + charset, &bands, + &format, &error); g_assert_no_error (error); g_assert (res == TRUE); @@ -111,7 +116,7 @@ test_scfg (void) single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); single = MM_MODEM_BAND_UTRAN_6, g_array_append_val (expected_bands, single); - common_test_scfg (response, expected_bands); + common_test_scfg (response, expected_bands, MM_MODEM_CHARSET_UNKNOWN, MM_CINTERION_MODEM_FAMILY_DEFAULT); g_array_unref (expected_bands); } @@ -179,7 +184,271 @@ test_scfg_ehs5 (void) single = MM_MODEM_BAND_UTRAN_1, g_array_append_val (expected_bands, single); single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); - common_test_scfg (response, expected_bands); + common_test_scfg (response, expected_bands, MM_MODEM_CHARSET_UNKNOWN, MM_CINTERION_MODEM_FAMILY_DEFAULT); + + g_array_unref (expected_bands); +} + +static void +test_scfg_pls62_gsm (void) +{ + GArray *expected_bands; + MMModemBand single; + const gchar *response = + "^SCFG: \"MEopMode/Prov/AutoSelect\",(\"off\",\"on\")\r\n" + "^SCFG: \"MEopMode/Prov/Cfg\",(\"fallback\",\"attus\")\r\n" + "^SCFG: \"Serial/Ifc\",(\"Current\",\"ASC0\",\"USB0\",\"USB1\",\"USB2\",\"MUX1\",\"MUX2\",\"MUX3\",\"0\"),(\"0\",\"3\"),(\"1200\",\"2400\",\"4800\",\"9600\",\"19200\",\"38400\",\"57600\",\"115200\",\"230400\",\"460800\",\"500000\",\"750000\",\"921600\"),(\"0)\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",(\"current\",\"powerup\"),(\"asc0\",\"acm1\",\"acm2\",\"acm3\",\"rmnet0\",\"rmnet1\")\r\n" + "^SCFG: \"Gpio/mode/ASC1\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/DCD0\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/DSR0\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/DTR0\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/FSR\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/PULSE\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/PWM\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/HWAKEUP\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/RING0\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/SPI\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"Gpio/mode/SYNC\",(\"std\",\"gpio\",\"rsv\")\r\n" + "^SCFG: \"GPRS/AutoAttach\",(\"disabled\",\"enabled\")\r\n" + "^SCFG: \"Ident/Manufacturer\",(25)\r\n" + "^SCFG: \"Ident/Product\",(25)\r\n" + "^SCFG: \"MEopMode/SoR\",(\"off\",\"on\")\r\n" + "^SCFG: \"MEopMode/CregRoam\",(\"0\",\"1\")\r\n" + "^SCFG: \"MeOpMode/SRPOM\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEopMode/RingOnData\",(\"off\",\"on\")\r\n" + "^SCFG: \"MEShutdown/Fso\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEShutdown/sVsup/threshold\",(\"-4\",\"-3\",\"-2\",\"-1\",\"0\",\"1\",\"2\",\"3\",\"4\"),(\"0\")\r\n" + "^SCFG: \"Radio/Band/2G\",(\"0x00000004\"-\"0x00000074\")\r\n" + "^SCFG: \"Radio/Band/3G\",(\"0x00000001\"-\"0x0004019B\")\r\n" + "^SCFG: \"Radio/Band/4G\",(\"0x00000001\"-\"0x080E08DF\")\r\n" + "^SCFG: \"Radio/Mtpl/2G\",(\"0\"-\"3\"),(\"1\"-\"8\"),(\"0x00000004\",\"0x00000010\",\"0x00000020\",\"0x00000040\"),,(\"18\"-\"33\"),(\"18\"-\"27\")\r\n" + "^SCFG: \"Radio/Mtpl/3G\",(\"0\"-\"3\"),(\"1\"-\"8\"),(\"0x00000001\",\"0x00000002\",\"0x00000008\",\"0x00000010\",\"0x00000080\",\"0x00000100\",\"0x00040000\"),,(\"18\"-\"24\")\r\n" + "^SCFG: \"Radio/Mtpl/4G\",(\"0\"-\"3\"),(\"1\"-\"8\"),(\"0x00000001\",\"0x00000002\",\"0x00000004\",\"0x00000008\",\"0x00000010\",\"0x00000040\",\"0x00000080\",\"0x00000800\",\"0x00020000\",\"0x00040000\",\"0x00080000\",\"0x08000000\"),,(\"18)\r\n" + "^SCFG: \"Radio/OutputPowerReduction\",(\"0\",\"1\",\"2\",\"3\",\"4\")\r\n" + "^SCFG: \"Serial/Interface/Allocation\",(\"0\",\"1\"),(\"0\",\"1\")\r\n" + "^SCFG: \"Serial/USB/DDD\",(\"0\",\"1\"),(\"0\"),(4),(4),(4),(63),(63),(4)\r\n" + "^SCFG: \"Tcp/IRT\",(\"1\"-\"60\")\r\n" + "^SCFG: \"Tcp/MR\",(\"2\"-\"30\")\r\n" + "^SCFG: \"Tcp/OT\",(\"1\"-\"6000\")\r\n" + "^SCFG: \"Tcp/WithURCs\",(\"on\",\"off\")\r\n" + "^SCFG: \"Trace/Syslog/OTAP\",(\"0\",\"1\"),(\"null\",\"asc0\",\"asc1\",\"usb\",\"usb1\",\"usb2\",\"file\",\"system\"),(\"1\"-\"65535\"),(125),(\"buffered\",\"secure\"),(\"off\",\"on\")\r\n" + "^SCFG: \"Urc/Ringline\",(\"off\",\"local\",\"asc0\",\"wakeup\")\r\n" + "^SCFG: \"Urc/Ringline/ActiveTime\",(\"0\",\"1\",\"2\")\r\n" + "^SCFG: \"Userware/Autostart\",(\"0\",\"1\")\r\n" + "^SCFG: \"Userware/Autostart/Delay\",(\"0\"-\"10000\")\r\n" + "^SCFG: \"Userware/DebugInterface\",(\"0\"-\"255\")|(\"FE80::\"-\"FE80::FFFFFFFFFFFFFFFF\"),(\"0\"-\"255\")|(\"FE80::\"-\"FE80::FFFFFFFFFFFFFFFF\"),(\"0\",\"1\")\r\n" + "^SCFG: \"Userware/DebugMode\",(\"off\",\"on\")\r\n" + "^SCFG: \"Userware/Passwd\",(\"0\"-\"8\")\r\n" + "^SCFG: \"Userware/Stdout\",(\"null\",\"asc0\",\"asc1\",\"usb\",\"usb1\",\"usb2\",\"file\",\"system\"),(\"1\"-\"65535\"),(\"0\"-\"125\"),(\"buffered\",\"secure\"),(\"off\",\"on\")\r\n" + "^SCFG: \"Userware/Watchdog\",(\"0\",\"1\",\"2\")\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",(\"current\",\"powerup\"),(\"asc0\",\"acm1\",\"acm2\",\"acm3\")\r\n"; + + expected_bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 23); + single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_DCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_PCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_G850, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_2, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_4, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_9, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_2, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_3, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_4, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_7, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_12, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_18, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_20, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_28, g_array_append_val (expected_bands, single); + + common_test_scfg (response, expected_bands, MM_MODEM_CHARSET_GSM, MM_CINTERION_MODEM_FAMILY_IMT); + + g_array_unref (expected_bands); +} + +static void +test_scfg_pls62_ucs2 (void) +{ + GArray *expected_bands; + MMModemBand single; + const gchar *response = + "^SCFG: \"MEopMode/Prov/AutoSelect\",(\"006F00660066\",\"006F006E\")\r\n" + "^SCFG: \"MEopMode/Prov/Cfg\",(\"fallback\",\"attus\")\r\n" + "^SCFG: \"Serial/Ifc\",(\"00430075007200720065006E0074\",\"0041005300430030\",\"0055005300420030\",\"0055005300420031\",\"0055005300420032\",\"004D005500580031\",\"004D005500580032\",\"004D005500580033\",\"0030\"),(\"0030\",\"0033)\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",(\"00630075007200720065006E0074\",\"0070006F00770065007200750070\"),(\"0061007300630030\",\"00610063006D0031\",\"00610063006D0032\",\"00610063006D0033\",\"0072006D006E006500740030\",\"0072006D0)\r\n" + "^SCFG: \"Gpio/mode/ASC1\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/DCD0\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/DSR0\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/DTR0\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/FSR\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/PULSE\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/PWM\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/HWAKEUP\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/RING0\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/SPI\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"Gpio/mode/SYNC\",(\"007300740064\",\"006700700069006F\",\"007200730076\")\r\n" + "^SCFG: \"GPRS/AutoAttach\",(\"00640069007300610062006C00650064\",\"0065006E00610062006C00650064\")\r\n" + "^SCFG: \"Ident/Manufacturer\",(25)\r\n" + "^SCFG: \"Ident/Product\",(25)\r\n" + "^SCFG: \"MEopMode/SoR\",(\"006F00660066\",\"006F006E\")\r\n" + "^SCFG: \"MEopMode/CregRoam\",(\"0030\",\"0031\")\r\n" + "^SCFG: \"MeOpMode/SRPOM\",(\"0030\",\"0031\")\r\n" + "^SCFG: \"MEopMode/RingOnData\",(\"006F00660066\",\"006F006E\")\r\n" + "^SCFG: \"MEShutdown/Fso\",(\"0030\",\"0031\")\r\n" + "^SCFG: \"MEShutdown/sVsup/threshold\",(\"002D0034\",\"002D0033\",\"002D0032\",\"002D0031\",\"0030\",\"0031\",\"0032\",\"0033\",\"0034\"),(\"0030\")\r\n" + "^SCFG: \"Radio/Band/2G\",(\"0030007800300030003000300030003000300034\"-\"0030007800300030003000300030003000370034\")\r\n" + "^SCFG: \"Radio/Band/3G\",(\"0030007800300030003000300030003000300031\"-\"0030007800300030003000340030003100390042\")\r\n" + "^SCFG: \"Radio/Band/4G\",(\"0030007800300030003000300030003000300031\"-\"0030007800300038003000450030003800440046\")\r\n" + "^SCFG: \"Radio/Mtpl/2G\",(\"00300022002D00220033\"),(\"00310022002D00220038\"),(\"00300078003000300030003000300030003000340022002C002200300078003000300030003000300030003100300022002C0022003000780030003000300030003)\r\n" + "^SCFG: \"Radio/Mtpl/3G\",(\"00300022002D00220033\"),(\"00310022002D00220038\"),(\"00300078003000300030003000300030003000310022002C002200300078003000300030003000300030003000320022002C0022003000780030003000300030003)\r\n" + "^SCFG: \"Radio/Mtpl/4G\",(\"00300022002D00220033\"),(\"00310022002D00220038\"),(\"00310022002D00220038\"),,(\"003100380022002D002200320033\")\r\n" + "^SCFG: \"Radio/OutputPowerReduction\",(\"0030\",\"0031\",\"0032\",\"0033\",\"0034\")\r\n" + "^SCFG: \"Serial/Interface/Allocation\",(\"0030\",\"0031\"),(\"0030\",\"0031\")\r\n" + "^SCFG: \"Serial/USB/DDD\",(\"0030\",\"0031\"),(\"0030\"),(4),(4),(4),(63),(63),(4)\r\n" + "^SCFG: \"Tcp/IRT\",(\"0031\"-\"00360030\")\r\n" + "^SCFG: \"Tcp/MR\",(\"0032\"-\"00330030\")\r\n" + "^SCFG: \"Tcp/OT\",(\"0031\"-\"0036003000300030\")\r\n" + "^SCFG: \"Tcp/WithURCs\",(\"006F006E\",\"006F00660066\")\r\n" + "^SCFG: \"Trace/Syslog/OTAP\",(\"0030\",\"0031\"),(\"006E0075006C006C\",\"0061007300630030\",\"0061007300630031\",\"007500730062\",\"0075007300620031\",\"0075007300620032\",\"00660069006C0065\",\"00730079007300740065006D\"),(\"003)\r\n" + "^SCFG: \"Urc/Ringline\",(\"006F00660066\",\"006C006F00630061006C\",\"0061007300630030\",\"00770061006B006500750070\")\r\n" + "^SCFG: \"Urc/Ringline/ActiveTime\",(\"0030\",\"0031\",\"0032\")\r\n" + "^SCFG: \"Userware/Autostart\",(\"0030\",\"0031\")\r\n" + "^SCFG: \"Userware/Autostart/Delay\",(\"00300022002D002200310030003000300030\")\r\n" + "^SCFG: \"Userware/DebugInterface\",(\"0030\"-\"003200350035\")|(\"0046004500380030003A003A\"-\"0046004500380030003A003A0046004600460046004600460046004600460046004600460046004600460046\"),(\"0030\"-\"003200350035\")|(\"004)\r\n" + "^SCFG: \"Userware/DebugMode\",(\"006F00660066\",\"006F006E\")\r\n" + "^SCFG: \"Userware/Passwd\",(\"0030\"-\"0038\")\r\n" + "^SCFG: \"Userware/Stdout\",(\"006E0075006C006C\",\"0061007300630030\",\"0061007300630031\",\"007500730062\",\"0075007300620031\",\"0075007300620032\",\"00660069006C0065\",\"00730079007300740065006D\"),(\"0031\"-\"00360035003500)\r\n" + "^SCFG: \"Userware/Watchdog\",(\"0030\",\"0031\",\"0032\")\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",(\"00630075007200720065006E0074\",\"0070006F00770065007200750070\"),(\"0061007300630030\",\"00610063006D0031\",\"00610063006D0032\",\"00610063006D0033\")\r\n"; + + expected_bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 23); + single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_DCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_PCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_G850, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_2, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_4, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_9, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_2, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_3, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_4, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_7, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_12, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_18, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_20, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_28, g_array_append_val (expected_bands, single); + + common_test_scfg (response, expected_bands, MM_MODEM_CHARSET_UCS2, MM_CINTERION_MODEM_FAMILY_IMT); + + g_array_unref (expected_bands); +} + +static void +test_scfg_alas5 (void) +{ + GArray *expected_bands; + MMModemBand single; + const gchar *response = + "^SCFG: \"Audio/Loop\",(\"0\",\"1\")\r\n" + "^SCFG: \"Audio/SvTone\",(\"0-2047\")\r\n" + "^SCFG: \"Call/Ecall/AckTimeout\",(\"0-60000\")\r\n" + "^SCFG: \"Call/Ecall/BlockSMSPP\",(\"0\",\"1\")\r\n" + "^SCFG: \"Call/Ecall/Callback\",(\"0\",\"1\")\r\n" + "^SCFG: \"Call/Ecall/CallbackTimeout\",(\"0-86400000\")\r\n" + "^SCFG: \"Call/Ecall/Force\",(\"0\",\"1\",\"2\")\r\n" + "^SCFG: \"Call/Ecall/Msd\",(280)\r\n" + "^SCFG: \"Call/Ecall/Pullmode\",(\"0\",\"1\")\r\n" + "^SCFG: \"Call/Ecall/SessionTimeout\",(\"0-300000\")\r\n" + "^SCFG: \"Call/Ecall/StartTimeout\",(\"0-600000\")\r\n" + "^SCFG: \"Call/ECC\",(\"0\"-\"255\")\r\n" + "^SCFG: \"Call/Speech/Codec\",(\"0\",\"2\")\r\n" + "^SCFG: \"GPRS/Auth\",(\"0\",\"1\",\"2\")\r\n" + "^SCFG: \"GPRS/AutoAttach\",(\"disabled\",\"enabled\")\r\n" + "^SCFG: \"GPRS/MTU/Mode\",(\"0-1\")\r\n" + "^SCFG: \"GPRS/MTU/Size\",(\"1280-4096\")\r\n" + "^SCFG: \"MEopMode/CFUN\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEopMode/CregRoam\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEopMode/Dormancy\",(\"0\",\"1\",\"9\")\r\n" + "^SCFG: \"MEopMode/DTM/Mode\",(\"0\",\"1\",\"2\")\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",(\"current\",\"powerup\"),(\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"diag\",\"mbim\",\"asc0\")\r\n" + "^SCFG: \"MEopMode/FGI/Split\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEopMode/IMS\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEopMode/NonBlock/Cops\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEopMode/PowerMgmt/LCI\",(\"disabled\",\"enabled\"),(\"GPIO1\",\"GPIO3\",\"GPIO4\",\"GPIO5\",\"GPIO6\",\"GPIO7\",\"GPIO8\",\"GPIO11\",\"GPIO12\",\"GPIO13\",\"GPIO14\",\"GPIO15\",\"GPIO16\",\"GPIO17\",\"GPIO22\")\r\n" + "^SCFG: \"MEopMode/Prov/AutoFallback\",(\"on\",\"off\")\r\n" + "^SCFG: \"MEopMode/Prov/AutoSelect\",(\"on\",\"off\")\r\n" + "^SCFG: \"MEopMode/Prov/Cfg\",(\"vdfde\",\"tmode\",\"clarobr\",\"telenorno\",\"telenorse\",\"vdfpt\",\"fallb3gpp*\",\"vdfww\",\"vdfes\",\"swisscomch\",\"eeuk\",\"orangero\",\"orangees\",\"tefde\",\"telenordk\",\"timit\",\"tn1de\",\"tefes\",\"tels)\r\n" + "^SCFG: \"MEopMode/PwrSave\",(\"disabled\",\"enabled\"),(\"0-36000\"),(\"0-36000\"),(\"CPU-A\",\"CPU-M\"),(\"powerup\",\"current\")\r\n" + "^SCFG: \"MEopMode/SRPOM\",(\"0\",\"1\")\r\n" + "^SCFG: \"MEopMode/USB/KeepData\",(\"current\",\"powerup\"),(\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"diag\",\"mbim\",\"asc0\")\r\n" + "^SCFG: \"MEShutdown/OnIgnition\",(\"on\",\"off\")\r\n" + "^SCFG: \"MEShutdown/Timer\",(\"off\",\"0\"-\"525600\")\r\n" + "^SCFG: \"Misc/CId\",(290)\r\n" + "^SCFG: \"Radio/Band/2G\",(\"00000001-0000000f\"),,(\"0\",\"1\")\r\n" + "^SCFG: \"Radio/Band/3G\",(\"00000001-000400b5\"),,(\"0\",\"1\")\r\n" + "^SCFG: \"Radio/Band/4G\",(\"00000001-8a0e00d5\"),(\"00000002-000001e2\"),(\"0\",\"1\")\r\n" + "^SCFG: \"Radio/CNS\",(\"0\",\"1\")\r\n" + "^SCFG: \"Radio/Mtpl\",(\"0-1\"),(\"1-8\")\r\n" + "^SCFG: \"Radio/Mtpl/2G\",(\"2-3\"),(\"1-8\"),(\"00000001-0000000f\"),,(\"18-33\"),(\"18-27\")\r\n" + "^SCFG: \"Radio/Mtpl/3G\",(\"2-3\"),(\"1-8\"),(\"00000001-000000b5\"),,(\"18-24\")\r\n" + "^SCFG: \"Radio/Mtpl/4G\",(\"2-3\"),(\"1-8\"),(\"00000001-8a0e00d5\"),(\"00000002-000000e2\"),(\"18-24\")\r\n" + "^SCFG: \"Radio/OutputPowerReduction\",(\"4\"-\"8\")\r\n" + "^SCFG: \"RemoteWakeUp/Event/ASC\",(\"none\",\"GPIO1\",\"GPIO3\",\"GPIO4\",\"GPIO5\",\"GPIO6\",\"GPIO7\",\"GPIO8\",\"GPIO11\",\"GPIO12\",\"GPIO13\",\"GPIO14\",\"GPIO15\",\"GPIO16\",\"GPIO17\",\"GPIO22\")\r\n" + "^SCFG: \"RemoteWakeUp/Event/URC\",(\"none\",\"GPIO1\",\"GPIO3\",\"GPIO4\",\"GPIO5\",\"GPIO6\",\"GPIO7\",\"GPIO8\",\"GPIO11\",\"GPIO12\",\"GPIO13\",\"GPIO14\",\"GPIO15\",\"GPIO16\",\"GPIO17\",\"GPIO22\")\r\n" + "^SCFG: \"RemoteWakeUp/Event/USB\",(\"none\",\"GPIO1\",\"GPIO3\",\"GPIO4\",\"GPIO5\",\"GPIO6\",\"GPIO7\",\"GPIO8\",\"GPIO11\",\"GPIO12\",\"GPIO13\",\"GPIO14\",\"GPIO15\",\"GPIO16\",\"GPIO17\",\"GPIO22\")\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",(\"current\",\"powerup\"),(\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"diag\",\"mbim\",\"asc0\")\r\n" + "^SCFG: \"RemoteWakeUp/Pulse\",(\"1\"-\"100\")\r\n" + "^SCFG: \"Serial/USB/DDD\",(\"0-1\"),(\"0\"),(\"0001-ffff\"),(\"0000-ffff\"),(\"0000-ffff\"),(63),(63),(4)\r\n" + "^SCFG: \"SIM/CS\",(\"NOSIM\",\"SIM1\",\"SIM2\")\r\n" + "^SCFG: \"SMS/4GPREF\",(\"IMS\",\"CSPS\")\r\n" + "^SCFG: \"SMS/AutoAck\",(\"0\",\"1\")\r\n" + "^SCFG: \"SMS/RETRM\",(\"1-45\")\r\n" + "^SCFG: \"URC/Ringline\",(\"off\",\"local\",\"asc0\")\r\n" + "^SCFG: \"URC/Ringline/ActiveTime\",(\"2\",\"on\",\"off\")\r\n"; + + expected_bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 23); + single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_DCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_PCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_G850, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_3, g_array_append_val (expected_bands, single); // + single = MM_MODEM_BAND_UTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_6, g_array_append_val (expected_bands, single); // + single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_3, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_7, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_18, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_20, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_26, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_28, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_38, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_39, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_40, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_41, g_array_append_val (expected_bands, single); + + common_test_scfg (response, expected_bands, MM_MODEM_CHARSET_GSM, MM_CINTERION_MODEM_FAMILY_DEFAULT); g_array_unref (expected_bands); } @@ -190,7 +459,9 @@ test_scfg_ehs5 (void) static void common_test_scfg_response (const gchar *response, MMModemCharset charset, - GArray *expected_bands) + GArray *expected_bands, + MMCinterionModemFamily modem_family, + MMCinterionRadioBandFormat rbf) { GArray *bands = NULL; gchar *expected_bands_str; @@ -198,7 +469,7 @@ common_test_scfg_response (const gchar *response, GError *error = NULL; gboolean res; - res = mm_cinterion_parse_scfg_response (response, charset, &bands, &error); + res = mm_cinterion_parse_scfg_response (response, modem_family, charset, &bands, rbf, &error); g_assert_no_error (error); g_assert (res == TRUE); g_assert (bands != NULL); @@ -233,7 +504,7 @@ test_scfg_response_2g (void) single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); single = MM_MODEM_BAND_DCS, g_array_append_val (expected_bands, single); - common_test_scfg_response (response, MM_MODEM_CHARSET_UNKNOWN, expected_bands); + common_test_scfg_response (response, MM_MODEM_CHARSET_UNKNOWN, expected_bands, MM_CINTERION_MODEM_FAMILY_DEFAULT, MM_CINTERION_RADIO_BAND_FORMAT_SINGLE); g_array_unref (expected_bands); } @@ -250,7 +521,7 @@ test_scfg_response_2g_ucs2 (void) expected_bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 9); single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); - common_test_scfg_response (response, MM_MODEM_CHARSET_UCS2, expected_bands); + common_test_scfg_response (response, MM_MODEM_CHARSET_UCS2, expected_bands, MM_CINTERION_MODEM_FAMILY_DEFAULT, MM_CINTERION_RADIO_BAND_FORMAT_SINGLE); g_array_unref (expected_bands); } @@ -273,7 +544,252 @@ test_scfg_response_3g (void) single = MM_MODEM_BAND_UTRAN_2, g_array_append_val (expected_bands, single); single = MM_MODEM_BAND_UTRAN_5, g_array_append_val (expected_bands, single); - common_test_scfg_response (response, MM_MODEM_CHARSET_UNKNOWN, expected_bands); + common_test_scfg_response (response, MM_MODEM_CHARSET_UNKNOWN, expected_bands, MM_CINTERION_MODEM_FAMILY_DEFAULT, MM_CINTERION_RADIO_BAND_FORMAT_SINGLE); + + g_array_unref (expected_bands); +} + +static void +test_scfg_response_pls62_gsm (void) +{ + GArray *expected_bands; + MMModemBand single; + const gchar *response = + "^SCFG: \"MEopMode/Prov/AutoSelect\",\"off\"\r\n" + "^SCFG: \"MEopMode/Prov/Cfg\",\"attus\"\r\n" + "^SCFG: \"Serial/Ifc\",\"0\"\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",\"current\"\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",\"powerup\"\r\n" + "^SCFG: \"Gpio/mode/ASC1\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/DCD0\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/DSR0\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/DTR0\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/FSR\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/PULSE\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/PWM\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/HWAKEUP\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/RING0\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/SPI\",\"gpio\"\r\n" + "^SCFG: \"Gpio/mode/SYNC\",\"gpio\"\r\n" + "^SCFG: \"GPRS/AutoAttach\",\"enabled\"\r\n" + "^SCFG: \"Ident/Manufacturer\",\"Cinterion\"\r\n" + "^SCFG: \"Ident/Product\",\"PLS62-W\"\r\n" + "^SCFG: \"MEopMode/SoR\",\"off\"\r\n" + "^SCFG: \"MEopMode/CregRoam\",\"0\"\r\n" + "^SCFG: \"MeOpMode/SRPOM\",\"0\"\r\n" + "^SCFG: \"MEopMode/RingOnData\",\"off\"\r\n" + "^SCFG: \"MEShutdown/Fso\",\"0\"\r\n" + "^SCFG: \"MEShutdown/sVsup/threshold\",\"0\",\"0\"\r\n" + "^SCFG: \"Radio/Band/2G\",\"0x00000014\"\r\n" + "^SCFG: \"Radio/Band/3G\",\"0x00000182\"\r\n" + "^SCFG: \"Radio/Band/4G\",\"0x080E0000\"\r\n" + "^SCFG: \"Radio/Mtpl/2G\",\"0\"\r\n" + "^SCFG: \"Radio/Mtpl/3G\",\"0\"\r\n" + "^SCFG: \"Radio/Mtpl/4G\",\"0\"\r\n" + "^SCFG: \"Radio/OutputPowerReduction\",\"4\"\r\n" + "^SCFG: \"Serial/Interface/Allocation\",\"0\",\"0\"\r\n" + "^SCFG: \"Serial/USB/DDD\",\"0\",\"0\",\"0409\",\"1E2D\",\"005B\",\"Cinterion Wireless Modules\",\"PLSx\",\"\"\r\n" + "^SCFG: \"Tcp/IRT\",\"3\"\r\n" + "^SCFG: \"Tcp/MR\",\"10\"\r\n" + "^SCFG: \"Tcp/OT\",\"6000\"\r\n" + "^SCFG: \"Tcp/WithURCs\",\"on\"\r\n" + "^SCFG: \"Trace/Syslog/OTAP\",\"0\"\r\n" + "^SCFG: \"Urc/Ringline\",\"local\"\r\n" + "^SCFG: \"Urc/Ringline/ActiveTime\",\"2\"\r\n" + "^SCFG: \"Userware/Autostart\",\"0\"\r\n" + "^SCFG: \"Userware/Autostart/Delay\",\"0\"\r\n" + "^SCFG: \"Userware/DebugInterface\",\"0.0.0.0\",\"0.0.0.0\",\"0\"\r\n" + "^SCFG: \"Userware/DebugMode\",\"off\"\r\n" + "^SCFG: \"Userware/Passwd\",\r\n" + "^SCFG: \"Userware/Stdout\",\"null\",,,,\"off\"\r\n" + "^SCFG: \"Userware/Watchdog\",\"0\"\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",\"current\"\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",\"powerup\"\r\n"; + + expected_bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 9); + single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_DCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_2, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_9, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_18, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_20, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_28, g_array_append_val (expected_bands, single); + + common_test_scfg_response (response, MM_MODEM_CHARSET_GSM, expected_bands, MM_CINTERION_MODEM_FAMILY_IMT, MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE); + + g_array_unref (expected_bands); +} + +static void +test_scfg_response_pls62_ucs2 (void) +{ + GArray *expected_bands; + MMModemBand single; + const gchar *response = + "^SCFG: \"MEopMode/Prov/AutoSelect\",\"006F00660066\"\r\n" + "^SCFG: \"MEopMode/Prov/Cfg\",\"00610074007400750073\"\r\n" + "^SCFG: \"Serial/Ifc\",\"0\"\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",\"00630075007200720065006E0074\"\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",\"0070006F00770065007200750070\"\r\n" + "^SCFG: \"Gpio/mode/ASC1\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/DCD0\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/DSR0\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/DTR0\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/FSR\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/PULSE\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/PWM\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/HWAKEUP\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/RING0\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/SPI\",\"006700700069006F\"\r\n" + "^SCFG: \"Gpio/mode/SYNC\",\"006700700069006F\"\r\n" + "^SCFG: \"GPRS/AutoAttach\",\"0065006E00610062006C00650064\"\r\n" + "^SCFG: \"Ident/Manufacturer\",\"Cinterion\"\r\n" + "^SCFG: \"Ident/Product\",\"PLS62-W\"\r\n" + "^SCFG: \"MEopMode/SoR\",\"006F00660066\"\r\n" + "^SCFG: \"MEopMode/CregRoam\",\"0030\"\r\n" + "^SCFG: \"MeOpMode/SRPOM\",\"0030\"\r\n" + "^SCFG: \"MEopMode/RingOnData\",\"006F00660066\"\r\n" + "^SCFG: \"MEShutdown/Fso\",\"0030\"\r\n" + "^SCFG: \"MEShutdown/sVsup/threshold\",\"0030\",\"0030\"\r\n" + "^SCFG: \"Radio/Band/2G\",\"0030007800300030003000300030003000310034\"\r\n" + "^SCFG: \"Radio/Band/3G\",\"0030007800300030003000300030003100380032\"\r\n" + "^SCFG: \"Radio/Band/4G\",\"0030007800300038003000450030003000300030\"\r\n" + "^SCFG: \"Radio/Mtpl/2G\",\"0030\"\r\n" + "^SCFG: \"Radio/Mtpl/3G\",\"0030\"\r\n" + "^SCFG: \"Radio/Mtpl/4G\",\"0030\"\r\n" + "^SCFG: \"Radio/OutputPowerReduction\",\"0034\"\r\n" + "^SCFG: \"Serial/Interface/Allocation\",\"0030\",\"0030\"\r\n" + "^SCFG: \"Serial/USB/DDD\",\"0030\",\"0030\",\"0030003400300039\",\"0031004500320044\",\"0030003000350042\",\"00430069006E0074006500720069006F006E00200057006900720065006C0065007300730020004D006F00640075006C00650073\",\"005\"\r\n" + "^SCFG: \"Tcp/IRT\",\"0033\"\r\n" + "^SCFG: \"Tcp/MR\",\"00310030\"\r\n" + "^SCFG: \"Tcp/OT\",\"0036003000300030\"\r\n" + "^SCFG: \"Tcp/WithURCs\",\"006F006E\"\r\n" + "^SCFG: \"Trace/Syslog/OTAP\",\"0030\"\r\n" + "^SCFG: \"Urc/Ringline\",\"006C006F00630061006C\"\r\n" + "^SCFG: \"Urc/Ringline/ActiveTime\",\"0032\"\r\n" + "^SCFG: \"Userware/Autostart\",\"0030\"\r\n" + "^SCFG: \"Userware/Autostart/Delay\",\"0030\"\r\n" + "^SCFG: \"Userware/DebugInterface\",\"0030002E0030002E0030002E0030\",\"0030002E0030002E0030002E0030\",\"0030\"\r\n" + "^SCFG: \"Userware/DebugMode\",\"006F00660066\"\r\n" + "^SCFG: \"Userware/Passwd\",\r\n" + "^SCFG: \"Userware/Stdout\",\"006E0075006C006C\",,,,\"006F00660066\"\r\n" + "^SCFG: \"Userware/Watchdog\",\"0030\"\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",\"00630075007200720065006E0074\"\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",\"0070006F00770065007200750070\"\r\n"; + + expected_bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 9); + single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_DCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_2, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_9, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_18, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_20, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_28, g_array_append_val (expected_bands, single); + + common_test_scfg_response (response, MM_MODEM_CHARSET_UCS2, expected_bands, MM_CINTERION_MODEM_FAMILY_IMT, MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE); + + g_array_unref (expected_bands); +} + +static void +test_scfg_response_alas5 (void) +{ + GArray *expected_bands; + MMModemBand single; + const gchar *response = + "^SCFG: \"Audio/Loop\",\"0\"\r\n" + "^SCFG: \"Audio/SvTone\",\"0\"\r\n" + "^SCFG: \"Call/Ecall/AckTimeout\",\"5000\"\r\n" + "^SCFG: \"Call/Ecall/BlockSMSPP\",\"0\"\r\n" + "^SCFG: \"Call/Ecall/Callback\",\"0\"\r\n" + "^SCFG: \"Call/Ecall/CallbackTimeout\",\"43200000\"\r\n" + "^SCFG: \"Call/Ecall/Force\",\"1\"\r\n" + "^SCFG: \"Call/Ecall/Msd\",\"\"\r\n" + "^SCFG: \"Call/Ecall/Pullmode\",\"0\"\r\n" + "^SCFG: \"Call/Ecall/SessionTimeout\",\"20000\"\r\n" + "^SCFG: \"Call/Ecall/StartTimeout\",\"5000\"\r\n" + "^SCFG: \"Call/ECC\",\"0\"\r\n" + "^SCFG: \"Call/Speech/Codec\",\"0\"\r\n" + "^SCFG: \"GPRS/Auth\",\"2\"\r\n" + "^SCFG: \"GPRS/AutoAttach\",\"enabled\"\r\n" + "^SCFG: \"GPRS/MTU/Mode\",\"0\"\r\n" + "^SCFG: \"GPRS/MTU/Size\",1500\r\n" + "^SCFG: \"MEopMode/CFUN\",\"1\",\"1\"\r\n" + "^SCFG: \"MEopMode/CregRoam\",\"0\"\r\n" + "^SCFG: \"MEopMode/Dormancy\",\"0\",\"0\"\r\n" + "^SCFG: \"MEopMode/DTM/Mode\",\"2\"\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",\"current\",\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"mbim\",\"asc0\"\r\n" + "^SCFG: \"MEopMode/ExpectDTR\",\"powerup\",\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"mbim\",\"asc0\"\r\n" + "^SCFG: \"MEopMode/FGI/Split\",\"1\"\r\n" + "^SCFG: \"MEopMode/IMS\",\"1\"\r\n" + "^SCFG: \"MEopMode/NonBlock/Cops\",\"0\"\r\n" + "^SCFG: \"MEopMode/PowerMgmt/LCI\",\"disabled\"\r\n" + "^SCFG: \"MEopMode/Prov/AutoFallback\",\"off\"\r\n" + "^SCFG: \"MEopMode/Prov/AutoSelect\",\"on\"\r\n" + "^SCFG: \"MEopMode/Prov/Cfg\",\"vdfde\"\r\n" + "^SCFG: \"MEopMode/PwrSave\",\"enabled\",\"52\",\"50\",\"CPU-A\",\"powerup\"\r\n" + "^SCFG: \"MEopMode/PwrSave\",\"enabled\",\"52\",\"50\",\"CPU-A\",\"current\"\r\n" + "^SCFG: \"MEopMode/PwrSave\",\"enabled\",\"0\",\"0\",\"CPU-M\",\"powerup\"\r\n" + "^SCFG: \"MEopMode/PwrSave\",\"enabled\",\"0\",\"0\",\"CPU-M\",\"current\"\r\n" + "^SCFG: \"MEopMode/SRPOM\",\"0\"\r\n" + "^SCFG: \"MEopMode/USB/KeepData\",\"current\",\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"diag\",\"mbim\",\"asc0\"\r\n" + "^SCFG: \"MEopMode/USB/KeepData\",\"powerup\",\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"diag\",\"mbim\",\"asc0\"\r\n" + "^SCFG: \"MEShutdown/OnIgnition\",\"off\"\r\n" + "^SCFG: \"MEShutdown/Timer\",\"off\"\r\n" + "^SCFG: \"Misc/CId\",\"\"\r\n" + "^SCFG: \"Radio/Band/2G\",\"0000000f\"\r\n" + "^SCFG: \"Radio/Band/3G\",\"000400b5\"\r\n" + "^SCFG: \"Radio/Band/4G\",\"8a0e00d5\",\"000000e2\"\r\n" + "^SCFG: \"Radio/CNS\",\"0\"\r\n" + "^SCFG: \"Radio/Mtpl\",\"0\"\r\n" + "^SCFG: \"Radio/Mtpl/2G\",\"0\"\r\n" + "^SCFG: \"Radio/Mtpl/3G\",\"0\"\r\n" + "^SCFG: \"Radio/Mtpl/4G\",\"0\"\r\n" + "^SCFG: \"Radio/OutputPowerReduction\",\"4\"\r\n" + "^SCFG: \"RemoteWakeUp/Event/ASC\",\"none\"\r\n" + "^SCFG: \"RemoteWakeUp/Event/URC\",\"none\"\r\n" + "^SCFG: \"RemoteWakeUp/Event/USB\",\"GPIO4\"\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",\"current\",\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"diag\",\"mbim\",\"asc0\"\r\n" + "^SCFG: \"RemoteWakeUp/Ports\",\"powerup\",\"acm0\",\"acm1\",\"acm2\",\"acm3\",\"diag\",\"mbim\",\"asc0\"\r\n" + "^SCFG: \"RemoteWakeUp/Pulse\",\"10\"\r\n" + "^SCFG: \"Serial/USB/DDD\",\"0\",\"0\",\"0409\",\"1e2d\",\"0065\",\"Cinterion\",\"LTE Modem\",\"8d8f\"\r\n" + "^SCFG: \"SIM/CS\",\"SIM1\"\r\n" + "^SCFG: \"SMS/4GPREF\",\"IMS\"\r\n" + "^SCFG: \"SMS/AutoAck\",\"0\"\r\n" + "^SCFG: \"SMS/RETRM\",\"30\"\r\n" + "^SCFG: \"URC/Ringline\",\"local\"\r\n" + "^SCFG: \"URC/Ringline/ActiveTime\",\"2\"\r\n"; + + expected_bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 25); + single = MM_MODEM_BAND_EGSM, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_DCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_PCS, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_G850, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_3, g_array_append_val (expected_bands, single); // + single = MM_MODEM_BAND_UTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_6, g_array_append_val (expected_bands, single); // + single = MM_MODEM_BAND_UTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_UTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_1, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_3, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_5, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_7, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_8, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_18, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_19, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_20, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_26, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_28, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_38, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_39, g_array_append_val (expected_bands, single); + single = MM_MODEM_BAND_EUTRAN_40, g_array_append_val (expected_bands, single); + + common_test_scfg_response (response, MM_MODEM_CHARSET_GSM, expected_bands, MM_CINTERION_MODEM_FAMILY_DEFAULT, MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE); g_array_unref (expected_bands); } @@ -865,7 +1381,7 @@ test_ctzu_urc_full (void) typedef struct { const gchar *str; - MMCinterionSmoniTech tech; + MMCinterionRadioGen tech; gdouble rssi; gdouble ecn0; gdouble rscp; @@ -876,7 +1392,7 @@ typedef struct { static const SMoniResponseTest smoni_response_tests[] = { { .str = "^SMONI: 2G,71,-61,262,02,0143,83BA,33,33,3,6,G,NOCONN", - .tech = MM_CINTERION_SMONI_2G, + .tech = MM_CINTERION_RADIO_GEN_2G, .rssi = -61.0, .ecn0 = 0.0, .rscp = 0.0, @@ -885,7 +1401,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 2G,SEARCH,SEARCH", - .tech = MM_CINTERION_SMONI_NO_TECH, + .tech = MM_CINTERION_RADIO_GEN_NONE, .rssi = 0.0, .ecn0 = 0.0, .rscp = 0.0, @@ -894,7 +1410,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 2G,673,-89,262,07,4EED,A500,16,16,7,4,G,5,-107,LIMSRV", - .tech = MM_CINTERION_SMONI_2G, + .tech = MM_CINTERION_RADIO_GEN_2G, .rssi = -89.0, .ecn0 = 0.0, .rscp = 0.0, @@ -903,7 +1419,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 2G,673,-80,262,07,4EED,A500,35,35,7,4,G,643,4,0,-80,0,S_FR", - .tech = MM_CINTERION_SMONI_2G, + .tech = MM_CINTERION_RADIO_GEN_2G, .rssi = -80.0, .ecn0 = 0.0, .rscp = 0.0, @@ -912,7 +1428,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 3G,10564,296,-7.5,-79,262,02,0143,00228FF,-92,-78,NOCONN", - .tech = MM_CINTERION_SMONI_3G, + .tech = MM_CINTERION_RADIO_GEN_3G, .rssi = 0.0, .ecn0 = -7.5, .rscp = -79.0, @@ -921,7 +1437,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 3G,SEARCH,SEARCH", - .tech = MM_CINTERION_SMONI_NO_TECH, + .tech = MM_CINTERION_RADIO_GEN_NONE, .rssi = 0.0, .ecn0 = 0, .rscp = 0, @@ -930,7 +1446,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 3G,10564,96,-6.5,-77,262,02,0143,00228FF,-92,-78,LIMSRV", - .tech = MM_CINTERION_SMONI_3G, + .tech = MM_CINTERION_RADIO_GEN_3G, .rssi = 0.0, .ecn0 = -6.5, .rscp = -77.0, @@ -939,7 +1455,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 3G,10737,131,-5,-93,260,01,7D3D,C80BC9A,--,--,----,---,-,-5,-93,0,01,06", - .tech = MM_CINTERION_SMONI_3G, + .tech = MM_CINTERION_RADIO_GEN_3G, .rssi = 0.0, .ecn0 = -5.0, .rscp = -93.0, @@ -948,7 +1464,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 4G,6300,20,10,10,FDD,262,02,BF75,0345103,350,33,-94,-7,NOCONN", - .tech = MM_CINTERION_SMONI_4G, + .tech = MM_CINTERION_RADIO_GEN_4G, .rssi = 0.0, .ecn0 = 0.0, .rscp = 0.0, @@ -957,7 +1473,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 4G,SEARCH", - .tech = MM_CINTERION_SMONI_NO_TECH, + .tech = MM_CINTERION_RADIO_GEN_NONE, .rssi = 0.0, .ecn0 = 0.0, .rscp = 0.0, @@ -966,7 +1482,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 4G,6300,20,10,10,FDD,262,02,BF75,0345103,350,33,-90,-6,LIMSRV", - .tech = MM_CINTERION_SMONI_4G, + .tech = MM_CINTERION_RADIO_GEN_4G, .rssi = 0.0, .ecn0 = 0.0, .rscp = 0.0, @@ -975,7 +1491,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 4G,6300,20,10,10,FDD,262,02,BF75,0345103,350,90,-101,-7,CONN", - .tech = MM_CINTERION_SMONI_4G, + .tech = MM_CINTERION_RADIO_GEN_4G, .rssi = 0.0, .ecn0 = 0.0, .rscp = 0.0, @@ -984,7 +1500,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 4G,2850,7,20,20,FDD,262,02,C096,027430F,275,11,-114,-9,NOCONN", - .tech = MM_CINTERION_SMONI_4G, + .tech = MM_CINTERION_RADIO_GEN_4G, .rssi = 0.0, .ecn0 = 0.0, .rscp = 0.0, @@ -993,7 +1509,7 @@ static const SMoniResponseTest smoni_response_tests[] = { }, { .str = "^SMONI: 4G,2850,7,20,20,FDD,262,02,C096,027430F,275,-,-113,-8,CONN", - .tech = MM_CINTERION_SMONI_4G, + .tech = MM_CINTERION_RADIO_GEN_4G, .rssi = 0.0, .ecn0 = 0.0, .rscp = 0.0, @@ -1010,7 +1526,7 @@ test_smoni_response (void) for (i = 0; i < G_N_ELEMENTS (smoni_response_tests); i++) { GError *error = NULL; gboolean success; - MMCinterionSmoniTech tech = MM_CINTERION_SMONI_NO_TECH; + MMCinterionRadioGen tech = MM_CINTERION_RADIO_GEN_NONE; gdouble rssi = MM_SIGNAL_UNKNOWN; gdouble ecn0 = MM_SIGNAL_UNKNOWN; gdouble rscp = MM_SIGNAL_UNKNOWN; @@ -1027,18 +1543,18 @@ test_smoni_response (void) g_assert_cmpuint (smoni_response_tests[i].tech, ==, tech); switch (smoni_response_tests[i].tech) { - case MM_CINTERION_SMONI_2G: + case MM_CINTERION_RADIO_GEN_2G: g_assert_cmpfloat_tolerance (rssi, smoni_response_tests[i].rssi, 0.1); break; - case MM_CINTERION_SMONI_3G: + case MM_CINTERION_RADIO_GEN_3G: g_assert_cmpfloat_tolerance (ecn0, smoni_response_tests[i].ecn0, 0.1); g_assert_cmpfloat_tolerance (rscp, smoni_response_tests[i].rscp, 0.1); break; - case MM_CINTERION_SMONI_4G: + case MM_CINTERION_RADIO_GEN_4G: g_assert_cmpfloat_tolerance (rsrp, smoni_response_tests[i].rsrp, 0.1); g_assert_cmpfloat_tolerance (rsrq, smoni_response_tests[i].rsrq, 0.1); break; - case MM_CINTERION_SMONI_NO_TECH: + case MM_CINTERION_RADIO_GEN_NONE: default: break; } @@ -1064,14 +1580,14 @@ test_smoni_response_to_signal (void) g_assert (success); switch (smoni_response_tests[i].tech) { - case MM_CINTERION_SMONI_2G: + case MM_CINTERION_RADIO_GEN_2G: g_assert (gsm); g_assert_cmpfloat_tolerance (mm_signal_get_rssi (gsm), smoni_response_tests[i].rssi, 0.1); g_object_unref (gsm); g_assert (!umts); g_assert (!lte); break; - case MM_CINTERION_SMONI_3G: + case MM_CINTERION_RADIO_GEN_3G: g_assert (umts); g_assert_cmpfloat_tolerance (mm_signal_get_rscp (umts), smoni_response_tests[i].rscp, 0.1); g_assert_cmpfloat_tolerance (mm_signal_get_ecio (umts), smoni_response_tests[i].ecn0, 0.1); @@ -1079,7 +1595,7 @@ test_smoni_response_to_signal (void) g_assert (!gsm); g_assert (!lte); break; - case MM_CINTERION_SMONI_4G: + case MM_CINTERION_RADIO_GEN_4G: g_assert (lte); g_assert_cmpfloat_tolerance (mm_signal_get_rsrp (lte), smoni_response_tests[i].rsrp, 0.1); g_assert_cmpfloat_tolerance (mm_signal_get_rsrq (lte), smoni_response_tests[i].rsrq, 0.1); @@ -1087,7 +1603,7 @@ test_smoni_response_to_signal (void) g_assert (!gsm); g_assert (!umts); break; - case MM_CINTERION_SMONI_NO_TECH: + case MM_CINTERION_RADIO_GEN_NONE: default: g_assert (!gsm); g_assert (!umts); @@ -1108,9 +1624,15 @@ int main (int argc, char **argv) g_test_add_func ("/MM/cinterion/scfg", test_scfg); g_test_add_func ("/MM/cinterion/scfg/ehs5", test_scfg_ehs5); + g_test_add_func ("/MM/cinterion/scfg/pls62/gsm", test_scfg_pls62_gsm); + g_test_add_func ("/MM/cinterion/scfg/pls62/ucs2", test_scfg_pls62_ucs2); + g_test_add_func ("/MM/cinterion/scfg/alas5", test_scfg_alas5); g_test_add_func ("/MM/cinterion/scfg/response/3g", test_scfg_response_3g); g_test_add_func ("/MM/cinterion/scfg/response/2g", test_scfg_response_2g); g_test_add_func ("/MM/cinterion/scfg/response/2g/ucs2", test_scfg_response_2g_ucs2); + g_test_add_func ("/MM/cinterion/scfg/response/pls62/gsm", test_scfg_response_pls62_gsm); + g_test_add_func ("/MM/cinterion/scfg/response/pls62/ucs2",test_scfg_response_pls62_ucs2); + g_test_add_func ("/MM/cinterion/scfg/response/alas5", test_scfg_response_alas5); g_test_add_func ("/MM/cinterion/cnmi/phs8", test_cnmi_phs8); g_test_add_func ("/MM/cinterion/cnmi/other", test_cnmi_other); g_test_add_func ("/MM/cinterion/swwan/pls8", test_swwan_pls8); |