[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/46415: sensor_battery gets unsupported power events
>Synopsis: sensor_battery gets unsupported power events
>Arrival-Date: Sat May 05 07:35:00 +0000 2012
>Originator: Michael van Elst
>Release: NetBSD 6.99.6
Michael van Elst
"A potential Snark may lurk in every tree."
System: NetBSD tazz 6.99.6 NetBSD 6.99.6 (TAZZ) #0: Sat May 5 02:17:23 CEST 2012
When the laptop battery reaches a warning level, an event is passed to
powerd which runs the sensor_battery script, but which fails.
May 5 07:52:54 tazz root: /etc/powerd/scripts/sensor_battery: unsupported
event warning-under on device acpibat0
warning-under is not a specified event for the battery sensor.
acpibat0 has two sensors: ACPIBAT_CAPACITY and ACPIBAT_CHARGING_STATE.
When the capacity falls below a warning threshold,
- ACPIBAT_CAPACITY changes state to ENVSYS_SWARNUNDER and
- ACPIBAT_CHARGE_STATE is set to the value ENVSYS_BATTERY_CAPACITY_WARNING.
Events are finally delivered to powerd with sme_deliver_event().
For a capacity event it tries to translate the sensor state
(ENVSYS_S*) into a sysmon event (PENVSYS_EVENT_*). The ENVSYS_SWARNUNDER
state corresponds to PENVSYS_EVENT_WARNUNDER which is delivered
by powerd as "warning-under" to the script.
For some reason the translation table also contains battery sensor
_values_ that never appear as state but that are translated into
battery events (PENVSYS_EVENT_BATT_*). Apparently there was a
mixup between sensor state and value.
Use a system with the acpibat driver that generates battery charging
events and watch the sensor_battery script fail.
The sensors do not know about capacity-based limits. If sysmon
wants to differentiate between value-based limits and capacity-based
limits, there needs to be a translation of the sensor state according
to the sensor type.
As an alternative you could just drop the special capacity events and use
the generic events instead. This mainly requires a correction in the
sensor_battery script and the documentation.
Main Index |
Thread Index |