sensors: Fallback fix
This commit is contained in:
parent
93afb7f45d
commit
2ee73c7fad
|
@ -453,9 +453,8 @@ _battery_state_get(power_t *power)
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
if (!naming)
|
if (naming)
|
||||||
continue;
|
{
|
||||||
|
|
||||||
snprintf(path, sizeof(path), "%s/%s_full", link, naming);
|
snprintf(path, sizeof(path), "%s/%s_full", link, naming);
|
||||||
buf = file_contents(path);
|
buf = file_contents(path);
|
||||||
if (buf)
|
if (buf)
|
||||||
|
@ -470,6 +469,8 @@ _battery_state_get(power_t *power)
|
||||||
power->batteries[i]->charge_current = atol(buf);
|
power->batteries[i]->charge_current = atol(buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
free(naming);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fallback to "coarse" representation.
|
// Fallback to "coarse" representation.
|
||||||
|
@ -488,11 +489,9 @@ _battery_state_get(power_t *power)
|
||||||
power->batteries[i]->charge_current = 25;
|
power->batteries[i]->charge_current = 25;
|
||||||
else if (buf[0] == 'C')
|
else if (buf[0] == 'C')
|
||||||
power->batteries[i]->charge_current = 5;
|
power->batteries[i]->charge_current = 5;
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(naming);
|
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if (link) free(link);
|
if (link) free(link);
|
||||||
|
|
Loading…
Reference in New Issue