[Replicant] [libsamsung-ril] [PATCH 14/23] Fix logging on Android 11

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Thu Mar 4 12:42:41 UTC 2021


Without that patch, on Replicant 11, with 'adb logcat -b radio',
we do not see any of the log messages that libsamsung-ril is
supposed to emmit.

In addition, liblog[1]'s README.md has the following:
    `[ASR]LOG[VDIWE]` calls are used to log to BAsic, System or
    Radio sub-logs [...].

So we need to use RLOG anyway, at least with Replicant 11.

To avoid breaking the compatibility with older versions, we
fallback on ALOG when RLOG is not available.

[1]liblog is available in system/core/liblog/ in the Android
   source code or in liblog/ in the following git repository:
   https://android.googlesource.com/platform/system/core

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 samsung-ril.h | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/samsung-ril.h b/samsung-ril.h
index 3d4d9fc..8cc012d 100644
--- a/samsung-ril.h
+++ b/samsung-ril.h
@@ -47,22 +47,34 @@
  * Macros
  */
 
-#ifdef ALOGI
+#if defined(RLOGI)
+#define RIL_LOGI				RLOGI
+#elif defined(ALOGI)
 #define RIL_LOGI				ALOGI
-#else
+#elif defined(LOGI)
 #define RIL_LOGI				LOGI
+#else
+#error "Cannot define RIL_LOGI"
 #endif
 
-#ifdef ALOGD
+#if defined(RLOGD)
+#define RIL_LOGD				RLOGD
+#elif defined(ALOGD)
 #define RIL_LOGD				ALOGD
-#else
+#elif defined(LOGD)
 #define RIL_LOGD				LOGD
+#else
+#error "Cannot define RIL_LOGD"
 #endif
 
-#ifdef ALOGE
+#if defined(RLOGE)
+#define RIL_LOGE				RLOGE
+#elif defined(ALOGE)
 #define RIL_LOGE				ALOGE
-#else
+#elif defined(LOGE)
 #define RIL_LOGE				LOGE
+#else
+#error "Cannot define RIL_LOGE"
 #endif
 
 #define RIL_LOCK()				pthread_mutex_lock(&ril_data->mutex)
-- 
2.30.1



More information about the Replicant mailing list