summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-02-09 10:44:48 +0100
committerPaul Kocialkowski <contact@paulk.fr>2013-02-09 10:44:48 +0100
commitf53bf346ed8a843414a339646b9362d4015bfc25 (patch)
tree08609f947286659837ab70eb4c6c18fd60d70399
parentd738d983c7d90b727ddda0f3fb3078a9334f5b6e (diff)
downloadhardware_ril_samsung-ril-f53bf346ed8a843414a339646b9362d4015bfc25.zip
hardware_ril_samsung-ril-f53bf346ed8a843414a339646b9362d4015bfc25.tar.gz
hardware_ril_samsung-ril-f53bf346ed8a843414a339646b9362d4015bfc25.tar.bz2
compat: Removed separate header: apply per-version changes in the code
This is especially relevant when the elements of the structures changed or need a different handling in the code: that way, we don't confuse which structure is declared. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--compat.h57
-rw-r--r--net.c20
-rw-r--r--samsung-ril.c11
-rw-r--r--samsung-ril.h18
-rw-r--r--sec.c16
5 files changed, 61 insertions, 61 deletions
diff --git a/compat.h b/compat.h
deleted file mode 100644
index eb6fb56..0000000
--- a/compat.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * This file is part of samsung-ril.
- *
- * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
- * Copyright (C) 2011-2012 Paul Kocialkowski <contact@paulk.fr>
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- *
- * 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/>.
- *
- */
-
-#ifndef __COMPAT_H__
-#define __COMPAT_H__
-
-#include <telephony/ril.h>
-#include <utils/Log.h>
-
-#ifndef LOGE
- #define LOGE ALOGE
-#endif
-
-#ifndef LOGI
- #define LOGI ALOGI
-#endif
-
-#ifndef LOGD
- #define LOGD ALOGD
-#endif
-
-#if RIL_VERSION >= 6
- #define RIL_REQUEST_REGISTRATION_STATE RIL_REQUEST_VOICE_REGISTRATION_STATE
- #define RIL_REQUEST_GPRS_REGISTRATION_STATE RIL_REQUEST_DATA_REGISTRATION_STATE
- #define RIL_CardStatus RIL_CardStatus_v6
- #define RIL_SIM_IO RIL_SIM_IO_v6
- #define RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
-#endif
-
-//set it to the maximum supported revision
-//we've not yet fully implemented version 7
-#if RIL_VERSION >= 6
- #define SAMSUNG_RIL_VERSION 6
-#else
- #define SAMSUNG_RIL_VERSION RIL_VERSION
-#endif
-
-#endif //__COMPAT_H__
diff --git a/net.c b/net.c
index c93ac9b..4e4cdf2 100644
--- a/net.c
+++ b/net.c
@@ -416,7 +416,11 @@ void ipc_net_current_plmn(struct ipc_message_info *message)
LOGD("Updating Operator data in background");
} else {
ril_tokens_net_set_data_waiting();
+#if RIL_VERSION >= 6
+ ril_request_unsolicited(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, NULL, 0);
+#else
ril_request_unsolicited(RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED, NULL, 0);
+#endif
}
}
break;
@@ -472,7 +476,11 @@ void ipc_net_current_plmn(struct ipc_message_info *message)
* return modem UNSOL data if available
* request IPC_NET_REGIST if no data is there
*/
+#if RIL_VERSION >= 6
+void ril_request_voice_registration_state(RIL_Token t)
+#else
void ril_request_registration_state(RIL_Token t)
+#endif
{
struct ipc_net_regist_get regist_req;
char *response[4];
@@ -524,7 +532,11 @@ void ril_request_registration_state(RIL_Token t)
* return modem UNSOL data if available
* request IPC_NET_REGIST if no data is there
*/
+#if RIL_VERSION >= 6
+void ril_request_data_registration_state(RIL_Token t)
+#else
void ril_request_gprs_registration_state(RIL_Token t)
+#endif
{
struct ipc_net_regist_get regist_req;
char *response[4];
@@ -590,7 +602,11 @@ void ipc_net_regist_unsol(struct ipc_message_info *message)
LOGD("Updating NetRegist data in background");
} else {
ril_tokens_net_set_data_waiting();
+#if RIL_VERSION >= 6
+ ril_request_unsolicited(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, NULL, 0);
+#else
ril_request_unsolicited(RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED, NULL, 0);
+#endif
}
break;
@@ -607,7 +623,11 @@ void ipc_net_regist_unsol(struct ipc_message_info *message)
LOGD("Updating GPRSNetRegist data in background");
} else {
ril_tokens_net_set_data_waiting();
+#if RIL_VERSION >= 6
+ ril_request_unsolicited(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, NULL, 0);
+#else
ril_request_unsolicited(RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED, NULL, 0);
+#endif
}
break;
default:
diff --git a/samsung-ril.c b/samsung-ril.c
index 73c2ecd..f84b9f0 100644
--- a/samsung-ril.c
+++ b/samsung-ril.c
@@ -522,12 +522,21 @@ void ril_on_request(int request, void *data, size_t length, RIL_Token t)
case RIL_REQUEST_OPERATOR:
ril_request_operator(t);
break;
+#if RIL_VERSION >= 6
+ case RIL_REQUEST_VOICE_REGISTRATION_STATE:
+ ril_request_voice_registration_state(t);
+ break;
+ case RIL_REQUEST_DATA_REGISTRATION_STATE:
+ ril_request_data_registration_state(t);
+ break;
+#else
case RIL_REQUEST_REGISTRATION_STATE:
ril_request_registration_state(t);
break;
case RIL_REQUEST_GPRS_REGISTRATION_STATE:
ril_request_gprs_registration_state(t);
break;
+#endif
case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS:
ril_request_query_available_networks(t);
break;
@@ -650,7 +659,7 @@ void ril_data_init(void)
*/
static const RIL_RadioFunctions ril_ops = {
- SAMSUNG_RIL_VERSION,
+ RIL_VERSION >= 6 ? 6 : RIL_VERSION,
ril_on_request,
ril_on_state_request,
ril_on_supports,
diff --git a/samsung-ril.h b/samsung-ril.h
index 9fce50b..1643658 100644
--- a/samsung-ril.h
+++ b/samsung-ril.h
@@ -29,7 +29,6 @@
#include <radio.h>
-#include "compat.h"
#include "ipc.h"
#include "srs.h"
@@ -37,6 +36,18 @@
* Defines
*/
+#ifndef LOGE
+ #define LOGE ALOGE
+#endif
+
+#ifndef LOGI
+ #define LOGI ALOGI
+#endif
+
+#ifndef LOGD
+ #define LOGD ALOGD
+#endif
+
#define RIL_VERSION_STRING "Samsung RIL"
#define RIL_LOCK() pthread_mutex_lock(&ril_data.mutex)
@@ -282,8 +293,13 @@ void ril_plmn_string(char *plmn_data, char *response[3]);
unsigned char ril_plmn_act_get(char *plmn_data);
void ril_request_operator(RIL_Token t);
void ipc_net_current_plmn(struct ipc_message_info *message);
+#if RIL_VERSION >= 6
+void ril_request_voice_registration_state(RIL_Token t);
+void ril_request_data_registration_state(RIL_Token t);
+#else
void ril_request_registration_state(RIL_Token t);
void ril_request_gprs_registration_state(RIL_Token t);
+#endif
void ipc_net_regist(struct ipc_message_info *message);
void ril_request_query_available_networks(RIL_Token t);
void ipc_net_plmn_list(struct ipc_message_info *info);
diff --git a/sec.c b/sec.c
index 53cfca4..e3627b9 100644
--- a/sec.c
+++ b/sec.c
@@ -121,7 +121,11 @@ void ril_state_update(ril_sim_state sim_state)
ril_request_unsolicited(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, NULL, 0);
}
+#if RIL_VERSION >= 6
+void ipc2ril_card_status(struct ipc_sec_sim_status_response *pin_status, RIL_CardStatus_v6 *card_status)
+#else
void ipc2ril_card_status(struct ipc_sec_sim_status_response *pin_status, RIL_CardStatus *card_status)
+#endif
{
ril_sim_state sim_state;
int app_status_array_length;
@@ -216,7 +220,11 @@ void ipc_sec_sim_status(struct ipc_message_info *info)
{
RIL_Token t = ril_request_get_token(info->aseq);
struct ipc_sec_sim_status_response *pin_status = (struct ipc_sec_sim_status_response *) info->data;
+#if RIL_VERSION >= 6
+ RIL_CardStatus_v6 card_status;
+#else
RIL_CardStatus card_status;
+#endif
ril_sim_state sim_state;
switch(info->type) {
@@ -253,7 +261,7 @@ void ipc_sec_sim_status(struct ipc_message_info *info)
memcpy(&(ril_data.state.sim_pin_status), pin_status, sizeof(struct ipc_sec_sim_status_response));
ipc2ril_card_status(pin_status, &card_status);
- ril_request_complete(t, RIL_E_SUCCESS, &card_status, sizeof(RIL_CardStatus));
+ ril_request_complete(t, RIL_E_SUCCESS, &card_status, sizeof(card_status));
if(ril_data.tokens.pin_status != RIL_TOKEN_DATA_WAITING)
ril_data.tokens.pin_status = (RIL_Token) 0x00;
@@ -273,7 +281,11 @@ void ipc_sec_sim_status(struct ipc_message_info *info)
void ril_request_get_sim_status(RIL_Token t)
{
struct ipc_sec_sim_status_response *pin_status;
+#if RIL_VERSION >= 6
+ RIL_CardStatus_v6 card_status;
+#else
RIL_CardStatus card_status;
+#endif
if(ril_data.tokens.pin_status == RIL_TOKEN_DATA_WAITING) {
LOGD("Got RILJ request for UNSOL data");
@@ -282,7 +294,7 @@ void ril_request_get_sim_status(RIL_Token t)
ipc2ril_card_status(pin_status, &card_status);
- ril_request_complete(t, RIL_E_SUCCESS, &card_status, sizeof(RIL_CardStatus));
+ ril_request_complete(t, RIL_E_SUCCESS, &card_status, sizeof(card_status));
ril_data.tokens.pin_status = (RIL_Token) 0x00;
} else if(ril_data.tokens.pin_status == (RIL_Token) 0x00) {