system/core
Revision | a2b55eb266b1af89df8da0d35d3c5fc849ddd337 (tree) |
---|---|
Zeit | 2010-02-27 16:12:49 |
Autor | Yi Sun <beyounn@gmai...> |
Commiter | Chih-Wei Huang |
change vold to auto detect power uevent tag name
@@ -282,19 +282,31 @@ static char *get_uevent_param(struct uevent *event, char *param_name) | ||
282 | 282 | static int handle_powersupply_event(struct uevent *event) |
283 | 283 | { |
284 | 284 | char *ps_type = get_uevent_param(event, "POWER_SUPPLY_TYPE"); |
285 | - char name[PROPERTY_VALUE_MAX]; | |
286 | - int nlen ; | |
285 | + char *cap_buf; | |
287 | 286 | double ps_cap; |
288 | 287 | double ps_cap_full = 0; |
289 | 288 | double cap; |
290 | 289 | int capacity; |
291 | 290 | |
292 | 291 | if (!strcasecmp(ps_type, "battery")) { |
293 | - property_get(POWER_UEVENT_NAME_CHARGE_NOW,name, "POWER_SUPPLY_CAPACITY"); | |
294 | - ps_cap = atof(get_uevent_param(event, name)); | |
295 | - nlen = property_get(POWER_UEVENT_NAME_CHARGE_FULL, name, NULL); | |
296 | - if (nlen > 0) | |
297 | - ps_cap_full = atof(get_uevent_param(event, name)); | |
292 | + cap_buf = get_uevent_param(event,"POWER_SUPPLY_CHARGE_NOW"); | |
293 | + if (!cap_buf) { | |
294 | + cap_buf = get_uevent_param(event,"POWER_SUPPLY_ENERGY_NOW"); | |
295 | + if (!cap_buf) { | |
296 | + LOGE("Unsupport power supply energy now uevent found"); | |
297 | + return 0; | |
298 | + } | |
299 | + } | |
300 | + ps_cap = atof(cap_buf); | |
301 | + cap_buf = get_uevent_param(event,"POWER_SUPPLY_CHARGE_FULL"); | |
302 | + if (!cap_buf) { | |
303 | + cap_buf = get_uevent_param(event,"POWER_SUPPLY_ENERGY_FULL"); | |
304 | + if (!cap_buf) { | |
305 | + LOGE("Unsupport power supply energy full uevent found"); | |
306 | + return 0; | |
307 | + } | |
308 | + } | |
309 | + ps_cap_full = atof(cap_buf); | |
298 | 310 | if (ps_cap_full) { |
299 | 311 | cap = (ps_cap/ps_cap_full)*100; |
300 | 312 | capacity = (int)cap; |