Add the compat.h header to multiple Android trees
authorAlexander Tarasikov <alexander.tarasikov@gmail.com>
Wed, 22 Aug 2012 21:21:52 +0000 (01:21 +0400)
committerAlexander Tarasikov <alexander.tarasikov@gmail.com>
Wed, 22 Aug 2012 21:21:52 +0000 (01:21 +0400)
Android.mk
compat.h [new file with mode: 0644]
samsung-ril.c
samsung-ril.h

index 08b4c0f..3badf11 100644 (file)
@@ -60,12 +60,6 @@ endif
 
 ifeq ($(TARGET_DEVICE),galaxys2)
        LOCAL_CFLAGS += -DDEVICE_IPC_V4
-       LOCAL_CFLAGS += -DRIL_REQUEST_REGISTRATION_STATE=RIL_REQUEST_VOICE_REGISTRATION_STATE
-       LOCAL_CFLAGS += -DRIL_REQUEST_GPRS_REGISTRATION_STATE=RIL_REQUEST_DATA_REGISTRATION_STATE
-       LOCAL_CFLAGS += -DRIL_SignalStrength=RIL_SignalStrength_v6
-       LOCAL_CFLAGS += -DRIL_CardStatus=RIL_CardStatus_v6
-       LOCAL_CFLAGS += -DRIL_SIM_IO=RIL_SIM_IO_v6
-       LOCAL_CFLAGS += -DRIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED=RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
        samsung-ipc_device := galaxys2
 endif
 
@@ -80,12 +74,6 @@ endif
 
 ifeq ($(TARGET_DEVICE),maguro)
        LOCAL_CFLAGS += -DDEVICE_IPC_V4
-       LOCAL_CFLAGS += -DRIL_REQUEST_REGISTRATION_STATE=RIL_REQUEST_VOICE_REGISTRATION_STATE
-       LOCAL_CFLAGS += -DRIL_REQUEST_GPRS_REGISTRATION_STATE=RIL_REQUEST_DATA_REGISTRATION_STATE
-       LOCAL_CFLAGS += -DRIL_SignalStrength=RIL_SignalStrength_v6
-       LOCAL_CFLAGS += -DRIL_CardStatus=RIL_CardStatus_v6
-       LOCAL_CFLAGS += -DRIL_SIM_IO=RIL_SIM_IO_v6
-       LOCAL_CFLAGS += -DRIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED=RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
        samsung-ipc_device := maguro
 endif
 
diff --git a/compat.h b/compat.h
new file mode 100644 (file)
index 0000000..efbdd60
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,54 @@
+/**
+ * This file is part of samsung-ril.
+ *
+ * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
+ * Copyright (C) 2011 Paul Kocialkowski <contact@oaulk.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_SignalStrength RIL_SignalStrength_v6
+       #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
+#define SAMSUNG_RIL_VERSION 6
+
+#endif //__COMPAT_H__
index 6aca65b..8f15810 100644 (file)
@@ -525,7 +525,7 @@ void ril_state_lpm(void)
 
 
 static const RIL_RadioFunctions ril_ops = {
-       6, //RIL_VERSION
+       SAMSUNG_RIL_VERSION,
        onRequest,
        currentState,
        onSupports,
index d94d583..b0e46e4 100644 (file)
 #include <telephony/ril.h>
 #include <radio.h>
 
-#include <utils/Log.h>
-
-#ifndef LOGE
-       #define LOGE ALOGE
-#endif
-
-#ifndef LOGI
-       #define LOGI ALOGI
-#endif
-
-#ifndef LOGD
-       #define LOGD ALOGD
-#endif
-
+#include "compat.h"
 #include "ipc.h"
 #include "srs.h"