summaryrefslogtreecommitdiffstats
path: root/hardware.c
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-09-24 15:11:04 -0700
committerMathias Agopian <mathias@google.com>2009-09-24 15:11:04 -0700
commitcab816fb6d98c23a8958a5df0006d227b14d1146 (patch)
tree261512f375799303aeac33a8587e7fc79aae4ab8 /hardware.c
parent3f03e98dbf1b402334c804a3558b6d4f6042048c (diff)
downloadhardware_libhardware-cab816fb6d98c23a8958a5df0006d227b14d1146.tar.gz
hardware_libhardware-cab816fb6d98c23a8958a5df0006d227b14d1146.tar.bz2
hardware_libhardware-cab816fb6d98c23a8958a5df0006d227b14d1146.zip
fix a bug I introduced recently where the "default" HAL module would not be loaded.
Diffstat (limited to 'hardware.c')
-rw-r--r--hardware.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hardware.c b/hardware.c
index 9fd007d..0415448 100644
--- a/hardware.c
+++ b/hardware.c
@@ -46,8 +46,7 @@ static const char *variant_keys[] = {
file on the emulator. */
"ro.product.board",
"ro.board.platform",
- "ro.arch",
- "default"
+ "ro.arch"
};
static const int HAL_VARIANT_KEYS_COUNT =
@@ -133,11 +132,17 @@ int hw_get_module(const char *id, const struct hw_module_t **module)
*/
/* Loop through the configuration variants looking for a module */
- for (i=0 ; i<HAL_VARIANT_KEYS_COUNT ; i++) {
- if (property_get(variant_keys[i], prop, NULL) == 0) {
- continue;
+ for (i=0 ; i<HAL_VARIANT_KEYS_COUNT+1 ; i++) {
+ if (i < HAL_VARIANT_KEYS_COUNT) {
+ if (property_get(variant_keys[i], prop, NULL) == 0) {
+ continue;
+ }
+ snprintf(path, sizeof(path), "%s/%s.%s.so",
+ HAL_LIBRARY_PATH, id, prop);
+ } else {
+ snprintf(path, sizeof(path), "%s/%s.default.so",
+ HAL_LIBRARY_PATH, id);
}
- snprintf(path, sizeof(path), "%s/%s.%s.so", HAL_LIBRARY_PATH, id, prop);
if (access(path, R_OK)) {
continue;
}