aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@google.com>2022-08-03 14:32:24 +0000
committerAleksander Morgado <aleksander@aleksander.es>2022-08-19 15:53:43 +0000
commit210020c7d21fb0eebb81d70d6c47377aac80a3ba (patch)
treec92e340e37d4a443aee9b94f3c797342415a59c1 /cli
parent59e36c6838aef2c11ff4106c2e65a9d5a99ff83f (diff)
cli,sim: print GID1 and GID2 fields if available
Diffstat (limited to 'cli')
-rw-r--r--cli/mmcli-output.c2
-rw-r--r--cli/mmcli-output.h2
-rw-r--r--cli/mmcli-sim.c13
3 files changed, 16 insertions, 1 deletions
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index ff0dd23a..c3f0d0e7 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -301,6 +301,8 @@ static FieldInfo field_infos[] = {
[MMC_F_SIM_PROPERTIES_IMSI] = { "sim.properties.imsi", "imsi", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_ICCID] = { "sim.properties.iccid", "iccid", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_EID] = { "sim.properties.eid", "eid", MMC_S_SIM_PROPERTIES, },
+ [MMC_F_SIM_PROPERTIES_GID1] = { "sim.properties.gid1", "gid1", MMC_S_SIM_PROPERTIES, },
+ [MMC_F_SIM_PROPERTIES_GID2] = { "sim.properties.gid2", "gid2", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_OPERATOR_ID] = { "sim.properties.operator-code", "operator id", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_OPERATOR_NAME] = { "sim.properties.operator-name", "operator name", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_EMERGENCY_NUMBERS] = { "sim.properties.emergency-numbers", "emergency numbers", MMC_S_SIM_PROPERTIES, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index 309fc8e9..efcd51af 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -323,6 +323,8 @@ typedef enum {
MMC_F_SIM_PROPERTIES_OPERATOR_NAME,
MMC_F_SIM_PROPERTIES_EMERGENCY_NUMBERS,
MMC_F_SIM_PROPERTIES_PREFERRED_NETWORKS,
+ MMC_F_SIM_PROPERTIES_GID1,
+ MMC_F_SIM_PROPERTIES_GID2,
MMC_F_SIM_PROPERTIES_SIM_TYPE,
MMC_F_SIM_PROPERTIES_ESIM_STATUS,
MMC_F_SIM_PROPERTIES_REMOVABILITY,
diff --git a/cli/mmcli-sim.c b/cli/mmcli-sim.c
index 3a384ed1..871d0ab7 100644
--- a/cli/mmcli-sim.c
+++ b/cli/mmcli-sim.c
@@ -164,7 +164,11 @@ mmcli_sim_shutdown (void)
static void
print_sim_info (MMSim *sim)
{
- GList *preferred_nets_list;
+ GList *preferred_nets_list;
+ const guint8 *gid1bin;
+ gsize gid1bin_size;
+ const guint8 *gid2bin;
+ gsize gid2bin_size;
mmcli_output_string (MMC_F_SIM_GENERAL_DBUS_PATH, mm_sim_get_path (sim));
mmcli_output_string (MMC_F_SIM_PROPERTIES_ACTIVE, mm_sim_get_active (sim) ? "yes" : "no");
@@ -174,9 +178,16 @@ print_sim_info (MMSim *sim)
mmcli_output_string (MMC_F_SIM_PROPERTIES_OPERATOR_ID, mm_sim_get_operator_identifier (sim));
mmcli_output_string (MMC_F_SIM_PROPERTIES_OPERATOR_NAME, mm_sim_get_operator_name (sim));
mmcli_output_string_array (MMC_F_SIM_PROPERTIES_EMERGENCY_NUMBERS, (const gchar **) mm_sim_get_emergency_numbers (sim), FALSE);
+
preferred_nets_list = mm_sim_get_preferred_networks (sim);
mmcli_output_preferred_networks (preferred_nets_list);
g_list_free_full (preferred_nets_list, (GDestroyNotify) mm_sim_preferred_network_free);
+
+ gid1bin = mm_sim_get_gid1 (sim, &gid1bin_size);
+ gid2bin = mm_sim_get_gid2 (sim, &gid2bin_size);
+ mmcli_output_string_take (MMC_F_SIM_PROPERTIES_GID1, gid1bin ? mm_utils_bin2hexstr (gid1bin, gid1bin_size) : NULL);
+ mmcli_output_string_take (MMC_F_SIM_PROPERTIES_GID2, gid2bin ? mm_utils_bin2hexstr (gid2bin, gid2bin_size) : NULL);
+
mmcli_output_string (MMC_F_SIM_PROPERTIES_SIM_TYPE, mm_sim_type_get_string (mm_sim_get_sim_type (sim)));
mmcli_output_string (MMC_F_SIM_PROPERTIES_ESIM_STATUS, mm_sim_esim_status_get_string (mm_sim_get_esim_status (sim)));
mmcli_output_string (MMC_F_SIM_PROPERTIES_REMOVABILITY, mm_sim_removability_get_string (mm_sim_get_removability (sim)));