summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulK <contact@paulk.fr>2011-12-31 16:46:51 +0100
committerPaulK <contact@paulk.fr>2011-12-31 16:46:51 +0100
commit852feed67ca215589a223f6a51a64673b21af35f (patch)
treec5bd9be5df676aa5259ebaaa0fd0cfff658c4cf1
parent5a5ce9424d3ea0c7734addd7ac835900c6cf3c4a (diff)
downloadhardware_replicant_libsamsung-ril-852feed67ca215589a223f6a51a64673b21af35f.tar.gz
hardware_replicant_libsamsung-ril-852feed67ca215589a223f6a51a64673b21af35f.tar.bz2
hardware_replicant_libsamsung-ril-852feed67ca215589a223f6a51a64673b21af35f.zip
Added RFS functions and IPC_GEN_PHONE_RES proper handling, applied to data
-rw-r--r--Android.mk4
-rw-r--r--gen.c154
-rw-r--r--gprs.c40
-rw-r--r--ipc.c33
-rw-r--r--rfs.c91
-rw-r--r--samsung-ril.c72
-rw-r--r--samsung-ril.h29
-rw-r--r--sim.c5
8 files changed, 365 insertions, 63 deletions
diff --git a/Android.mk b/Android.mk
index 2011585..1ba9430 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,6 +26,7 @@ LOCAL_SRC_FILES := \
ipc.c \
srs.c \
util.c \
+ gen.c \
pwr.c \
disp.c \
misc.c \
@@ -35,7 +36,8 @@ LOCAL_SRC_FILES := \
sms.c \
call.c \
snd.c \
- gprs.c
+ gprs.c \
+ rfs.c
LOCAL_SHARED_LIBRARIES := \
libcutils libutils libril
diff --git a/gen.c b/gen.c
new file mode 100644
index 0000000..6140ec8
--- /dev/null
+++ b/gen.c
@@ -0,0 +1,154 @@
+/**
+ * This file is part of samsung-ril.
+ *
+ * Copyright (C) 2011 Paul Kocialkowski <contact@oaulk.fr>
+ *
+ * samsung-ril is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * samsung-ril is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with samsung-ril. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#define LOG_TAG "RIL-GEN"
+#include <utils/Log.h>
+
+#include "samsung-ril.h"
+#include "util.h"
+
+struct ipc_gen_phone_res_expect ipc_gen_phone_res_expects[0x20];
+int ipc_gen_phone_res_id = 0;
+
+/**
+ * IPC_GEN_PHONE_RES has shared aseq (in the header), group, index and type (in the data)
+ * On this implementation, we just check aseq and command (group and index).
+ * aseq permits to identify the queued request and do what's wanted.
+ * It can be either call a function with the struct ipc_message_info,
+ * complete the request to RILJ (with or without an error),
+ * return to RILJ if there is an error in this response.
+ *
+ * It would have been possible to deal with group, index and type only and use
+ * callback functions. Though, what is currently being used is more a "standard"
+ * error catch system, that requires less code (no particular function), while
+ * it also permits using custom functions, when IPC_GEN_PHONE_RES code is
+ * request-specific.
+ *
+ * On a custom function, don't forget to get a clean new aseq if you're going to
+ * send some data to the modem, just liek this:
+ * aseq = ril_request_reg_id(reqGetToken(info->aseq));
+ */
+
+int ipc_gen_phone_res_id_new(void)
+{
+ ipc_gen_phone_res_id++;
+ ipc_gen_phone_res_id %= 0x20;
+ return ipc_gen_phone_res_id;
+}
+
+int ipc_gen_phone_res_get_id(unsigned char aseq)
+{
+ int i;
+
+ for(i=0 ; i < 0x20 ; i++)
+ if(ipc_gen_phone_res_expects[i].aseq == aseq)
+ return i;
+
+ return -1;
+}
+
+void ipc_gen_phone_res_clean_id(int id)
+{
+ ipc_gen_phone_res_expects[id].aseq = 0;
+ ipc_gen_phone_res_expects[id].command = 0;
+ ipc_gen_phone_res_expects[id].func = NULL;
+ ipc_gen_phone_res_expects[id].to_complete = 0;
+ ipc_gen_phone_res_expects[id].to_abort = 0;
+}
+
+void ipc_gen_phone_res_expect_to_func(unsigned char aseq, unsigned short command,
+ void (*func)(struct ipc_message_info *info))
+{
+ int id = ipc_gen_phone_res_id_new();
+
+ ipc_gen_phone_res_expects[id].aseq = aseq;
+ ipc_gen_phone_res_expects[id].command = command;
+ ipc_gen_phone_res_expects[id].func = func;
+ ipc_gen_phone_res_expects[id].to_complete = 0;
+ ipc_gen_phone_res_expects[id].to_abort = 0;
+}
+
+void ipc_gen_phone_res_expect_to_complete(unsigned char aseq, unsigned short command)
+{
+ int id = ipc_gen_phone_res_id_new();
+
+ ipc_gen_phone_res_expects[id].aseq = aseq;
+ ipc_gen_phone_res_expects[id].command = command;
+ ipc_gen_phone_res_expects[id].func = NULL;
+ ipc_gen_phone_res_expects[id].to_complete = 1;
+ ipc_gen_phone_res_expects[id].to_abort = 0;
+}
+
+void ipc_gen_phone_res_expect_to_abort(unsigned char aseq, unsigned short command)
+{
+ int id = ipc_gen_phone_res_id_new();
+
+ ipc_gen_phone_res_expects[id].aseq = aseq;
+ ipc_gen_phone_res_expects[id].command = command;
+ ipc_gen_phone_res_expects[id].func = NULL;
+ ipc_gen_phone_res_expects[id].to_complete = 0;
+ ipc_gen_phone_res_expects[id].to_abort = 1;
+}
+
+void ipc_gen_phone_res(struct ipc_message_info *info)
+{
+ struct ipc_gen_phone_res *phone_res = (struct ipc_gen_phone_res *) info->data;
+ int id = ipc_gen_phone_res_get_id(info->aseq);
+ RIL_Errno e;
+ int rc;
+
+ // In this case, it can be a real error or we just didn't queue
+ if(id < 0) {
+ LOGD("aseq: 0x%x not found in the IPC_GEN_PHONE_RES queue", info->aseq);
+ return;
+ }
+
+ LOGD("aseq: 0x%x found in the IPC_GEN_PHONE_RES queue!", info->aseq);
+
+ if(ipc_gen_phone_res_expects[id].command != IPC_COMMAND(phone_res)) {
+ LOGE("IPC_GEN_PHONE_RES aseq (0x%x) doesn't match the queued one with command (0x%x)",
+ ipc_gen_phone_res_expects[id].aseq, ipc_gen_phone_res_expects[id].command);
+
+ if(ipc_gen_phone_res_expects[id].func != NULL) {
+ LOGE("Not safe to run the custom function, reporting generic failure");
+ RIL_onRequestComplete(reqGetToken(ipc_gen_phone_res_expects[id].aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+ }
+ }
+
+ if(ipc_gen_phone_res_expects[id].func != NULL) {
+ ipc_gen_phone_res_expects[id].func(info);
+ ipc_gen_phone_res_clean_id(id);
+ return;
+ }
+
+ rc = ipc_gen_phone_res_check(phone_res);
+ if(rc < 0)
+ e = RIL_E_GENERIC_FAILURE;
+ else
+ e = RIL_E_SUCCESS;
+
+ if(ipc_gen_phone_res_expects[id].to_complete || (ipc_gen_phone_res_expects[id].to_abort && rc < 0)) {
+ RIL_onRequestComplete(reqGetToken(ipc_gen_phone_res_expects[id].aseq), e, NULL, 0);
+ ipc_gen_phone_res_clean_id(id);
+ return;
+ }
+
+ ipc_gen_phone_res_clean_id(id);
+}
diff --git a/gprs.c b/gprs.c
index 60b9831..3b4a9a8 100644
--- a/gprs.c
+++ b/gprs.c
@@ -36,7 +36,6 @@
extern void ipc_gprs_define_pdp_context_setup(struct ipc_gprs_define_pdp_context *message, char *apn);
// libnetutils missing prototype
-
extern int ifc_configure(const char *ifname,
in_addr_t address,
in_addr_t netmask,
@@ -44,6 +43,30 @@ extern int ifc_configure(const char *ifname,
in_addr_t dns1,
in_addr_t dns2);
+void ipc_gprs_pdp_context_complete(struct ipc_message_info *info)
+{
+ struct ipc_gen_phone_res *phone_res = (struct ipc_gen_phone_res *) info->data;
+ int rc;
+ int aseq;
+
+ rc = ipc_gen_phone_res_check(phone_res);
+ if(rc < 0) {
+ RIL_onRequestComplete(reqGetToken(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+ LOGE("There was an error, aborting PDP context complete");
+ return;
+ }
+
+ /* We need to get a clean new aseq here */
+ aseq = ril_request_reg_id(reqGetToken(info->aseq));
+
+ /* activate the connection */
+ ipc_fmt_send(IPC_GPRS_PDP_CONTEXT, IPC_TYPE_SET,
+ (void *) &(ril_state.gprs_context), sizeof(struct ipc_gprs_pdp_context), aseq);
+
+ ipc_gen_phone_res_expect_to_abort(aseq, IPC_GPRS_PDP_CONTEXT);
+ // TODO: if this aborts, last fail cause will be: PDP_FAIL_ERROR_UNSPECIFIED
+}
+
void ril_request_setup_data_call(RIL_Token t, void *data, int length)
{
char *username = NULL;
@@ -78,20 +101,15 @@ void ril_request_setup_data_call(RIL_Token t, void *data, int length)
/* create the structs with the apn */
ipc_gprs_define_pdp_context_setup(&setup_apn_message, apn);
+ /* create the structs with the username/password tuple */
+ ipc_gprs_pdp_context_setup(&(ril_state.gprs_context), username, password);
+
/* send the struct to the modem */
ipc_fmt_send(IPC_GPRS_DEFINE_PDP_CONTEXT, IPC_TYPE_SET,
(void *) &setup_apn_message, sizeof(struct ipc_gprs_define_pdp_context), reqGetId(t));
- //TODO: Wait for IPC_GEN_PHONE_RES, split in 2 functions
-
- /* create the structs with the username/password tuple */
- ipc_gprs_pdp_context_setup(&activate_message, username, password);
-
- /* activate the connection */
- ipc_fmt_send(IPC_GPRS_PDP_CONTEXT, IPC_TYPE_SET,
- (void *) &activate_message, sizeof(struct ipc_gprs_pdp_context), reqGetId(t));
-
- //TODO: Wait for IPC_GEN_PHONE_RES, only return to RILJ if it fails
+ ipc_gen_phone_res_expect_to_func(reqGetId(t), IPC_GPRS_DEFINE_PDP_CONTEXT,
+ ipc_gprs_pdp_context_complete);
}
void ipc_gprs_ip_configuration(struct ipc_message_info *info)
diff --git a/ipc.c b/ipc.c
index 5aa3f1b..86f0185 100644
--- a/ipc.c
+++ b/ipc.c
@@ -92,15 +92,13 @@ int ipc_fmt_read_loop(struct ril_client *client)
if(FD_ISSET(ipc_client_fd, &fds)) {
RIL_CLIENT_LOCK(client);
- if(ipc_client_recv(ipc_client, &info)) {
+ if(ipc_client_recv(ipc_client, &info) < 0) {
RIL_CLIENT_UNLOCK(client);
LOGE("IPC FMT recv failed, aborting!");
return -1;
}
RIL_CLIENT_UNLOCK(client);
- LOGD("IPC FMT recv: aseq=0x%x mseq=0x%x data_length=%d\n", info.aseq, info.mseq, info.length);
-
ipc_fmt_dispatch(&info);
if(info.data != NULL)
@@ -144,7 +142,7 @@ int ipc_fmt_create(struct ril_client *client)
return -1;
}
- //FIXME: ipc_client_set_handler
+ // ipc_client_set_handlers
LOGD("Passing client->object->ipc_client fd as handlers data");
rc = ipc_client_set_all_handlers_data(ipc_client, &((struct ipc_client_object *) client->object)->ipc_client_fd);
@@ -227,6 +225,27 @@ int ipc_fmt_destroy(struct ril_client *client)
* IPC RFS
*/
+void ipc_rfs_send(const unsigned short command, unsigned char *data, const int length, unsigned char mseq)
+{
+ struct ipc_client *ipc_client;
+
+ if(ipc_rfs_client == NULL) {
+ LOGE("ipc_rfs_client is null, aborting!");
+ return;
+ }
+
+ if(ipc_rfs_client->object == NULL) {
+ LOGE("ipc_rfs_client object is null, aborting!");
+ return;
+ }
+
+ ipc_client = ((struct ipc_client_object *) ipc_rfs_client->object)->ipc_client;
+
+ RIL_CLIENT_LOCK(ipc_rfs_client);
+ ipc_client_send(ipc_client, command, 0, data, length, mseq);
+ RIL_CLIENT_UNLOCK(ipc_rfs_client);
+}
+
int ipc_rfs_read_loop(struct ril_client *client)
{
struct ipc_message_info info;
@@ -260,15 +279,13 @@ int ipc_rfs_read_loop(struct ril_client *client)
if(FD_ISSET(ipc_client_fd, &fds)) {
RIL_CLIENT_LOCK(client);
- if(ipc_client_recv(ipc_client, &info)) {
+ if(ipc_client_recv(ipc_client, &info) < 0) {
RIL_CLIENT_UNLOCK(client);
LOGE("IPC RFS recv failed, aborting!");
return -1;
}
RIL_CLIENT_UNLOCK(client);
- LOGD("IPC RFS recv: command=%d data_length=%d\n", info.type, info.length);
-
ipc_rfs_dispatch(&info);
if(info.data != NULL)
@@ -312,7 +329,7 @@ int ipc_rfs_create(struct ril_client *client)
return -1;
}
- //FIXME: ipc_client_set_handler
+ // ipc_client_set_handlers
LOGD("Passing client->object->ipc_client fd as handlers data");
rc = ipc_client_set_all_handlers_data(ipc_client, &((struct ipc_client_object *) client->object)->ipc_client_fd);
diff --git a/rfs.c b/rfs.c
new file mode 100644
index 0000000..742d73e
--- /dev/null
+++ b/rfs.c
@@ -0,0 +1,91 @@
+/**
+ * This file is part of samsung-ril.
+ *
+ * Copyright (C) 2011 Paul Kocialkowski <contact@oaulk.fr>
+ *
+ * samsung-ril is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * samsung-ril is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with samsung-ril. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#define LOG_TAG "RIL-RFS"
+#include <utils/Log.h>
+
+#include "samsung-ril.h"
+#include "util.h"
+
+void ipc_rfs_nv_read_item(struct ipc_message_info *info)
+{
+ struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data;
+ struct ipc_rfs_io_confirm *rfs_io_conf;
+ struct ipc_client *ipc_client;
+ void *rfs_data;
+ int rc;
+
+ ipc_client = ((struct ipc_client_object *) ipc_rfs_client->object)->ipc_client;
+
+ if(rfs_io == NULL) {
+ LOGE("Error: NULL rfs_io");
+ return;
+ }
+
+ rfs_io_conf = malloc(rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
+ memset(rfs_io_conf, 0, rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
+ rfs_data = rfs_io_conf + sizeof(struct ipc_rfs_io_confirm);
+
+ LOGD("Asked to read 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
+ rc = nv_data_read(ipc_client, rfs_io->offset, rfs_io->length, rfs_data);
+
+ LOGD("Read rfs_data dump:");
+ hex_dump(rfs_data, rfs_io->length);
+
+ LOGD("Sending RFS IO Confirm message (rc is %d)", rc);
+ rfs_io_conf->confirm = rc < 0 ? 0 : 1;
+ rfs_io_conf->offset = rfs_io->offset;
+ rfs_io_conf->length = rfs_io->length;
+
+ ipc_rfs_send(IPC_RFS_NV_READ_ITEM, rfs_io_conf, rfs_io->length + sizeof(struct ipc_rfs_io_confirm), info->aseq);
+
+ free(rfs_io_conf);
+}
+
+void ipc_rfs_nv_write_item(struct ipc_message_info *info)
+{
+ struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data;
+ struct ipc_rfs_io_confirm rfs_io_conf;
+ struct ipc_client *ipc_client;
+ void *rfs_data;
+ int rc;
+
+ ipc_client = ((struct ipc_client_object *) ipc_rfs_client->object)->ipc_client;
+
+ if(rfs_io == NULL) {
+ LOGE("Error: NULL rfs_io");
+ return;
+ }
+
+ rfs_data = info->data + sizeof(struct ipc_rfs_io);
+
+ LOGD("Write rfs_data dump:");
+ hex_dump(rfs_data, rfs_io->length);
+
+ LOGD("Asked to write 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
+ rc = nv_data_write(ipc_client, rfs_io->offset, rfs_io->length, rfs_data);
+
+ LOGD("Sending RFS IO Confirm message (rc is %d)", rc);
+ rfs_io_conf.confirm = rc < 0 ? 0 : 1;
+ rfs_io_conf.offset = rfs_io->offset;
+ rfs_io_conf.length = rfs_io->length;
+
+ ipc_rfs_send(IPC_RFS_NV_WRITE_ITEM, &rfs_io_conf, sizeof(struct ipc_rfs_io_confirm), info->aseq);
+}
diff --git a/samsung-ril.c b/samsung-ril.c
index 8aafac7..4e63995 100644
--- a/samsung-ril.c
+++ b/samsung-ril.c
@@ -33,23 +33,31 @@
/**
* Samsung-RIL TODO:
+ *
+ * General:
* - add IPC_NET_SERVING_NETWORK
- * - add RFS NV_DATA functions
- * libsamsung-ipc: export nv_data functions as common
- * - add data support
- * - stabilize SMS
- * - complete sound handling
* - USSD codes
* - full operators list
- * - airplane mode: trace: sys nodes?
* - ipc_disp_icon_info: trace on RILJ & emulate RIl_REQUEST_SIGNAL_STRENGTH
+ * - airplane mode: trace: sys nodes?
* - look at /sys nodes for data and airplane
- * - fails at killall zygote?
- * - call with +33
- * - gen phone res queue
- * - SMS ret isn't NULL (tpid)
- * - Android "0" net type (logs)!
+ * - fails at killall zygote? → airplane mode bug?
+ * - gen phone res queue → apply to max functions
+ *
+ * Call-related:
+ * - complete sound handling
* - add MIC_MUTE from RILJ
+ *
+ * SMS-related:
+ * - stabilize SMS
+ * - SMS ret isn't NULL (tpid)
+ *
+ * Data-related:
+ * - find a reliable way to configure data iface
+ * - GPRS: IPC_GPRS_CALL_STATUS, LAST_DATA_CALL_FAIL_CAUSE
+ * - check data with orange non-free ril: no gprs_ip_config
+ * - data: use IPC_GPRS_CALL_STATUS with global token for possible fail or return anyway and store ip config global?
+ * - update global fail cause in global after gprs_call_status, generic error on stored token
*/
/**
@@ -158,21 +166,13 @@ void ril_tokens_check(void)
* Clients dispatch functions
*/
-void respondGenPhonRes(struct ipc_message_info *info)
-{
- struct ipc_gen_phone_res *gen_res = (struct ipc_gen_phone_res*)info->data;
- unsigned short msg_type = ((gen_res->group << 8) | gen_res->type);
-
- if(msg_type == IPC_SEC_PIN_STATUS) {
- ipc_sec_pin_status_res(info);
- } else {
- LOGD("%s: unhandled generic response for msg %04x", __FUNCTION__, msg_type);
- }
-}
-
void ipc_fmt_dispatch(struct ipc_message_info *info)
{
switch(IPC_COMMAND(info)) {
+ /* GEN */
+ case IPC_GEN_PHONE_RES:
+ ipc_gen_phone_res(info);
+ break;
/* PWR */
case IPC_PWR_PHONE_PWR_UP:
ipc_pwr_phone_pwr_up();
@@ -263,34 +263,23 @@ void ipc_fmt_dispatch(struct ipc_message_info *info)
case IPC_GPRS_IP_CONFIGURATION:
ipc_gprs_ip_configuration(info);
break;
- /* OTHER */
- case IPC_GEN_PHONE_RES:
- respondGenPhonRes(info);
- break;
default:
- LOGD("Unknown msgtype: %04x", info->type);
+ LOGD("Unhandled command: %s (%04x)", ipc_command_to_str(IPC_COMMAND(info)), IPC_COMMAND(info));
break;
}
}
void ipc_rfs_dispatch(struct ipc_message_info *info)
{
- struct ipc_rfs_io *rfs_io;
-
switch(IPC_COMMAND(info)) {
case IPC_RFS_NV_READ_ITEM:
- LOGD("--> IPC_RFS_NV_READ_ITEM");
- rfs_io = (struct ipc_rfs_io *) info->data;
-
- LOGD("asking to read 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
-
+ ipc_rfs_nv_read_item(info);
break;
case IPC_RFS_NV_WRITE_ITEM:
- LOGD("--> IPC_RFS_NV_WRITE_ITEM");
-
- rfs_io = (struct ipc_rfs_io *) info->data;
-
- LOGD("asking to write 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
+ ipc_rfs_nv_write_item(info);
+ break;
+ default:
+ LOGD("Unhandled command: %s (%04x)", ipc_command_to_str(IPC_COMMAND(info)), IPC_COMMAND(info));
break;
}
}
@@ -304,6 +293,9 @@ void srs_dispatch(struct srs_message *message)
case SRS_SND_SET_CALL_CLOCK_SYNC:
srs_snd_set_call_clock_sync(message);
break;
+ default:
+ LOGD("Unhandled command: (%04x)", message->command);
+ break;
}
}
diff --git a/samsung-ril.h b/samsung-ril.h
index a331313..c4e60a6 100644
--- a/samsung-ril.h
+++ b/samsung-ril.h
@@ -115,6 +115,7 @@ struct ril_request_token {
};
int ril_request_id_new(void);
+int ril_request_reg_id(RIL_Token token);
int ril_request_get_id(RIL_Token token);
RIL_Token ril_request_get_token(int id);
int ril_request_get_canceled(RIL_Token token);
@@ -177,6 +178,8 @@ struct ril_state {
struct ipc_net_regist gprs_netinfo;
struct ipc_net_current_plmn plmndata;
+ struct ipc_gprs_pdp_context gprs_context;
+
unsigned char msg_tpid_lock;
char *msg_pdu;
};
@@ -188,8 +191,25 @@ int ril_modem_check(void);
* Clients dispatch functions
*/
-void ipc_dispatch(struct ipc_message_info *info);
+void ipc_fmt_dispatch(struct ipc_message_info *info);
+void ipc_rfs_dispatch(struct ipc_message_info *info);
+void srs_dispatch(struct srs_message *message);
+
+/* GEN */
+
+struct ipc_gen_phone_res_expect {
+ unsigned char aseq;
+ unsigned short command;
+ void (*func)(struct ipc_message_info *info);
+ int to_complete;
+ int to_abort;
+};
+void ipc_gen_phone_res_expect_to_func(unsigned char aseq, unsigned short command,
+ void (*func)(struct ipc_message_info *info));
+void ipc_gen_phone_res_expect_to_complete(unsigned char aseq, unsigned short command);
+void ipc_gen_phone_res_expect_to_abort(unsigned char aseq, unsigned short command);
+void ipc_gen_phone_res(struct ipc_message_info *info);
/* PWR */
void ipc_pwr_phone_pwr_up(void);
@@ -222,7 +242,7 @@ void ril_request_sim_status(RIL_Token t);
void ril_request_sim_io(RIL_Token t, void *data, size_t datalen);
void ipc_sec_rsim_access(struct ipc_message_info *info);
void ril_request_enter_sim_pin(RIL_Token t, void *data, size_t datalen);
-void ipc_sec_pin_status_res(struct ipc_message_info *info);
+void ipc_sec_pin_status_complete(struct ipc_message_info *info);
void ipc_sec_lock_info(struct ipc_message_info *info);
void ril_request_query_facility_lock(RIL_Token t, void *data, size_t datalen);
void ipc_sec_phone_lock(struct ipc_message_info *info);
@@ -271,4 +291,9 @@ void srs_snd_set_call_clock_sync(struct srs_message *message);
void ril_request_setup_data_call(RIL_Token t, void *data, int length);
void ipc_gprs_ip_configuration(struct ipc_message_info *info);
+/* RFS */
+
+void ipc_rfs_nv_read_item(struct ipc_message_info *info);
+void ipc_rfs_nv_write_item(struct ipc_message_info *info);
+
#endif
diff --git a/sim.c b/sim.c
index e3cb8a4..ef1d5b4 100644
--- a/sim.c
+++ b/sim.c
@@ -327,6 +327,9 @@ void ril_request_enter_sim_pin(RIL_Token t, void *data, size_t datalen)
ipc_fmt_send_set(IPC_SEC_PIN_STATUS, reqGetId(t), (unsigned char *) &pin_status, sizeof(pin_status));
+ ipc_gen_phone_res_expect_to_func(reqGetId(t), IPC_SEC_PIN_STATUS,
+ ipc_sec_pin_status_complete);
+
/* 2. Get lock status */
memset(buf, 0, sizeof(buf));
buf[0] = 1;
@@ -345,7 +348,7 @@ void ril_request_enter_sim_pin(RIL_Token t, void *data, size_t datalen)
*/
// FIXME: here, we're going to do that:
// do the pin status req, enqueue the token to gen phone res and use this custom function (dd possibility to use custom functions on return, not only return bare requests complete with dumb RIL_E_)
-void ipc_sec_pin_status_res(struct ipc_message_info *info)
+void ipc_sec_pin_status_complete(struct ipc_message_info *info)
{
struct ipc_gen_phone_res *gen_res = (struct ipc_gen_phone_res *) info->data;
int attempts = -1;