- client (FreeBSD): detect running on batteries; from rustyBSD

This commit is contained in:
David Anderson 2013-03-02 13:15:05 -08:00 committed by Oliver Bock
parent 2e23bfedaa
commit e41800082e
1 changed files with 13 additions and 0 deletions

View File

@ -428,6 +428,19 @@ bool HOST_INFO::host_is_running_on_batteries() {
return true;
}
return false;
#elif defined(__FreeBSD__)
int ac;
size_t len = sizeof(ac);
if (sysctlbyname("hw.acpi.acline", &ac, &len, NULL, 0) != -1) {
if (ac)
// AC present
return false;
else
return true;
}
return false;
#else
return false;