acpi_battery: accept revision 1 struct with only 20 items
The revision 1 structure should have 21 items, but on my laptop, it doesn't. That's fine, we can parse it as if it was a revision 0 structure. This way I can see the battery status on my machine. Change-Id: I743173e05318d686049454983e378a08c0a1980a Reviewed-on: https://review.haiku-os.org/c/haiku/+/5155 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
7f5e1044ee
commit
fa288877c5
@ -167,17 +167,12 @@ ReadBatteryInfo(battery_driver_cookie* cookie,
|
||||
batteryInfo->revision = GetUint32(pointer++);
|
||||
TRACE("ReadBatteryInfo revision %u\n", batteryInfo->revision);
|
||||
|
||||
if (batteryInfo->revision == ACPI_BATTERY_REVISION_0) {
|
||||
if (object->package.count < 20) {
|
||||
status = B_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
} else if (object->package.count < 21) {
|
||||
if (object->package.count < 20) {
|
||||
status = B_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
batteryInfo->power_unit = GetUint32(pointer++);
|
||||
batteryInfo->design_capacity = GetUint32(pointer++);
|
||||
batteryInfo->last_full_charge = GetUint32(pointer++);
|
||||
@ -205,7 +200,8 @@ ReadBatteryInfo(battery_driver_cookie* cookie,
|
||||
GetString(batteryInfo->oem_info, sizeof(batteryInfo->oem_info), pointer++);
|
||||
|
||||
if (batteryInfo->revision != ACPI_BATTERY_REVISION_BIF
|
||||
&& batteryInfo->revision >= ACPI_BATTERY_REVISION_1) {
|
||||
&& batteryInfo->revision >= ACPI_BATTERY_REVISION_1
|
||||
&& object->package.count > 20) {
|
||||
batteryInfo->swapping_capability = GetUint32(pointer++);
|
||||
}
|
||||
exit:
|
||||
|
Loading…
Reference in New Issue
Block a user