From 58c04b0723cf609f0ce8743716cc90cc0a879831 Mon Sep 17 00:00:00 2001 From: SangYoun Kwak Date: Mon, 24 Jun 2024 16:43:19 +0900 Subject: [PATCH] Modify to be buildable with hal-rootstrap To use hal-rootstrap as a only BuildRequires package, with contains every package that hal backends need, spec file and cmake file are modified. Also, hal-rootstrap does not have 'dlog-internal.h'(it should be used only for internal), symbols from it like SLOGE are replaced by functions provided by 'dlog.h'. Change-Id: I078befbec7ddae394bf657631e3ae28571242c18 Signed-off-by: SangYoun Kwak --- CMakeLists.txt | 2 +- packaging/hal-backend-sensor-emulator.spec | 4 +--- src/sensor_log.h | 13 +++++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a45991..40fcfc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ INCLUDE(GNUInstallDirs) SET(LIBRARY_NAME "hal-backend-sensor") SET(HAL_LIBDIR ${CMAKE_HAL_LIBDIR_PREFIX}) SET(HAL_LICENSEDIR ${CMAKE_HAL_LICENSEDIR_PREFIX}) -SET(DEPENDENTS "dlog hal-api-common hal-api-sensor") +SET(DEPENDENTS "hal-rootstrap") SET(ACCEL "ON") diff --git a/packaging/hal-backend-sensor-emulator.spec b/packaging/hal-backend-sensor-emulator.spec index 8de52e1..ce43051 100644 --- a/packaging/hal-backend-sensor-emulator.spec +++ b/packaging/hal-backend-sensor-emulator.spec @@ -11,9 +11,7 @@ Source2: 99-sensorhub.rules ExcludeArch: %{arm} riscv64 BuildRequires: cmake -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(hal-api-common) -BuildRequires: pkgconfig(hal-api-sensor) +BuildRequires: pkgconfig(hal-rootstrap) %description Sensor HAL backend drivers for emulator targets diff --git a/src/sensor_log.h b/src/sensor_log.h index d8db893..d8c2cde 100644 --- a/src/sensor_log.h +++ b/src/sensor_log.h @@ -31,15 +31,20 @@ #define LOG_DUMP(fp, fmt, arg...) do { if (fp) fprintf(fp, fmt, ##arg); else _E(fmt, ##arg); } while (0) +#define ALOGD(format, ...) dlog_print(DLOG_DEBUG, LOG_TAG, format, ##__VA_ARGS__) +#define ALOGE(format, ...) dlog_print(DLOG_ERROR, LOG_TAG, format, ##__VA_ARGS__) +#define ALOGW(format, ...) dlog_print(DLOG_WARN, LOG_TAG, format, ##__VA_ARGS__) +#define ALOGI(format, ...) dlog_print(DLOG_INFO, LOG_TAG, format, ##__VA_ARGS__) + #ifdef _DEBUG -#define DBG SLOGD +#define DBG ALOGD #else #define DBG(...) do { } while (0) #endif -#define ERR SLOGE -#define WARN SLOGW -#define INFO SLOGI +#define ERR ALOGE +#define WARN ALOGW +#define INFO ALOGI #define _E ERR #define _W WARN #define _I INFO -- 2.34.1