• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Revisiona2b55eb266b1af89df8da0d35d3c5fc849ddd337 (tree)
Zeit2010-02-27 16:12:49
AutorYi Sun <beyounn@gmai...>
CommiterChih-Wei Huang

Log Message

change vold to auto detect power uevent tag name

Ändern Zusammenfassung

Diff

--- a/vold/uevent.c
+++ b/vold/uevent.c
@@ -282,19 +282,31 @@ static char *get_uevent_param(struct uevent *event, char *param_name)
282282 static int handle_powersupply_event(struct uevent *event)
283283 {
284284 char *ps_type = get_uevent_param(event, "POWER_SUPPLY_TYPE");
285- char name[PROPERTY_VALUE_MAX];
286- int nlen ;
285+ char *cap_buf;
287286 double ps_cap;
288287 double ps_cap_full = 0;
289288 double cap;
290289 int capacity;
291290
292291 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);
298310 if (ps_cap_full) {
299311 cap = (ps_cap/ps_cap_full)*100;
300312 capacity = (int)cap;