aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2015-10-25 15:15:25 +0100
committerAleksander Morgado <aleksander@aleksander.es>2015-10-25 15:15:33 +0100
commit77b6b02fd37cd8d89961dc32814b186639d1bafa (patch)
tree76c0e39e00dba22ab98ed3df13f6a12c593c2dff /src
parent3f3ad507e264ec23342269171df57db7a92618df (diff)
sim-qmi: fix building MCCMNC string
For now, use 2 digits for MNC if < 100 and 3 digits otherwise.
Diffstat (limited to 'src')
-rw-r--r--src/mm-sim-qmi.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mm-sim-qmi.c b/src/mm-sim-qmi.c
index b4d0d93f..9c641ec6 100644
--- a/src/mm-sim-qmi.c
+++ b/src/mm-sim-qmi.c
@@ -293,11 +293,18 @@ load_operator_identifier_ready (QmiClientNas *client,
GError *error = NULL;
if (get_home_network (client, res, &mcc, &mnc, NULL, &error)) {
- gchar *operator_id;
-
- operator_id = g_strdup_printf ("%" G_GUINT16_FORMAT "%" G_GUINT16_FORMAT, mcc, mnc);
+ GString *aux;
+
+ aux = g_string_new ("");
+ /* MCC always 3 digits */
+ g_string_append_printf (aux, "%.3" G_GUINT16_FORMAT, mcc);
+ /* Guess about MNC, if < 100 assume it's 2 digits, no PCS info here */
+ if (mnc >= 100)
+ g_string_append_printf (aux, "%.3" G_GUINT16_FORMAT, mnc);
+ else
+ g_string_append_printf (aux, "%.2" G_GUINT16_FORMAT, mnc);
g_simple_async_result_set_op_res_gpointer (simple,
- operator_id,
+ g_string_free (aux, FALSE),
(GDestroyNotify)g_free);
} else {
g_simple_async_result_take_error (simple, error);