forked from enlightenment/evisum
machine: ahead of the game...
Meh, we can't yet query by type.
This commit is contained in:
parent
d1d4d0fb9e
commit
aa1822c212
|
@ -118,8 +118,6 @@ _power_battery_count_get(power_t *power)
|
||||||
{
|
{
|
||||||
#if defined(__OpenBSD__)
|
#if defined(__OpenBSD__)
|
||||||
struct sensordev snsrdev;
|
struct sensordev snsrdev;
|
||||||
struct sensor snsr;
|
|
||||||
size_t slen = sizeof(struct sensor);
|
|
||||||
size_t sdlen = sizeof(struct sensordev);
|
size_t sdlen = sizeof(struct sensordev);
|
||||||
int mibs[5] = { CTL_HW, HW_SENSORS, 0, 0, 0 };
|
int mibs[5] = { CTL_HW, HW_SENSORS, 0, 0, 0 };
|
||||||
int i, devn;
|
int i, devn;
|
||||||
|
@ -134,20 +132,7 @@ _power_battery_count_get(power_t *power)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int n = 0; n < snsrdev.maxnumt[SENSOR_WATTHOUR]; n++) {
|
if (!strncmp(snsrdev.xname, "acpibat", 7))
|
||||||
mibs[4] = n;
|
|
||||||
|
|
||||||
if (sysctl(mibs, 5, &snsr, &slen, NULL, 0) == -1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (slen > 0 && (snsr.flags & SENSOR_FINVALID) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sysctl(mibs, 5, &snsr, &slen, NULL, 0) == -1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((snsr.type == SENSOR_AMPHOUR) || (snsr.type == SENSOR_WATTHOUR))
|
|
||||||
{
|
{
|
||||||
i = power->battery_count;
|
i = power->battery_count;
|
||||||
power->batteries = realloc(power->batteries, 1 +
|
power->batteries = realloc(power->batteries, 1 +
|
||||||
|
@ -162,7 +147,6 @@ _power_battery_count_get(power_t *power)
|
||||||
tmp[1] = mibs[1];
|
tmp[1] = mibs[1];
|
||||||
tmp[2] = mibs[2];
|
tmp[2] = mibs[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp("acpiac0", snsrdev.xname))
|
if (!strcmp("acpiac0", snsrdev.xname))
|
||||||
{
|
{
|
||||||
power->ac_mibs[0] = mibs[0];
|
power->ac_mibs[0] = mibs[0];
|
||||||
|
|
Loading…
Reference in New Issue