From: Enlightenment C. <no...@cv...> - 2008-08-07 23:37:16
|
Enlightenment CVS committal Author : raster Project : e17 Module : apps/e Dir : e17/apps/e/src/modules/battery Modified Files: batget.c Log Message: handle other states for "state" - not charging is an... interesting one... (as a replacement for discharging) =================================================================== RCS file: /cvs/e/e17/apps/e/src/modules/battery/batget.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- batget.c 19 Jun 2008 12:18:59 -0000 1.13 +++ batget.c 7 Aug 2008 23:37:14 -0000 1.14 @@ -712,6 +712,8 @@ { full = 0; if (!strncasecmp("discharging", tmp, 11)) charging = 0; + else if (!strncasecmp("unknown", tmp, 7)) charging = 0; + else if (!strncasecmp("not charging", tmp, 12)) charging = 0; else if (!strncasecmp("charging", tmp, 8)) charging = 1; else if (!strncasecmp("full", tmp, 4)) { @@ -1058,7 +1060,7 @@ tmp = str_get(buf); if (tmp) { - if (!strcmp(tmp, "yes")) have_battery = 1; + if (!strcasecmp(tmp, "yes")) have_battery = 1; free(tmp); } /* capacity state: ok/? */ @@ -1070,7 +1072,7 @@ { if (have_power == 0) { - if (!strcmp(tmp, "charging")) have_power = 1; + if (!strcasecmp(tmp, "charging")) have_power = 1; } free(tmp); } @@ -1079,7 +1081,7 @@ tmp = str_get(buf); if (tmp) { - if (strcmp(tmp, "unknown")) rate += atoi(tmp); + if (strcasecmp(tmp, "unknown")) rate += atoi(tmp); free(tmp); } /* remaining capacity: NNN */ @@ -1087,7 +1089,7 @@ tmp = str_get(buf); if (tmp) { - if (strcmp(tmp, "unknown")) capacity += atoi(tmp); + if (strcasecmp(tmp, "unknown")) capacity += atoi(tmp); free(tmp); } fclose(f); |