mirror of git://git.sysmocom.de/ofono
rilmodem: Convert decode_hex to l_util_from_hexstring
This commit is contained in:
parent
2984391b31
commit
b2ebd60bcd
|
@ -31,6 +31,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include <ofono/log.h>
|
||||
#include <ofono/modem.h>
|
||||
|
@ -150,7 +151,7 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
|||
int sw1, sw2;
|
||||
char *hex_response;
|
||||
unsigned char *response = NULL;
|
||||
long len;
|
||||
size_t len;
|
||||
gboolean ok = FALSE;
|
||||
int flen = 0, rlen = 0, str = 0;
|
||||
guchar access[3] = { 0x00, 0x00, 0x00 };
|
||||
|
@ -173,7 +174,7 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
|||
goto error;
|
||||
|
||||
if (hex_response != NULL) {
|
||||
response = decode_hex(hex_response, -1, &len, -1);
|
||||
response = l_util_from_hexstring(hex_response, &len);
|
||||
g_free(hex_response);
|
||||
hex_response = NULL;
|
||||
|
||||
|
@ -217,9 +218,6 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (len < 0)
|
||||
goto error;
|
||||
|
||||
if (response[0] == 0x62) {
|
||||
ok = sim_parse_3g_get_response(response, len,
|
||||
&flen, &rlen, &str,
|
||||
|
@ -230,7 +228,7 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
|||
&flen, &rlen, &str,
|
||||
access, &file_status);
|
||||
|
||||
g_free(response);
|
||||
l_free(response);
|
||||
|
||||
if (!ok)
|
||||
goto error;
|
||||
|
@ -240,7 +238,7 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
|||
return;
|
||||
|
||||
error:
|
||||
g_free(response);
|
||||
l_free(response);
|
||||
CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
|
||||
EF_STATUS_INVALIDATED, cbd->data);
|
||||
}
|
||||
|
@ -380,7 +378,7 @@ static void ril_file_io_cb(struct ril_msg *message, gpointer user_data)
|
|||
if (hex_response == NULL)
|
||||
goto error;
|
||||
|
||||
response = decode_hex(hex_response, -1, &len, -1);
|
||||
response = l_util_from_hexstring(hex_response, &len);
|
||||
g_free(hex_response);
|
||||
hex_response = NULL;
|
||||
|
||||
|
@ -390,11 +388,11 @@ static void ril_file_io_cb(struct ril_msg *message, gpointer user_data)
|
|||
}
|
||||
|
||||
CALLBACK_WITH_SUCCESS(cb, response, len, cbd->data);
|
||||
g_free(response);
|
||||
l_free(response);
|
||||
return;
|
||||
|
||||
error:
|
||||
g_free(response);
|
||||
l_free(response);
|
||||
CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include <ofono/log.h>
|
||||
#include <ofono/modem.h>
|
||||
|
@ -94,20 +95,21 @@ static void ril_stk_envelope_cb(struct ril_msg *message, gpointer user_data)
|
|||
struct stk_data *sd = cbd->user;
|
||||
struct parcel rilp;
|
||||
unsigned char *response = NULL;
|
||||
long len = 0;
|
||||
char *pdu;
|
||||
|
||||
g_ril_print_response(sd->ril, message);
|
||||
|
||||
if (message->error == RIL_E_SUCCESS) {
|
||||
char *pdu;
|
||||
size_t len;
|
||||
|
||||
g_ril_init_parcel(message, &rilp);
|
||||
pdu = parcel_r_string(&rilp);
|
||||
|
||||
if (pdu)
|
||||
response = decode_hex(pdu, -1, &len, -1);
|
||||
response = l_util_from_hexstring(pdu, &len);
|
||||
|
||||
CALLBACK_WITH_SUCCESS(cb, response, len, cbd->data);
|
||||
g_free(response);
|
||||
l_free(response);
|
||||
} else {
|
||||
ofono_error("%s RILD reply failure: %s",
|
||||
g_ril_request_id_to_string(sd->ril, message->req),
|
||||
|
@ -145,32 +147,32 @@ static void ril_stk_proactive_cmd_notify(struct ril_msg *message,
|
|||
{
|
||||
struct ofono_stk *stk = user_data;
|
||||
struct parcel rilp;
|
||||
long pdulen;
|
||||
size_t pdulen;
|
||||
unsigned char *pdu;
|
||||
|
||||
DBG("");
|
||||
|
||||
g_ril_init_parcel(message, &rilp);
|
||||
pdu = decode_hex(parcel_r_string(&rilp), -1, &pdulen, -1);
|
||||
pdu = l_util_from_hexstring(parcel_r_string(&rilp), &pdulen);
|
||||
|
||||
ofono_stk_proactive_command_notify(stk, pdulen, pdu);
|
||||
g_free(pdu);
|
||||
l_free(pdu);
|
||||
}
|
||||
|
||||
static void ril_stk_event_notify(struct ril_msg *message, gpointer user_data)
|
||||
{
|
||||
struct ofono_stk *stk = user_data;
|
||||
struct parcel rilp;
|
||||
long pdulen;
|
||||
size_t pdulen;
|
||||
unsigned char *pdu;
|
||||
|
||||
DBG("");
|
||||
|
||||
g_ril_init_parcel(message, &rilp);
|
||||
pdu = decode_hex(parcel_r_string(&rilp), -1, &pdulen, -1);
|
||||
pdu = l_util_from_hexstring(parcel_r_string(&rilp), &pdulen);
|
||||
|
||||
ofono_stk_proactive_command_handled_notify(stk, pdulen, pdu);
|
||||
g_free(pdu);
|
||||
l_free(pdu);
|
||||
}
|
||||
|
||||
static void ril_stk_session_end_notify(struct ril_msg *message,
|
||||
|
|
Loading…
Reference in New Issue