* [PATCH] Accept opaque data in EF_ICCID.
@ 2010-05-21 15:56 Pekka Pessi
2010-05-27 20:39 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Pekka Pessi @ 2010-05-21 15:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 974 bytes --]
---
src/sim.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index c1c8340..1f4b944 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1304,13 +1304,21 @@ static void sim_iccid_read_cb(int ok, int length, int record,
struct ofono_sim *sim = userdata;
const char *path = __ofono_atom_get_path(sim->atom);
DBusConnection *conn = ofono_dbus_get_connection();
- char iccid[21]; /* ICCID max length is 20 + 1 for NULL */
+ char iccid[21]; /* ICCID max length is 20 + 1 for NUL */
+ int i;
if (!ok || length < 10)
return;
- extract_bcd_number(data, length, iccid);
- iccid[20] = '\0';
+ for (i = 0; i < 10; i++) {
+ unsigned char b = data[i];
+ sprintf(iccid + 2 * i, "%x%x", b & 0xf, b >> 4);
+ }
+
+ for (i = 20; i > 0 && iccid[i - 1] == 'f'; i--)
+ ;
+ iccid[i] = '\0';
+
sim->iccid = g_strdup(iccid);
ofono_dbus_signal_property_changed(conn, path,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-27 20:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 15:56 [PATCH] Accept opaque data in EF_ICCID Pekka Pessi
2010-05-27 20:39 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.