Add _BTP (battery trip point) acpi method to cmbat batteries
Georg Lindenberg
georg.lindenberg at web.de
Fri Jul 24 13:50:48 UTC 2020
Hey,
I want to get devd notifications when my laptop battery reaches a certain battery level.
This is done with the optional _BTP acpi method.
It's almost trivial. It is a write-only method. You call:
ACPI_STATUS as = acpi_SetInteger(h, "_BTP", new_trip_point);
But I wonder:
1. Is there a proper way to check whether an acpi method exists? Linux source code
has a function acpi_has_method(battery->device->handle, "_BTP").
Is there an equivalent in FreeBSD?
Or would this be viable?
ACPI_STATUS as = acpi_SetInteger(h, "_BTP", new_trip_point);
if( as == AE_NOT_FOUND )
/* _BTP not implemented */
else if (ACPI_FAILURE(as) )
/* some other error */
else
/* we have _BTP */
2. Is dev.battery.0.btp the right place to implement a sysctl? It doesn't make much
sense to send it through the abstraction layer (hw.acpi.battery), because only control method batteries
support this feature.
Thanks for helping me!
More information about the freebsd-acpi
mailing list