Hi Denis,
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> ---
> drivers/atmodem/sim.c | 24 ++++++++++++++++--------
> 1 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
> index d0a7148..d44b7d2 100644
> --- a/drivers/atmodem/sim.c
> +++ b/drivers/atmodem/sim.c
> @@ -64,11 +64,13 @@ static void at_crsm_info_cb(gboolean ok, GAtResult
> *result, gpointer user_data) int flen, rlen;
> int str;
> unsigned char access[3];
> + unsigned char file_status;
>
> decode_at_error(&error, g_at_result_final_response(result));
>
> if (!ok) {
> - cb(&error, -1, -1, -1, NULL, cbd->data);
> + cb(&error, -1, -1, -1, NULL,
> + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
In the cases where an error occurs, I suggest passing in -1 for the
file_status.
What about passing in 0 (INVALID)? Because I handle file_status as an bit-field,
unsigned char-type seems to be proper type for file_status, not signed-type
(for negative values).
> return;
> }
>
> @@ -88,27 +90,33 @@ static void at_crsm_info_cb(gboolean ok, GAtResult
> *result, gpointer user_data) error.type = OFONO_ERROR_TYPE_SIM;
> error.error = (sw1 << 8) | sw2;
>
> - cb(&error, -1, -1, -1, NULL, cbd->data);
> + cb(&error, -1, -1, -1, NULL,
> + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
> return;
> }
>
> DBG("crsm_info_cb: %02x, %02x, %i", sw1, sw2, len);
>
> - if (response[0] == 0x62)
> + if (response[0] == 0x62) {
> ok = sim_parse_3g_get_response(response, len, &flen, &rlen,
> &str, access, NULL);
> +
> + file_status = SIM_FILE_STATUS_NOT_AVAILABLE;
For this case, file_status should be 0. From what I remember of ETSI
102.221 3G sims do not return response data for invalidated files. But
please double check this, or perhaps someone on the list knows.
I didn't find file-status in the 3G-response encoding either. Well, status byte-
coding gives similar return-value ('Selected file invalidated'). OK, for FDN-
support I need to check the ADN-file status only from 2G-response. But later
this issue can be implemented more properly.
> + }
> else
> ok = sim_parse_2g_get_response(response, len, &flen, &rlen,
> - &str, access);
> + &str, access, &file_status);
>
> if (!ok)
> goto error;
>
> - cb(&error, flen, str, rlen, access, cbd->data);
> + cb(&error, flen, str, rlen, access, file_status, cbd->data);
> +
> return;
>
> error:
> - CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, cbd->data);
> + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
> + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
> }
>
> static void at_sim_read_info(struct ofono_sim *sim, int fileid,
> @@ -123,7 +131,7 @@ static void at_sim_read_info(struct ofono_sim *sim,
> int fileid, unsigned char access[3] = { 0x00, 0x00, 0x00 };
>
> if (fileid == SIM_EFAD_FILEID) {
> - CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, data);
> + CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, 0x01, data);
> return;
> }
> }
> @@ -142,7 +150,7 @@ static void at_sim_read_info(struct ofono_sim *sim,
> int fileid, return;
>
> error:
> - CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
> + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, 0xFF, data);
>
> }
>
> static void at_crsm_read_cb(gboolean ok, GAtResult *result,
Regards,
-Denis
Br, Petteri