{
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))
{
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/? */
{
if (have_power == 0)
{
- if (!strcmp(tmp, "charging")) have_power = 1;
+ if (!strcasecmp(tmp, "charging")) have_power = 1;
}
free(tmp);
}
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 */
tmp = str_get(buf);
if (tmp)
{
- if (strcmp(tmp, "unknown")) capacity += atoi(tmp);
+ if (strcasecmp(tmp, "unknown")) capacity += atoi(tmp);
free(tmp);
}
fclose(f);