diff options
author | Teijo Kinnunen <teijo.kinnunen@uros.com> | 2021-02-26 13:25:14 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-03-01 13:37:03 +0000 |
commit | e0900654d60dedab83a9dc1a2f4a74aa73b6e4b2 (patch) | |
tree | 1c4f3e156ffadb108d4bcd728788bc89115bede4 | |
parent | 715e67c489294a0534754e19a73d2c7023448fab (diff) |
qmicli,helpers: return PCS digit status in qmicli_read_parse_3gpp_mcc_mnc
-rw-r--r-- | src/qmicli/qmicli-helpers.c | 15 | ||||
-rw-r--r-- | src/qmicli/qmicli-helpers.h | 3 | ||||
-rw-r--r-- | src/qmicli/qmicli-nas.c | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/qmicli/qmicli-helpers.c b/src/qmicli/qmicli-helpers.c index 5fc043e..e44fec2 100644 --- a/src/qmicli/qmicli-helpers.c +++ b/src/qmicli/qmicli-helpers.c @@ -377,7 +377,8 @@ qmicli_read_ssp_rat_options_from_string (const gchar *str, static gboolean parse_3gpp_mcc_mnc (const gchar *str, guint16 *out_mcc, - guint16 *out_mnc) + guint16 *out_mnc, + gboolean *out_pcs_digit) { guint len; guint i; @@ -405,6 +406,8 @@ parse_3gpp_mcc_mnc (const gchar *str, } else memcpy (&aux[0], &str[3], 3); *out_mnc = atoi (aux); + if (out_pcs_digit) + *out_pcs_digit = len == 6; return TRUE; } @@ -426,7 +429,7 @@ qmicli_read_ssp_net_options_from_string (const gchar *str, if (equals) { /* Parse MCC/MNC */ *equals++ = '\0'; - if (!parse_3gpp_mcc_mnc (equals, &mcc, &mnc)) { + if (!parse_3gpp_mcc_mnc (equals, &mcc, &mnc, NULL)) { g_free (copy); g_printerr ("error: invalid net selection MCC/MNC: '%s'\n", equals); return FALSE; @@ -451,19 +454,23 @@ qmicli_read_ssp_net_options_from_string (const gchar *str, gboolean qmicli_read_parse_3gpp_mcc_mnc (const gchar *str, guint16 *out_mcc, - guint16 *out_mnc) + guint16 *out_mnc, + gboolean *out_pcs_digit) { g_autofree gchar *copy = NULL; guint16 mcc = 0, mnc = 0; + gboolean pcs_digit = FALSE; copy = g_strdup (str); - if (!parse_3gpp_mcc_mnc (copy, &mcc, &mnc)) { + if (!parse_3gpp_mcc_mnc (copy, &mcc, &mnc, &pcs_digit)) { g_printerr ("error: invalid net selection MCC/MNC: '%s'\n", str); return FALSE; } *out_mcc = mcc; *out_mnc = mnc; + if (out_pcs_digit) + *out_pcs_digit = pcs_digit; return TRUE; } diff --git a/src/qmicli/qmicli-helpers.h b/src/qmicli/qmicli-helpers.h index 369a3c1..077047e 100644 --- a/src/qmicli/qmicli-helpers.h +++ b/src/qmicli/qmicli-helpers.h @@ -94,7 +94,8 @@ gboolean qmicli_read_ssp_net_options_from_string (const gchar *str, guint16 *out_network_mnc); gboolean qmicli_read_parse_3gpp_mcc_mnc (const gchar *str, guint16 *out_mcc, - guint16 *out_mnc); + guint16 *out_mnc, + gboolean *out_pcs_digit); gboolean qmicli_read_enable_disable_from_string (const gchar *str, gboolean *out); gboolean qmicli_read_firmware_id_from_string (const gchar *str, diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c index 4cf4262..70371e6 100644 --- a/src/qmicli/qmicli-nas.c +++ b/src/qmicli/qmicli-nas.c @@ -3439,7 +3439,7 @@ set_plmn_name_input_plmn_create (const gchar *str) guint16 mcc = 0; guint16 mnc = 0; - if (!qmicli_read_parse_3gpp_mcc_mnc (str, &mcc, &mnc)) { + if (!qmicli_read_parse_3gpp_mcc_mnc (str, &mcc, &mnc, NULL)) { g_printerr ("error: invalid net selection MCC/MNC: '%s'\n", str); return NULL; } |