Re: [PATCH v4 6/6] mbimmodem: sim: add support for querying ICCID This implements the required functions to query file info and read file info from the modem. Currently the other file IDs haven't been implemented, but they will be tackled later.
Muhammad <[email protected]> Tue, 6 May 2025 16:20:20 +0500
| Newsgroups | dev.linux.lists.ofono |
|---|---|
| Message-ID | <[email protected]> |
Hi Denis,
On 5/5/25 21:29, Denis Kenzior wrote:
>> +static void mbim_read_file_transparent(struct ofono_sim *sim,
>> + int fileid, int start, int length,
>> + const unsigned char *path, unsigned int path_len,
>> + ofono_sim_read_cb_t cb, void *user_data)
>> +{
>> + struct sim_data *sd = ofono_sim_get_data(sim);
>> + unsigned char iccid[10];
>> + int iccid_len, len = strlen(sd->imsi);
>> +
>> + sim_encode_bcd_number(sd->iccid, iccid);
>> + iccid_len = len / 2;
>
> Hmm, len is based on the IMSI, not iccid? Also, the number will be
> truncated, not rounded up. Do you mean something like:
>
> sim_encode_bcd_number(sd->iccid, iccid);
> iccid_len = (strlen(sd->iccid) + 1) / 2;
>
> ?
oFono's `sim_encode_bcd_number()` will encode the ICCID string into BCD,
which halves the length of the string. ICCID's are 20 bytes long, so
this just returns 10 for length. The QMI driver also does the same.
- Muhammad