Add support for none ACPI battery method batteries

Remove the requirement that a device be a ACPI method battery to be supported
as a battery.

Require now that the device be in the battery devclass and implement the
get_status and get_info functions. This allows batteries which are not ACPI
method batteries to be supported.

Reviewed by: jtl
Approved by: jtl (mentor)
MFC after: 1 Month
Differential Revision:	https://reviews.freebsd.org/D17434
This commit is contained in:
Tom Jones 2018-11-23 12:03:01 +00:00
parent ae346558f1
commit 831f467904

View File

@ -169,14 +169,11 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_battinfo *battinfo)
dev_idx = i;
/*
* Be sure we can get various info from the battery. Note that
* acpi_BatteryIsPresent() is not enough because smart batteries only
* return that the device is present.
* Be sure we can get various info from the battery.
*/
if (!acpi_BatteryIsPresent(batt_dev) ||
ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
continue;
if (ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
continue;
/* If a battery is not installed, we sometimes get strange values. */
if (!acpi_battery_bst_valid(&bst[i]) ||