Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
e4648846
Commit
e4648846
authored
Feb 11, 2016
by
Hisham
Browse files
Merge branch 'master' of
https://github.com/hishamhm/htop
parents
563d5d3a
b6f927bf
Changes
1
Show whitespace changes
Inline
Side-by-side
freebsd/Battery.c
View file @
e4648846
...
...
@@ -6,10 +6,20 @@ in the source distribution for its full text.
*/
#include "BatteryMeter.h"
#include <sys/sysctl.h>
void
Battery_getData
(
double
*
level
,
ACPresence
*
isOnAC
)
{
// TODO
int
life
;
size_t
life_len
=
sizeof
(
life
);
if
(
sysctlbyname
(
"hw.acpi.battery.life"
,
&
life
,
&
life_len
,
NULL
,
0
)
==
-
1
)
*
level
=
-
1
;
else
*
level
=
life
;
int
acline
;
size_t
acline_len
=
sizeof
(
acline
);
if
(
sysctlbyname
(
"hw.acpi.acline"
,
&
acline
,
&
acline_len
,
NULL
,
0
)
==
-
1
)
*
isOnAC
=
AC_ERROR
;
else
*
isOnAC
=
acline
==
0
?
AC_ABSENT
:
AC_PRESENT
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment