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.

Denis Kenzior <[email protected]> Mon, 5 May 2025 11:29:28 -0500
Newsgroups dev.linux.lists.ofono
Message-ID <[email protected]>
Hi Muhammad,

On 5/4/25 2:19 PM, Muhammad Asif wrote:
> ---
>   drivers/mbimmodem/sim.c | 45 +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 45 insertions(+)
> 

<snip>

> +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;

?

> +
> +	switch (fileid) {
> +		case SIM_EF_ICCID_FILEID:
> +			CALLBACK_WITH_SUCCESS(cb, iccid, iccid_len, user_data);
> +			break;
> +		default:
> +			CALLBACK_WITH_FAILURE(cb, NULL, 0, user_data);
> +			break;
> +	}
> +}
> +
>   static enum ofono_sim_password_type mbim_pin_type_to_sim_password(
>   							uint32_t pin_type)
>   {

Regards,
-Denis