X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=hardware.c;h=5394787e7c427042b2f47fd2beae2c3e3e11fe55;hb=d6aebac3ab0b2cddc4a3751986b69f8e48b68556;hp=f835fdacc51fe16b83381a7a49953e33cdc6377c;hpb=a97c6fecdbe576b732a2ca00fbf4dcb82f079c8f;p=android-x86%2Fhardware-libhardware.git diff --git a/hardware.c b/hardware.c index f835fda..5394787 100644 --- a/hardware.c +++ b/hardware.c @@ -28,8 +28,15 @@ #include /** Base path of the hal modules */ +#if defined(__LP64__) +#define HAL_LIBRARY_PATH1 "/system/lib64/hw" +#define HAL_LIBRARY_PATH2 "/vendor/lib64/hw" +#define HAL_LIBRARY_PATH3 "/odm/lib64/hw" +#else #define HAL_LIBRARY_PATH1 "/system/lib/hw" #define HAL_LIBRARY_PATH2 "/vendor/lib/hw" +#define HAL_LIBRARY_PATH3 "/odm/lib/hw" +#endif /** * There are a set of variant filename for modules. The form of the filename @@ -62,9 +69,9 @@ static int load(const char *id, const char *path, const struct hw_module_t **pHmi) { - int status; - void *handle; - struct hw_module_t *hmi; + int status = -EINVAL; + void *handle = NULL; + struct hw_module_t *hmi = NULL; /* * load the symbols resolving undefined symbols before @@ -125,6 +132,11 @@ 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_PATH3, 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) return 0; @@ -140,11 +152,12 @@ static int hw_module_exists(char *path, size_t path_len, const char *name, int hw_get_module_by_class(const char *class_id, const char *inst, const struct hw_module_t **module) { - int i; - char prop[PATH_MAX]; - char path[PATH_MAX]; - char name[PATH_MAX]; - char prop_name[PATH_MAX]; + int i = 0; + char prop[PATH_MAX] = {0}; + char path[PATH_MAX] = {0}; + char name[PATH_MAX] = {0}; + char prop_name[PATH_MAX] = {0}; + if (inst) snprintf(name, PATH_MAX, "%s.%s", class_id, inst);