aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd/Battery.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-08-27 07:48:10 +0200
committerDaniel Lange <DLange@git.local>2020-08-27 07:48:10 +0200
commitf3147ea2d1598914c2db53e8cfb34c8ff81e2ff4 (patch)
tree3ee82b2af2ab3d38b6e4b07f3994516aac72f742 /openbsd/Battery.c
parentdf568a576f7b44ac5a2b9b7222c7f39d9932f626 (diff)
downloaddebian_htop-f3147ea2d1598914c2db53e8cfb34c8ff81e2ff4.tar.gz
debian_htop-f3147ea2d1598914c2db53e8cfb34c8ff81e2ff4.tar.bz2
debian_htop-f3147ea2d1598914c2db53e8cfb34c8ff81e2ff4.zip
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'openbsd/Battery.c')
-rw-r--r--openbsd/Battery.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/openbsd/Battery.c b/openbsd/Battery.c
index 3a0bae1..c215e41 100644
--- a/openbsd/Battery.c
+++ b/openbsd/Battery.c
@@ -10,6 +10,7 @@ in the source distribution for its full text.
#include <sys/sysctl.h>
#include <sys/sensors.h>
#include <errno.h>
+#include <string.h>
static bool findDevice(const char* name, int* mib, struct sensordev* snsrdev, size_t* sdlen) {
for (int devn = 0;; devn++) {
@@ -34,7 +35,7 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
size_t sdlen = sizeof(struct sensordev);
bool found = findDevice("acpibat0", mib, &snsrdev, &sdlen);
-
+
*level = -1;
if (found) {
/* last full capacity */
@@ -57,9 +58,9 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
}
}
}
-
+
found = findDevice("acpiac0", mib, &snsrdev, &sdlen);
-
+
*isOnAC = AC_ERROR;
if (found) {
mib[3] = 9;

© 2014-2024 Faster IT GmbH | imprint | privacy policy