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

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: clean up more lint 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
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..7e94d0ba45a84f266ed3c86d8f66fe39bcd90d31 100644
--- a/third_party/hwcplus/src/hardware.c
+++ b/third_party/hwcplus/src/hardware.c
@@ -18,6 +18,7 @@
#include <cutils/properties.h>
+#include <stdlib.h>
#include <dlfcn.h>
#include <string.h>
#include <pthread.h>
@@ -28,12 +29,8 @@
#include <utils/Log.h>
/** Base path of the hal modules */
-#if defined(__LP64__)
-#define HAL_LIBRARY_PATH1 "/system/lib64/hw"
-#define HAL_LIBRARY_PATH2 "/vendor/lib64/hw"
-#else
-#define HAL_LIBRARY_PATH1 "/system/lib/hw"
-#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"
+#if !defined(DEFAULT_HAL_LIBRARY_PATH)
+#define DEFAULT_HAL_LIBRARY_PATH "/usr/lib/hwcplus"
#endif
/**
@@ -129,13 +126,10 @@ static int load(const char *id,
static int hw_module_exists(char *path, size_t path_len, const char *name,
const char *subname)
{
- snprintf(path, path_len, "%s/%s.%s.so",
- HAL_LIBRARY_PATH2, name, subname);
- if (access(path, R_OK) == 0)
- return 0;
-
- snprintf(path, path_len, "%s/%s.%s.so",
- HAL_LIBRARY_PATH1, name, subname);
+ char *base = getenv("HAL_LIBRARY_PATH");
rjkroege 2014/04/25 21:28:07 you could be less intrusive and preserve more of t
+ if (!base)
+ base = DEFAULT_HAL_LIBRARY_PATH;
+ snprintf(path, path_len, "%s/%s.%s.so", base, name, subname);
if (access(path, R_OK) == 0)
return 0;

Powered by Google App Engine
This is Rietveld 408576698