bluez: pand: Enable android logging
Signed-off-by: San Mehat <san@google.com>
diff --git a/compat/Android.mk b/compat/Android.mk
index a67c2b4..d884f9d 100755
--- a/compat/Android.mk
+++ b/compat/Android.mk
@@ -13,7 +13,7 @@
pand.c bnep.c sdp.c
LOCAL_CFLAGS:= \
- -DVERSION=\"4.47\" -DSTORAGEDIR=\"/data/misc/bluetoothd\" -DNEED_PPOLL
+ -DVERSION=\"4.47\" -DSTORAGEDIR=\"/data/misc/bluetoothd\" -DNEED_PPOLL -D__ANDROID__
LOCAL_C_INCLUDES:=\
$(LOCAL_PATH)/../lib \
diff --git a/compat/pand.c b/compat/pand.c
index c3860fa..6554e50 100644
--- a/compat/pand.c
+++ b/compat/pand.c
@@ -51,6 +51,11 @@
#include "sdp.h"
#include "pand.h"
+#ifdef __ANDROID__
+#include <android/log.h>
+#define syslog android_log
+#endif
+
#ifdef NEED_PPOLL
#include "ppoll.h"
#endif
@@ -99,6 +104,25 @@
int nsk;
};
+#ifdef __ANDROID__
+static void android_log(int priority, const char *format, ...)
+{
+ va_list ap;
+ int alog_lvl;
+
+ if (priority <= LOG_ERR)
+ alog_lvl = ANDROID_LOG_ERROR;
+ else if (priority == LOG_WARNING)
+ alog_lvl = ANDROID_LOG_WARN;
+ else if (priority <= LOG_INFO)
+ alog_lvl = ANDROID_LOG_INFO;
+ else
+ alog_lvl = ANDROID_LOG_DEBUG;
+ va_start(ap, format);
+ __android_log_vprint(alog_lvl, "pand", format, ap);
+ va_end(ap);
+}
+#endif
static void run_script(char *script, char *dev, char *dst, int sk, int nsk)
{
char *argv[4];