mirror of git://git.sysmocom.de/ofono
Add utility to parse 2G GET_RESPONSE data
This format is described in 51.011 and the older 11.11. It is not supported by newer 3G UICC based devices & sim card combinations
This commit is contained in:
parent
53496c6a32
commit
c9a2eedc08
|
@ -50,7 +50,7 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
const guint8 *response;
|
const guint8 *response;
|
||||||
gint sw1, sw2, len;
|
gint sw1, sw2, len;
|
||||||
int flen, rlen;
|
int flen, rlen;
|
||||||
enum ofono_sim_file_structure str;
|
int str;
|
||||||
unsigned char access[3];
|
unsigned char access[3];
|
||||||
|
|
||||||
dump_response("at_crsm_info_cb", ok, result);
|
dump_response("at_crsm_info_cb", ok, result);
|
||||||
|
@ -82,17 +82,7 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
|
||||||
ofono_debug("crsm_info_cb: %02x, %02x, %i", sw1, sw2, len);
|
ofono_debug("crsm_info_cb: %02x, %02x, %i", sw1, sw2, len);
|
||||||
|
|
||||||
flen = (response[2] << 8) | response[3];
|
sim_parse_2G_get_response(response, len, &flen, &rlen, &str, access);
|
||||||
str = response[13];
|
|
||||||
|
|
||||||
access[0] = response[8];
|
|
||||||
access[1] = response[9];
|
|
||||||
access[2] = response[10];
|
|
||||||
|
|
||||||
if (str == 0x01 || str == 0x03)
|
|
||||||
rlen = response[14];
|
|
||||||
else
|
|
||||||
rlen = 0;
|
|
||||||
|
|
||||||
cb(&error, flen, str, rlen, access, cbd->data);
|
cb(&error, flen, str, rlen, access, cbd->data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,3 +573,25 @@ struct sim_ef_info *sim_ef_db_lookup(unsigned short id)
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean sim_parse_2G_get_response(unsigned char *response, int len,
|
||||||
|
int *file_len, int *record_len,
|
||||||
|
int *structure, unsigned char *access)
|
||||||
|
{
|
||||||
|
if (len < 14)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
*file_len = (response[2] << 8) | response[3];
|
||||||
|
*structure = response[13];
|
||||||
|
|
||||||
|
access[0] = response[8];
|
||||||
|
access[1] = response[9];
|
||||||
|
access[2] = response[10];
|
||||||
|
|
||||||
|
if (response[13] == 0x01 || response[13] == 0x03)
|
||||||
|
*record_len = response[14];
|
||||||
|
else
|
||||||
|
*record_len = 0;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -106,3 +106,7 @@ void sim_adn_build(unsigned char *data, int length,
|
||||||
const char *identifier);
|
const char *identifier);
|
||||||
|
|
||||||
struct sim_ef_info *sim_ef_db_lookup(unsigned short efid);
|
struct sim_ef_info *sim_ef_db_lookup(unsigned short efid);
|
||||||
|
|
||||||
|
gboolean sim_parse_2G_get_response(unsigned char *response, int len,
|
||||||
|
int *file_len, int *record_len,
|
||||||
|
int *structure, unsigned char *access);
|
||||||
|
|
Loading…
Reference in New Issue