Subject: Re: CVS commit: src
To: None <xtraeme@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: source-changes
Date: 10/11/2007 08:53:12
can't these be done more generally?  ac adapter sounds too specific to me.

eg. having a POWERSUPPLY class which represents anything which
supplies power.  each POWERSUPPLY has its own capacity.  an ac adapter can be
a POWERSUPPLY with infinite capacity.  powerd or kernel "sum up"
all POWERSUPPLY in a system and, if necessary, generate a low-power event.

YAMAMOTO Takashi

> Module Name:	src
> Committed By:	xtraeme
> Date:		Wed Oct 10 23:25:40 UTC 2007
> 
> Modified Files:
> 	src/etc/powerd/scripts: sensor_battery
> 	src/share/man/man9: sysmon_envsys.9
> 	src/sys/dev/acpi: acpi_acad.c acpi_bat.c
> 	src/sys/dev/sysmon: sysmon_envsys_events.c sysmon_power.c sysmonvar.h
> 	src/sys/sys: power.h
> 
> Log Message:
> Fix the problems described in:
> http://mail-index.netbsd.org/current-users/2007/07/16/0012.html
> 
> - Introduce sme_class into the sysmon_envsys struct to specify a
>   class; currently there are two classes: SME_CLASS_ACADAPTER and
>   SME_CLASS_BATTERY.
> 
> - Add a new envsys event: PENVSYS_EVENT_LOW_POWER that is reached when
>   all SME_CLASS_BATTERY devices are in CRITICAL/LOW state and there's not
>   any SME_CLASS_ACADAPTER connected.
> 
> - Add the 'low-power' event into the sensor_battery script that will
>   shutdown the system gracefully via 'shutdown -p'. If powerd(8) is
>   not running, cpu_reboot(9) with RB_POWERDOWN is used.
> 
> - Make acpiacad(4) a SME_CLASS_ACADAPTER device and acpibat(4) a
>   SME_CLASS_BATTERY device.
> 
> Update the documentation accordingly to these changes.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -r1.3 -r1.4 src/etc/powerd/scripts/sensor_battery
> cvs rdiff -r1.9 -r1.10 src/share/man/man9/sysmon_envsys.9
> cvs rdiff -r1.25 -r1.26 src/sys/dev/acpi/acpi_acad.c
> cvs rdiff -r1.56 -r1.57 src/sys/dev/acpi/acpi_bat.c
> cvs rdiff -r1.37 -r1.38 src/sys/dev/sysmon/sysmon_envsys_events.c
> cvs rdiff -r1.28 -r1.29 src/sys/dev/sysmon/sysmon_power.c
> cvs rdiff -r1.18 -r1.19 src/sys/dev/sysmon/sysmonvar.h
> cvs rdiff -r1.8 -r1.9 src/sys/sys/power.h
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.