NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/46415: sensor_battery gets unsupported power events



>Number:         46415
>Category:       kern
>Synopsis:       sensor_battery gets unsupported power events
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 05 07:35:00 +0000 2012
>Originator:     Michael van Elst
>Release:        NetBSD 6.99.6
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."
>Environment:
        
        
System: NetBSD tazz 6.99.6 NetBSD 6.99.6 (TAZZ) #0: Sat May 5 02:17:23 CEST 2012
 mlelstv@henery:/home/netbsd-current/obj.amd64/home/netbsd-current/src/sys/arch/
amd64/compile/TAZZ amd64
Architecture: x86_64
Machine: amd64
>Description:
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.


>How-To-Repeat:
Use a system with the acpibat driver that generates battery charging
events and watch the sensor_battery script fail.

>Fix:
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.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index