hardware/libhardware
Revision | fca06e3a651fc707d58af62d2a287bccf17fa005 (tree) |
---|---|
Time | 2013-12-09 23:47:41 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
libhardware: search hals by hal.* properties
The patch allows us to control which hals to be loaded more flexible.
It's the key point to make a generic image to support more devices.
@@ -140,10 +140,17 @@ int hw_get_module_by_class(const char *class_id, const char *inst, | ||
140 | 140 | */ |
141 | 141 | |
142 | 142 | /* Loop through the configuration variants looking for a module */ |
143 | - for (i=0 ; i<HAL_VARIANT_KEYS_COUNT+1 ; i++) { | |
143 | + for (i=-1 ; i<HAL_VARIANT_KEYS_COUNT+1 ; i++) { | |
144 | 144 | if (i < HAL_VARIANT_KEYS_COUNT) { |
145 | - if (property_get(variant_keys[i], prop, NULL) == 0) { | |
146 | - continue; | |
145 | + if (i < 0) { | |
146 | + snprintf(path, sizeof(path), "hal.%s", name); | |
147 | + if (property_get(path, prop, NULL) == 0) { | |
148 | + continue; | |
149 | + } | |
150 | + } else { | |
151 | + if (property_get(variant_keys[i], prop, NULL) == 0) { | |
152 | + continue; | |
153 | + } | |
147 | 154 | } |
148 | 155 | snprintf(path, sizeof(path), "%s/%s.%s.so", |
149 | 156 | HAL_LIBRARY_PATH2, name, prop); |