Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jul 2020 15:50:44 +0200
From:      Georg Lindenberg <georg.lindenberg@web.de>
To:        freebsd-acpi@freebsd.org
Subject:   Add _BTP (battery trip point) acpi method to cmbat batteries
Message-ID:  <trinity-5c18cd5e-854d-4913-bd82-00f056bd6c39-1595598644650@3c-app-webde-bs60>

index | next in thread | raw e-mail

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!


help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?trinity-5c18cd5e-854d-4913-bd82-00f056bd6c39-1595598644650>