Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
36af18a4
Commit
36af18a4
authored
Dec 04, 2021
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Dec 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement fill_battery_state() on FreeBSD.
Signed-off-by:
Damjan Jovanovic
<
damjan.jov@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9b8d043c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
system.c
dlls/ntdll/unix/system.c
+45
-0
No files found.
dlls/ntdll/unix/system.c
View file @
36af18a4
...
...
@@ -3516,6 +3516,51 @@ static NTSTATUS fill_battery_state( SYSTEM_BATTERY_STATE *bs )
return
STATUS_SUCCESS
;
}
#elif defined(__FreeBSD__)
#include <dev/acpica/acpiio.h>
static
NTSTATUS
fill_battery_state
(
SYSTEM_BATTERY_STATE
*
bs
)
{
size_t
len
;
int
state
=
0
;
int
rate_mW
=
0
;
int
time_mins
=
-
1
;
int
life_percent
=
0
;
bs
->
BatteryPresent
=
TRUE
;
len
=
sizeof
(
state
);
bs
->
BatteryPresent
&=
!
sysctlbyname
(
"hw.acpi.battery.state"
,
&
state
,
&
len
,
NULL
,
0
);
len
=
sizeof
(
rate_mW
);
bs
->
BatteryPresent
&=
!
sysctlbyname
(
"hw.acpi.battery.rate"
,
&
rate_mW
,
&
len
,
NULL
,
0
);
len
=
sizeof
(
time_mins
);
bs
->
BatteryPresent
&=
!
sysctlbyname
(
"hw.acpi.battery.time"
,
&
time_mins
,
&
len
,
NULL
,
0
);
len
=
sizeof
(
life_percent
);
bs
->
BatteryPresent
&=
!
sysctlbyname
(
"hw.acpi.battery.life"
,
&
life_percent
,
&
len
,
NULL
,
0
);
if
(
bs
->
BatteryPresent
)
{
bs
->
AcOnLine
=
(
time_mins
==
-
1
);
bs
->
Charging
=
state
&
ACPI_BATT_STAT_CHARGING
;
bs
->
Discharging
=
state
&
ACPI_BATT_STAT_DISCHARG
;
bs
->
Rate
=
(
rate_mW
>=
0
?
-
rate_mW
:
0
);
if
(
time_mins
>=
0
&&
life_percent
>
0
)
{
bs
->
EstimatedTime
=
60
*
time_mins
;
bs
->
RemainingCapacity
=
bs
->
EstimatedTime
*
rate_mW
/
3600
;
bs
->
MaxCapacity
=
bs
->
RemainingCapacity
*
100
/
life_percent
;
}
else
{
bs
->
EstimatedTime
=
~
0u
;
bs
->
RemainingCapacity
=
life_percent
;
bs
->
MaxCapacity
=
100
;
}
}
return
STATUS_SUCCESS
;
}
#else
static
NTSTATUS
fill_battery_state
(
SYSTEM_BATTERY_STATE
*
bs
)
...
...
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