summaryrefslogtreecommitdiffstats
path: root/hardware.c
diff options
context:
space:
mode:
authorBrian Swetland <swetland@google.com>2010-09-19 03:41:01 -0700
committerBrian Swetland <swetland@google.com>2010-09-19 03:41:01 -0700
commite755bd4038cab69f98f7cf17e41f493296ec62ab (patch)
treed9b3e39bd1a4269e28e940c10585ed8073a0cd0e /hardware.c
parentc04e5f68905127ae4c1a0c17d225db9cebe66a07 (diff)
downloadhardware_libhardware-e755bd4038cab69f98f7cf17e41f493296ec62ab.tar.gz
hardware_libhardware-e755bd4038cab69f98f7cf17e41f493296ec62ab.tar.bz2
hardware_libhardware-e755bd4038cab69f98f7cf17e41f493296ec62ab.zip
add /vendor support
Search /vendor/lib/hw/... as well as /system/lib/hw/... for hal modules. Change-Id: I1aecafcc884e11b2f17edf28e8c8ca2926184807
Diffstat (limited to 'hardware.c')
-rw-r--r--hardware.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/hardware.c b/hardware.c
index 3a23b1f..d2e3b4c 100644
--- a/hardware.c
+++ b/hardware.c
@@ -28,7 +28,8 @@
#include <utils/Log.h>
/** Base path of the hal modules */
-#define HAL_LIBRARY_PATH "/system/lib/hw"
+#define HAL_LIBRARY_PATH1 "/system/lib/hw"
+#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"
/**
* There are a set of variant filename for modules. The form of the filename
@@ -138,16 +139,17 @@ int hw_get_module(const char *id, const struct hw_module_t **module)
continue;
}
snprintf(path, sizeof(path), "%s/%s.%s.so",
- HAL_LIBRARY_PATH, id, prop);
+ HAL_LIBRARY_PATH1, id, prop);
+ if (access(path, R_OK) == 0) break;
+
+ snprintf(path, sizeof(path), "%s/%s.%s.so",
+ HAL_LIBRARY_PATH2, id, prop);
+ if (access(path, R_OK) == 0) break;
} else {
snprintf(path, sizeof(path), "%s/%s.default.so",
- HAL_LIBRARY_PATH, id);
- }
- if (access(path, R_OK)) {
- continue;
+ HAL_LIBRARY_PATH1, id);
+ if (access(path, R_OK) == 0) break;
}
- /* we found a library matching this id/variant */
- break;
}
status = -ENOENT;