From ba0701b67d3fc2e6936477bd08440ff36a3878aa Mon Sep 17 00:00:00 2001 From: Eric Caruso Date: Tue, 4 May 2021 13:38:57 -0700 Subject: [PATCH] mm-shared-qmi: parse ICCID as hex instead of BCD Fixes issue 364. --- src/mm-shared-qmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c index 695ca341..35911713 100644 --- a/src/mm-shared-qmi.c +++ b/src/mm-shared-qmi.c @@ -3308,8 +3308,10 @@ uim_get_slot_status_ready (QmiClientUim *client, continue; } - raw_iccid = mm_bcd_to_string ((const guint8 *)slot_status->iccid->data, slot_status->iccid->len, - TRUE /* low_nybble_first */); + /* This is supposed to be BCD, but some carriers have non-spec-compliant ICCIDs that use + * A-F characters as part of the operator-specific part of the ICCID. Parse it as hex and + * let mm_3gpp_parse_iccid take care of handling the A-F characters properly. */ + raw_iccid = mm_utils_bin2hexstr ((const guint8 *)slot_status->iccid->data, slot_status->iccid->len); if (!raw_iccid) { mm_obj_warn (self, "not creating SIM object: failed to convert ICCID from BCD"); g_ptr_array_add (ctx->sim_slots, NULL);