From e41800082e2731959dd58b1cf06fd2ed46a5a017 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 2 Mar 2013 13:15:05 -0800 Subject: [PATCH] - client (FreeBSD): detect running on batteries; from rustyBSD --- client/hostinfo_unix.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp index c465456e24..5777d9dff1 100644 --- a/client/hostinfo_unix.cpp +++ b/client/hostinfo_unix.cpp @@ -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;