summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-09-02 15:11:05 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-09-02 15:11:05 +0200
commitc348213e764f938c9805371941a36e3719681101 (patch)
tree99cf50ac1de346a2ff36bb105971a8bd8392a9a1
parent186cf658962a02ef776fdad3e4b93420f3fcc9a5 (diff)
downloadlibqmi-aleksander/uim.tar.gz
uim: fix 'File ID' TLV formataleksander/uim
The 'File ID' TLV expects the File path given as a sequence of BE-encoded 16-bit numbers; but the actual array is given as a 8-bit encoded array (i.e. size of the array should be in bytes). So instead of a 'File ID' like this: 46:6F:02:00:3F:20:7F it should be like this: 46:6F:04:00:3F:20:7F
-rw-r--r--cli/qmicli-uim.c71
-rw-r--r--data/qmi-service-uim.json6
2 files changed, 38 insertions, 39 deletions
diff --git a/cli/qmicli-uim.c b/cli/qmicli-uim.c
index 3f0aa45b..ed3ebdc6 100644
--- a/cli/qmicli-uim.c
+++ b/cli/qmicli-uim.c
@@ -181,6 +181,39 @@ static const SimFile sim_files[] = {
};
static void
+get_sim_file_id_and_path (const gchar *file_name,
+ guint16 *file_id,
+ GArray **file_path)
+{
+ guint i;
+ guint8 val;
+
+ for (i = 0; i < G_N_ELEMENTS (sim_files); i++) {
+ if (g_str_equal (sim_files[i].name, file_name))
+ break;
+ }
+
+ g_assert (i != G_N_ELEMENTS (sim_files));
+
+ *file_path = g_array_sized_new (FALSE, FALSE, sizeof (guint8), 4);
+
+ val = sim_files[i].path[0] & 0xFF;
+ g_array_append_val (*file_path, val);
+ val = (sim_files[i].path[0] >> 8) & 0xFF;
+ g_array_append_val (*file_path, val);
+
+ if (sim_files[i].path[2] != 0) {
+ val = sim_files[i].path[1] & 0xFF;
+ g_array_append_val (*file_path, val);
+ val = (sim_files[i].path[1] >> 8) & 0xFF;
+ g_array_append_val (*file_path, val);
+ *file_id = sim_files[i].path[2];
+ } else {
+ *file_id = sim_files[i].path[1];
+ }
+}
+
+static void
read_transparent_ready (QmiClientUim *client,
GAsyncResult *res)
{
@@ -258,25 +291,8 @@ read_transparent_build_input (const gchar *file_name)
QmiMessageUimReadTransparentInput *input;
guint16 file_id = 0;
GArray *file_path = NULL;
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (sim_files); i++) {
- if (g_str_equal (sim_files[i].name, file_name))
- break;
- }
-
- g_assert (i != G_N_ELEMENTS (sim_files));
- file_path = g_array_sized_new (FALSE, FALSE, sizeof (guint16), 3);
- g_array_append_val (file_path, sim_files[i].path[0]);
- if (sim_files[i].path[2] != 0) {
- g_array_append_val (file_path, sim_files[i].path[1]);
- g_array_append_val (file_path, sim_files[i].path[2]);
- file_id = sim_files[i].path[2];
- } else {
- g_array_append_val (file_path, sim_files[i].path[1]);
- file_id = sim_files[i].path[1];
- }
+ get_sim_file_id_and_path (file_name, &file_id, &file_path);
input = qmi_message_uim_read_transparent_input_new ();
qmi_message_uim_read_transparent_input_set_session_information (
@@ -454,25 +470,8 @@ get_file_attributes_build_input (const gchar *file_name)
QmiMessageUimGetFileAttributesInput *input;
guint16 file_id = 0;
GArray *file_path = NULL;
- guint i;
- for (i = 0; i < G_N_ELEMENTS (sim_files); i++) {
- if (g_str_equal (sim_files[i].name, file_name))
- break;
- }
-
- g_assert (i != G_N_ELEMENTS (sim_files));
-
- file_path = g_array_sized_new (FALSE, FALSE, sizeof (guint16), 3);
- g_array_append_val (file_path, sim_files[i].path[0]);
- if (sim_files[i].path[2] != 0) {
- g_array_append_val (file_path, sim_files[i].path[1]);
- g_array_append_val (file_path, sim_files[i].path[2]);
- file_id = sim_files[i].path[2];
- } else {
- g_array_append_val (file_path, sim_files[i].path[1]);
- file_id = sim_files[i].path[1];
- }
+ get_sim_file_id_and_path (file_name, &file_id, &file_path);
input = qmi_message_uim_get_file_attributes_input_new ();
qmi_message_uim_get_file_attributes_input_set_session_information (
diff --git a/data/qmi-service-uim.json b/data/qmi-service-uim.json
index 761cfa83..7ac1d0a0 100644
--- a/data/qmi-service-uim.json
+++ b/data/qmi-service-uim.json
@@ -45,7 +45,7 @@
"format" : "guint16" },
{ "name" : "File Path",
"format" : "array",
- "array-element" : { "format" : "guint16" } } ] },
+ "array-element" : { "format" : "guint8" } } ] },
{ "name" : "Read Information",
"id" : "0x03",
"mandatory" : "yes",
@@ -123,7 +123,7 @@
"format" : "guint16" },
{ "name" : "File Path",
"format" : "array",
- "array-element" : { "format" : "guint16" } } ] },
+ "array-element" : { "format" : "guint8" } } ] },
{ "name" : "Record",
"id" : "0x03",
"mandatory" : "yes",
@@ -201,7 +201,7 @@
"format" : "guint16" },
{ "name" : "File Path",
"format" : "array",
- "array-element" : { "format" : "guint16" } } ] },
+ "array-element" : { "format" : "guint8" } } ] },
{ "name" : "Response In Indication Token",
"id" : "0x10",
"mandatory" : "no",