diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-29 19:09:37 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-09-02 16:14:16 +0200 |
commit | 8b523a05250cb4b18731452f693c4a9e0f232904 (patch) | |
tree | a4915d188f655ef8d0975cf7348472bfaf2cb3ad | |
parent | 4f30ae0d563b0b53ac88fc57c5c087332af4eeaf (diff) | |
download | external_libqmi-8b523a05250cb4b18731452f693c4a9e0f232904.zip external_libqmi-8b523a05250cb4b18731452f693c4a9e0f232904.tar.gz external_libqmi-8b523a05250cb4b18731452f693c4a9e0f232904.tar.bz2 |
cli: new `--uim-read-efimsi' action
-rw-r--r-- | cli/qmicli-uim.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/cli/qmicli-uim.c b/cli/qmicli-uim.c index 0d000b0..9593837 100644 --- a/cli/qmicli-uim.c +++ b/cli/qmicli-uim.c @@ -43,6 +43,7 @@ static Context *ctx; /* Options */ static gboolean read_efspn_flag; +static gboolean read_efimsi_flag; static gboolean reset_flag; static gboolean noop_flag; @@ -51,6 +52,10 @@ static GOptionEntry entries[] = { "Read the EFspn file", NULL }, + { "uim-read-efimsi", 0, 0, G_OPTION_ARG_NONE, &read_efimsi_flag, + "Read the EFimsi file", + NULL + }, { "uim-reset", 0, 0, G_OPTION_ARG_NONE, &reset_flag, "Reset the service state", NULL @@ -87,6 +92,7 @@ qmicli_uim_options_enabled (void) return !!n_actions; n_actions = (read_efspn_flag + + read_efimsi_flag + reset_flag + noop_flag); @@ -178,6 +184,19 @@ read_transparent_ready (QmiClientUim *client, if (!qmi_message_uim_read_transparent_output_get_result (output, &error)) { g_printerr ("error: couldn't read transparent file from the UIM: %s\n", error->message); g_error_free (error); + + /* Card result */ + if (qmi_message_uim_read_transparent_output_get_card_result ( + output, + &sw1, + &sw2, + NULL)) { + g_print ("Card result:\n" + "\tSW1: '0x%02x'\n" + "\tSW2: '0x%02x'\n", + sw1, sw2); + } + qmi_message_uim_read_transparent_output_unref (output); shutdown (FALSE); return; @@ -193,8 +212,8 @@ read_transparent_ready (QmiClientUim *client, &sw2, NULL)) { g_print ("Card result:\n" - "\tSW1: '%u'\n" - "\tSW2: '%u'\n", + "\tSW1: '0x%02x'\n" + "\tSW2: '0x%02x'\n", sw1, sw2); } @@ -207,7 +226,7 @@ read_transparent_ready (QmiClientUim *client, str = qmicli_get_raw_data_printable (read_result, 80, "\t"); g_print ("Read result:\n" - "\t%s\n", + "%s\n", str); g_free (str); } @@ -223,6 +242,7 @@ typedef struct { static const SimFile sim_files[] = { { "EFspn", { 0x3F00, 0x7F20, 0x6F46 } }, + { "EFimsi", { 0x3F00, 0x7F20, 0x6F07 } } }; static QmiMessageUimReadTransparentInput * @@ -288,6 +308,22 @@ qmicli_uim_run (QmiDevice *device, return; } + /* Request to read EFimsi? */ + if (read_efimsi_flag) { + QmiMessageUimReadTransparentInput *input; + + input = read_transparent_build_input ("EFimsi"); + g_debug ("Asynchronously reading EFimsi..."); + qmi_client_uim_read_transparent (ctx->client, + input, + 10, + ctx->cancellable, + (GAsyncReadyCallback)read_transparent_ready, + NULL); + qmi_message_uim_read_transparent_input_unref (input); + return; + } + /* Request to reset UIM service? */ if (reset_flag) { g_debug ("Asynchronously resetting UIM service..."); |