diff options
author | San Mehat <san@google.com> | 2010-01-21 10:35:35 -0800 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2011-03-30 13:57:04 -0700 |
commit | 9d48b90eef7745132f36d85136467303e96aa6fe (patch) | |
tree | 3789966558fb056dd5e0b55aab8f9c9c821e8c4d /compat | |
parent | 4a258f2721619b7e35aae99a3285a34bc0a52557 (diff) | |
download | bluez-9d48b90eef7745132f36d85136467303e96aa6fe.tar.gz |
bluez: pand: Enable android logging
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'compat')
-rwxr-xr-x | compat/Android.mk | 2 | ||||
-rw-r--r-- | compat/pand.c | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/compat/Android.mk b/compat/Android.mk index a67c2b4f..d884f9d5 100755 --- a/compat/Android.mk +++ b/compat/Android.mk @@ -13,7 +13,7 @@ LOCAL_SRC_FILES:= \ 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 c3860fa4..6554e502 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 @@ struct script_arg { 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]; |