mirror of https://github.com/BOINC/boinc.git
- client (FreeBSD): detect running on batteries; from rustyBSD
This commit is contained in:
parent
2e23bfedaa
commit
e41800082e
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue