* [PATCH] Use GET RESPONSE sim command to retrieve EF length.
@ 2009-06-18 3:44 Andrzej Zaborowski
2009-06-18 7:10 ` Denis Kenzior
2009-06-18 8:17 ` Stefan Schmidt
0 siblings, 2 replies; 4+ messages in thread
From: Andrzej Zaborowski @ 2009-06-18 3:44 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2757 bytes --]
Also accept 0x9f as a success status word 1 for READ BINARY (GSM specific).
Note that GET RESPONSE doesn't seem to work on on the TI Calypso modems
in OpenMoko phones. They return the 0x9f status which ETSI says is what
the SIM shall return if GET RESPONSE is not issued immediately after
the command generating the response, which would be the case if the
modem sends some command between SELECT and the GET RESPONSE. These
modems don't support AT+CSIM either in case we wanted to manually send
the SELECT and the GET RESPONSE.
---
drivers/atmodem/sim.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 7b41c76..a2aebb8 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -46,8 +46,9 @@ static void at_crsm_len_cb(gboolean ok, GAtResult *result, gpointer user_data)
struct cb_data *cbd = user_data;
GAtResultIter iter;
ofono_sim_file_len_cb_t cb = cbd->cb;
- gint sw1, len;
struct ofono_error error;
+ const guint8 *response;
+ gint sw1, sw2, len;
dump_response("at_crsm_len_cb", ok, result);
decode_at_error(&error, g_at_result_final_response(result));
@@ -69,16 +70,18 @@ static void at_crsm_len_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_next_number(&iter, &sw1);
g_at_result_iter_next_number(&iter, &len);
- ofono_debug("crsm_len_cb: %i, %i", sw1, len);
-
- if (sw1 != 0x67) {
+ if (!g_at_result_iter_next_hexstring(&iter, &response, &len) ||
+ (sw1 != 0x90 && sw1 != 0x91 && sw1 != 0x92) ||
+ (sw1 == 0x90 && sw2 != 0x00) || len < 14) {
DECLARE_FAILURE(e);
cb(&e, -1, cbd->data);
return;
}
- cb(&error, len, cbd->data);
+ ofono_debug("crsm_len_cb: %02x, %02x, %i", sw1, sw2, len);
+
+ cb(&error, (response[2] << 8) | response[3], cbd->data);
}
static void at_sim_read_file_len(struct ofono_modem *modem, int fileid,
@@ -92,7 +95,7 @@ static void at_sim_read_file_len(struct ofono_modem *modem, int fileid,
if (!cbd)
goto error;
- snprintf(buf, sizeof(buf), "AT+CRSM=176,%i,0,0,0", fileid);
+ snprintf(buf, sizeof(buf), "AT+CRSM=192,%i,0,0,15", fileid);
if (g_at_chat_send(at->parser, buf, crsm_prefix,
at_crsm_len_cb, cbd, g_free) > 0)
return;
@@ -136,7 +139,7 @@ static void at_crsm_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_next_number(&iter, &sw1);
g_at_result_iter_next_number(&iter, &sw2);
if (!g_at_result_iter_next_hexstring(&iter, &response, &len) ||
- (sw1 != 0x90 && sw1 != 0x91 && sw1 != 0x92) ||
+ (sw1 != 0x90 && sw1 != 0x91 && sw1 != 0x92 && sw1 != 0x9f) ||
(sw1 == 0x90 && sw2 != 0x00)) {
DECLARE_FAILURE(e);
--
1.6.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Use GET RESPONSE sim command to retrieve EF length.
2009-06-18 3:44 [PATCH] Use GET RESPONSE sim command to retrieve EF length Andrzej Zaborowski
@ 2009-06-18 7:10 ` Denis Kenzior
2009-06-20 23:37 ` Andrzej Zaborowski
2009-06-18 8:17 ` Stefan Schmidt
1 sibling, 1 reply; 4+ messages in thread
From: Denis Kenzior @ 2009-06-18 7:10 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]
Hi,
On Wednesday 17 June 2009 22:44:28 Andrzej Zaborowski wrote:
> Also accept 0x9f as a success status word 1 for READ BINARY (GSM specific).
>
> Note that GET RESPONSE doesn't seem to work on on the TI Calypso modems
> in OpenMoko phones. They return the 0x9f status which ETSI says is what
> the SIM shall return if GET RESPONSE is not issued immediately after
> the command generating the response, which would be the case if the
> modem sends some command between SELECT and the GET RESPONSE. These
> modems don't support AT+CSIM either in case we wanted to manually send
> the SELECT and the GET RESPONSE.
Patch has been applied. Note that GET RESPONSE or the CSIM equivalent is the
only sane way to do this as we also need to support cyclical and record based
files. Is there any other way to find out the total file size and the record
size on the Neo besides GET RESPONSE?
For Record-Based files you can use CRSM=178,<file>,0,0,0 to find the record size,
but not the total length of the file (e.g. how many records there are)
If we can obtain this information, then we simply have to maintain a different
implementation when ti_calypso is used.
And I can confirm that GET RESPONSE simply doesn't work on the Freerunner:
AT+CRSM=176,28423,0,0,0
STR=`AT+CRSM=176,28423,0,0,0'
RSTR=`+CRSM: 103,9'
Ok, EFimsi exists with length 9
AT+CRSM=192,28423
STR=`AT+CRSM=192,28423'
RSTR=`+CRSM: 111,0'
Unknown technical problem.
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use GET RESPONSE sim command to retrieve EF length.
2009-06-18 7:10 ` Denis Kenzior
@ 2009-06-20 23:37 ` Andrzej Zaborowski
0 siblings, 0 replies; 4+ messages in thread
From: Andrzej Zaborowski @ 2009-06-20 23:37 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 902 bytes --]
2009/6/18 Denis Kenzior <denkenz@gmail.com>:
[...]
> Patch has been applied. Note that GET RESPONSE or the CSIM equivalent is the
> only sane way to do this as we also need to support cyclical and record based
> files. Is there any other way to find out the total file size and the record
> size on the Neo besides GET RESPONSE?
>
> For Record-Based files you can use CRSM=178,<file>,0,0,0 to find the record size,
> but not the total length of the file (e.g. how many records there are)
>
> If we can obtain this information, then we simply have to maintain a different
> implementation when ti_calypso is used.
I've not found any way to get the total size or number of records
other than retrieving all records with
CRSM=178,<file>,<n>,4,<record-size> increasing <n> until we get an
error. With what Stefan pointed out we can use +CSIM though, I'll
need to try it.
Regards
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use GET RESPONSE sim command to retrieve EF length.
2009-06-18 3:44 [PATCH] Use GET RESPONSE sim command to retrieve EF length Andrzej Zaborowski
2009-06-18 7:10 ` Denis Kenzior
@ 2009-06-18 8:17 ` Stefan Schmidt
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Schmidt @ 2009-06-18 8:17 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
Hello.
On Thu, 2009-06-18 at 05:44, Andrzej Zaborowski wrote:
>
> modem sends some command between SELECT and the GET RESPONSE. These
> modems don't support AT+CSIM either in case we wanted to manually send
> the SELECT and the GET RESPONSE.
It does since GSM fw version Moko9-Beta2. Current is Moko11. You may want to
update the firmware if you like to test it with CSIM.
http://people.openmoko.org/joerg/calypso_moko_FW/all_version__CHANGELOG.txt
http://wiki.openmoko.org/wiki/GSM/Flashing
regards
Stefan Schmidt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-20 23:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 3:44 [PATCH] Use GET RESPONSE sim command to retrieve EF length Andrzej Zaborowski
2009-06-18 7:10 ` Denis Kenzior
2009-06-20 23:37 ` Andrzej Zaborowski
2009-06-18 8:17 ` Stefan Schmidt
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.