summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorHarikrishnan Hariharan <hahariha@codeaurora.org>2017-09-14 22:50:42 +0530
committerHarikrishnan Hariharan <hahariha@codeaurora.org>2017-10-16 14:44:36 +0530
commit5f583c63753f2edb9cbb8a5497e08007ce4ad397 (patch)
tree7d7e129b6af53ef0b99c7e28f47a8125e98af13c /utils
parent9f2a492534a5ac5ec505296c7f2e86358cfac498 (diff)
downloadgps-5f583c63753f2edb9cbb8a5497e08007ce4ad397.tar.gz
Enable logcat logging for location modules in LE
Add support for logcat logging for location modules in LE, by adding appropriate flags -llog to LDFLAGS. Update logging macros to use ALOG* so that logs can be outputed using standard logcat adb commands. Change-Id: I94b5a1e9f0b4ec78a55e7189002e0f674ef174d2 CRs-Fixed: 2117669
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile.am4
-rw-r--r--utils/log_util.h10
-rw-r--r--utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h12
-rw-r--r--utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h10
-rw-r--r--utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in2
-rw-r--r--utils/platform_lib_abstractions/loc_pla/src/Makefile.am1
6 files changed, 23 insertions, 16 deletions
diff --git a/utils/Makefile.am b/utils/Makefile.am
index b8c4c52..506309c 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,5 +1,6 @@
AM_CFLAGS = -Wundef \
-I./ \
+ -I$(WORKSPACE)/system/core/include \
-std=c++11 \
$(LOCPLA_CFLAGS)
@@ -24,7 +25,8 @@ libgps_utils_so_la_h_sources = \
loc_nmea.h \
gps_extended_c.h \
gps_extended.h \
- loc_gps.h
+ loc_gps.h \
+ log_util.h
libgps_utils_so_la_c_sources = \
linked_list.c \
diff --git a/utils/log_util.h b/utils/log_util.h
index 7eb338a..d5884b7 100644
--- a/utils/log_util.h
+++ b/utils/log_util.h
@@ -30,12 +30,12 @@
#ifndef __LOG_UTIL_H__
#define __LOG_UTIL_H__
-#ifndef USE_GLIB
+#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
+// Android and LE targets with logcat support
#include <utils/Log.h>
-#endif /* USE_GLIB */
-
-#ifdef USE_GLIB
+#elif defined (USE_GLIB)
+// LE targets with no logcat support
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
@@ -45,7 +45,7 @@
#endif // LOG_TAG
-#endif /* USE_GLIB */
+#endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */
#ifdef __cplusplus
extern "C"
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
index 26d3c29..08a9585 100644
--- a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
+++ b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
@@ -30,11 +30,6 @@
#define __PLATFORM_LIB_LOG_UTIL_H__
#include "platform_lib_macros.h"
-
-#ifndef USE_GLIB
-#include <log_util.h>
-#else
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -46,6 +41,11 @@
#define LOG_TAG "GPS_UTILS"
#endif /* LOG_TAG */
+#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
+// Android and LE targets with logcat support
+#include <log_util.h>
+#else
+// LE targets without logcat support
#ifdef __cplusplus
extern "C"
{
@@ -169,6 +169,6 @@ char* get_timestamp(char* str, unsigned long buf_size);
}
#endif
-#endif /* USE_GLIB */
+#endif /* else of #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */
#endif /* __PLATFORM_LIB_LOG_UTIL_H__ */
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
index d0795eb..b896b94 100644
--- a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
+++ b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
@@ -33,19 +33,23 @@
extern "C" {
#endif
-#ifdef USE_GLIB
#include <sys/time.h>
#include <string.h>
#include <stdlib.h>
-#ifndef OFF_TARGET
+
+#ifdef USE_GLIB
#include <glib.h>
+#ifndef OFF_TARGET
#define strlcat g_strlcat
#define strlcpy g_strlcpy
#else
#define strlcat strncat
#define strlcpy strncpy
#endif
+#endif /* USE_GLIB */
+#if defined (USE_GLIB) && !defined (USE_ANDROID_LOGGING)
+// LE targets with no logcat support
#define TS_PRINTF(format, x...) \
{ \
struct timeval tv; \
@@ -64,7 +68,7 @@ extern "C" {
#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x)
#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x)
-#endif /* USE_GLIB */
+#endif /* #if defined (USE_GLIB) && !defined (USE_ANDROID_LOGGING) */
// Below are the location conf file paths
diff --git a/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in b/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
index 1aad2f4..9ec510d 100644
--- a/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
+++ b/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
@@ -7,4 +7,4 @@ Name: loc-pla
Description: QTI GPS Location Platform Library Abstractions
Version: @VERSION@
Libs: -L${libdir} -lloc_pla
-Cflags: -I${includedir}/loc-pla
+Cflags: -I${includedir}/loc-pla -I${includedir}/gps-utils
diff --git a/utils/platform_lib_abstractions/loc_pla/src/Makefile.am b/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
index 30c4b4c..ac7f8a0 100644
--- a/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
+++ b/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
@@ -1,5 +1,6 @@
AM_CFLAGS = \
$(LOCSTUB_CFLAGS) \
+ -I$(WORKSPACE)/hardware/qcom/gps/utils/ \
-I../include \
-D__func__=__PRETTY_FUNCTION__ \
-fno-short-enums