Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: third_party/hwcplus/src/hardware.c

Issue 252583002: Make it possible to build libhardware. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hwc2
Patch Set: add copyright Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/hwcplus/include/system/graphics.h ('k') | third_party/hwcplus/src/hwcplus_util.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/hwcplus/src/hardware.c
diff --git a/third_party/hwcplus/src/hardware.c b/third_party/hwcplus/src/hardware.c
index 6713ea0107efa7f0aa0b84dfd7881535cc0b4572..4ff293d243cefae991b156e93c9925d396d82f91 100644
--- a/third_party/hwcplus/src/hardware.c
+++ b/third_party/hwcplus/src/hardware.c
@@ -23,17 +23,29 @@
#include <pthread.h>
#include <errno.h>
#include <limits.h>
+#include <stdlib.h>
#define LOG_TAG "HAL"
+#ifdef ANDROID
#include <utils/Log.h>
+#else
+#include <stdio.h>
+#include <unistd.h>
+#include <log/log.h>
+#endif
-/** Base path of the hal modules */
#if defined(__LP64__)
-#define HAL_LIBRARY_PATH1 "/system/lib64/hw"
-#define HAL_LIBRARY_PATH2 "/vendor/lib64/hw"
+#define _64 "64"
#else
-#define HAL_LIBRARY_PATH1 "/system/lib/hw"
-#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"
+#define _64 ""
+#endif
+
+/** Base path of the hal modules */
+#ifndef HAL_LIBRARY_PATH1
+#define HAL_LIBRARY_PATH1 "/system/lib" _64 "/hw"
+#endif
+#ifndef HAL_LIBRARY_PATH2
+#define HAL_LIBRARY_PATH2 "/vendor/lib" _64 "/hw"
#endif
/**
@@ -129,6 +141,14 @@ static int load(const char *id,
static int hw_module_exists(char *path, size_t path_len, const char *name,
const char *subname)
{
+ char *hal_library_path = getenv("HAL_LIBRARY_PATH");
+ if (hal_library_path) {
+ snprintf(path, path_len, "%s/%s.%s.so",
+ hal_library_path, name, subname);
+ if (access(path, R_OK) == 0)
+ return 0;
+ }
+
snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH2, name, subname);
if (access(path, R_OK) == 0)
« no previous file with comments | « third_party/hwcplus/include/system/graphics.h ('k') | third_party/hwcplus/src/hwcplus_util.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698