machine: ahead of the game...

Meh, we can't yet query by type.
This commit is contained in:
Alastair Poole 2020-07-11 18:48:13 +01:00
parent d1d4d0fb9e
commit aa1822c212
1 changed files with 1 additions and 17 deletions

View File

@ -118,8 +118,6 @@ _power_battery_count_get(power_t *power)
{
#if defined(__OpenBSD__)
struct sensordev snsrdev;
struct sensor snsr;
size_t slen = sizeof(struct sensor);
size_t sdlen = sizeof(struct sensordev);
int mibs[5] = { CTL_HW, HW_SENSORS, 0, 0, 0 };
int i, devn;
@ -134,20 +132,7 @@ _power_battery_count_get(power_t *power)
break;
}
for (int n = 0; n < snsrdev.maxnumt[SENSOR_WATTHOUR]; n++) {
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))
if (!strncmp(snsrdev.xname, "acpibat", 7))
{
i = power->battery_count;
power->batteries = realloc(power->batteries, 1 +
@ -162,7 +147,6 @@ _power_battery_count_get(power_t *power)
tmp[1] = mibs[1];
tmp[2] = mibs[2];
}
if (!strcmp("acpiac0", snsrdev.xname))
{
power->ac_mibs[0] = mibs[0];