From 17e2ec0bbe363a24a3d9a6f4b0128a152f6db31a Mon Sep 17 00:00:00 2001 From: PaulK Date: Thu, 27 Oct 2011 22:16:51 +0200 Subject: Corrected Android.mk, crespo_ipc file, some headers and helpers. --- Android.mk | 28 ++++++++++++++++++---------- include/misc.h | 4 ++-- include/sec.h | 4 ++-- samsung-ipc/device/crespo/crespo_ipc.c | 27 ++++++++++++++------------- samsung-ipc/misc.c | 2 +- samsung-ipc/sec.c | 2 +- 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/Android.mk b/Android.mk index f646042..5a74536 100644 --- a/Android.mk +++ b/Android.mk @@ -1,24 +1,32 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := ipc-modemctrl +LOCAL_MODULE := libsamsung-ipc LOCAL_MODULE_TAGS := optional samsung-ipc_files := \ samsung-ipc/ipc.c \ samsung-ipc/ipc_util.c \ - samsung-ipc/crespo_ipc.c \ - samsung-ipc/crespo_nv_data.c \ - samsung-ipc/util.c + samsung-ipc/util.c \ + samsung-ipc/gprs.c \ + samsung-ipc/misc.c \ + samsung-ipc/sec.c \ + samsung-ipc/device/$(TARGET_DEVICE)/$(TARGET_DEVICE)_ipc.c -modemctrl_files := tools/modemctrl.c +#modemctrl_files := tools/modemctrl.c + +ifeq ($(TARGET_DEVICE),crespo) + device_files := samsung-ipc/device/$(TARGET_DEVICE)/$(TARGET_DEVICE)_nv_data.c + LOCAL_CFLAGS += -Iexternal/openssl/include + LOCAL_LDFLAGS += -lcrypto +endif + +LOCAL_SRC_FILES := $(samsung-ipc_files) $(device_files) $(modemctrl_files) -LOCAL_SRC_FILES := $(samsung-ipc_files) $(modemctrl_files) LOCAL_SHARED_LIBRARIES := libutils LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \ $(LOCAL_PATH)/samsung-ipc -LOCAL_CFLAGS += -Iexternal/openssl/include -LOCAL_LDFLAGS += -lcrypto -#include $(BUILD_STATIC_LIBRARY) -include $(BUILD_EXECUTABLE) + +include $(BUILD_STATIC_LIBRARY) +#include $(BUILD_EXECUTABLE) diff --git a/include/misc.h b/include/misc.h index cc26c93..111fe7b 100644 --- a/include/misc.h +++ b/include/misc.h @@ -21,7 +21,7 @@ #ifndef __MISC_H__ #define __MISC_H__ -struct ipc_response; +struct ipc_message_info; #define IPC_MISC_ME_VERSION 0x0A01 #define IPC_MISC_ME_IMSI 0x0A02 @@ -43,7 +43,7 @@ struct ipc_misc_time_info { char plmn[6]; } __attribute__((__packed__)); -char* ipc_misc_me_imsi_response_get_imsi(struct ipc_response *response); +char* ipc_misc_me_imsi_response_get_imsi(struct ipc_message_info *response); #endif diff --git a/include/sec.h b/include/sec.h index 3401a40..d5dee00 100644 --- a/include/sec.h +++ b/include/sec.h @@ -21,7 +21,7 @@ #ifndef __SEC_H__ #define __SEC_H__ -struct ipc_response; +struct ipc_message_info; #define IPC_SEC_PIN_STATUS 0x0501 #define IPC_SEC_PHONE_LOCK 0x0502 @@ -109,7 +109,7 @@ struct ipc_sec_lock_info_response { unsigned char attempts; } __attribute__((__packed__)); -char* ipc_sec_rsim_access_response_get_file_data(struct ipc_response *response); +char* ipc_sec_rsim_access_response_get_file_data(struct ipc_message_info *response); void ipc_sec_pin_status_set_setup(struct ipc_sec_pin_status_set *message, unsigned char pin_type, char *pin1, char *pin2); diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c index 4cca4c0..8752ae0 100644 --- a/samsung-ipc/device/crespo/crespo_ipc.c +++ b/samsung-ipc/device/crespo/crespo_ipc.c @@ -344,7 +344,7 @@ int wake_unlock(char *lock_name, int size) return rc; } -int crespo_ipc_client_recv(struct ipc_client *client, struct ipc_response *response) +int crespo_ipc_client_recv(struct ipc_client *client, struct ipc_message_info *response) { struct modem_io modem_data; struct ipc_header *resphdr; @@ -354,7 +354,7 @@ int crespo_ipc_client_recv(struct ipc_client *client, struct ipc_response *respo modem_data.data = malloc(MAX_MODEM_DATA_SIZE); modem_data.size = MAX_MODEM_DATA_SIZE; - memset(response, 0, sizeof(struct ipc_response)); + memset(response, 0, sizeof(struct ipc_message_info)); wake_lock("secril_fmt-interface", sizeof("secril_fmt-interface") - 1); // FIXME sizeof("...") is ugly! @@ -380,18 +380,19 @@ int crespo_ipc_client_recv(struct ipc_client *client, struct ipc_response *respo response->mseq = resphdr->mseq; response->aseq = resphdr->aseq; - response->command = IPC_COMMAND(resphdr); + response->group = resphdr->group; + response->index = resphdr->index; response->type = resphdr->type; - response->data_length = modem_data.size - sizeof(struct ipc_header); + response->length = modem_data.size - sizeof(struct ipc_header); response->data = NULL; - ipc_client_log(client, "INFO: crespo_ipc_client_recv: response: group = %d, index = %d, command = %04x", - resphdr->group, resphdr->index, response->command); + ipc_client_log(client, "INFO: crespo_ipc_client_recv: response: group = %d, index = %d", + resphdr->group, resphdr->index); - if(response->data_length > 0) + if(response->length > 0) { - response->data = malloc(response->data_length); - memcpy(response->data, (uint8_t *) modem_data.data + sizeof(struct ipc_header), response->data_length); + response->data = malloc(response->length); + memcpy(response->data, (uint8_t *) modem_data.data + sizeof(struct ipc_header), response->length); } free(modem_data.data); @@ -403,16 +404,16 @@ int crespo_ipc_client_recv(struct ipc_client *client, struct ipc_response *respo int crespo_ipc_open(void *data, unsigned int size, void *io_data) { - int type=*((int *) data); - int fd=-1; + int type = *((int *) data); + int fd = -1; switch(type) { - case IPC_CLIENT_TYPE_CRESPO_FMT: + case IPC_CLIENT_TYPE_FMT: fd = open("/dev/modem_fmt", O_RDWR | O_NDELAY); printf("crespo_ipc_open: opening /dev/modem_fmt\n"); break; - case IPC_CLIENT_TYPE_CRESPO_RFS: + case IPC_CLIENT_TYPE_RFS: fd = open("/dev/modem_rfs", O_RDWR | O_NDELAY); printf("crespo_ipc_open: opening /dev/modem_rfs\n"); break; diff --git a/samsung-ipc/misc.c b/samsung-ipc/misc.c index 609d7b8..c4f27ee 100644 --- a/samsung-ipc/misc.c +++ b/samsung-ipc/misc.c @@ -23,7 +23,7 @@ #define DEFAULT_IMSI_LENGTH 15 -char* ipc_misc_me_imsi_response_get_imsi(struct ipc_response *response) +char* ipc_misc_me_imsi_response_get_imsi(struct ipc_message_info *response) { if (response == NULL || response->data[0] != DEFAULT_IMSI_LENGTH) return NULL; diff --git a/samsung-ipc/sec.c b/samsung-ipc/sec.c index 9cef712..174b842 100644 --- a/samsung-ipc/sec.c +++ b/samsung-ipc/sec.c @@ -43,7 +43,7 @@ void ipc_sec_pin_status_set_setup(struct ipc_sec_pin_status_set *message, } } -char* ipc_sec_rsim_access_response_get_file_data(struct ipc_response *response) +char* ipc_sec_rsim_access_response_get_file_data(struct ipc_message_info *response) { int n = 0; int offset = (int) sizeof(struct ipc_sec_rsim_access_response); -- cgit v1.1