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; |