https://git.reactos.org/?p=reactos.git;a=commitdiff;h=30ac80f36b927dfa35007…
commit 30ac80f36b927dfa35007268ad72ce9a46201fda
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Wed Feb 14 22:25:44 2024 +0100
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Mon Aug 12 11:56:18 2024 +0200
[CMBATT] Implement CmBattVerifyStaticInfo
---
drivers/bus/acpi/cmbatt/cmbatt.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/acpi/cmbatt/cmbatt.c b/drivers/bus/acpi/cmbatt/cmbatt.c
index f0e7b04a39e..09d9c81d837 100644
--- a/drivers/bus/acpi/cmbatt/cmbatt.c
+++ b/drivers/bus/acpi/cmbatt/cmbatt.c
@@ -278,8 +278,38 @@ NTAPI
CmBattVerifyStaticInfo(PCMBATT_DEVICE_EXTENSION DeviceExtension,
ULONG BatteryTag)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ ACPI_BIF_DATA BifData;
+ PBATTERY_INFORMATION Info = &DeviceExtension->BatteryInformation;
+ NTSTATUS Status;
+
+ Status = CmBattGetBifData(DeviceExtension, &BifData);
+ if (NT_SUCCESS(Status))
+ {
+ RtlZeroMemory(Info, sizeof(*Info));
+ Info->Capabilities = BATTERY_SYSTEM_BATTERY;
+ Info->Technology = BifData.BatteryTechnology;
+ RtlCopyMemory(Info->Chemistry, BifData.BatteryType, 4);
+ // FIXME: take from _BIX method: Info->CycleCount
+ DeviceExtension->BifData = BifData;
+
+ if (BifData.PowerUnit == 1)
+ {
+ DPRINT1("FIXME: need to convert mAh into mWh\n");
+ Info->DesignedCapacity = BATTERY_UNKNOWN_CAPACITY;
+ Info->FullChargedCapacity = BATTERY_UNKNOWN_CAPACITY;
+ Info->DefaultAlert1 = BATTERY_UNKNOWN_CAPACITY;
+ Info->DefaultAlert2 = BATTERY_UNKNOWN_CAPACITY;
+ }
+ else
+ {
+ Info->DesignedCapacity = BifData.DesignCapacity;
+ Info->FullChargedCapacity = BifData.LastFullCapacity;
+ Info->DefaultAlert1 = BifData.DesignCapacityLow;
+ Info->DefaultAlert2 = BifData.DesignCapacityWarning;
+ }
+ }
+
+ return Status;
}
NTSTATUS