[BACK]Return to sysmon_pswitch.9 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man9

File: [cvs.NetBSD.org] / src / share / man / man9 / sysmon_pswitch.9 (download)

Revision 1.3, Fri Jan 29 11:24:31 2010 UTC (14 years, 2 months ago) by jruoho
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, uebayasi-xip-base7, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, uebayasi-xip-base1, uebayasi-xip, riastradh-drm2-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: yamt-pagecache, tls-maxphys, riastradh-drm2
Changes since 1.2: +3 -1 lines

Add couple instances of .Pp.

.\" $NetBSD: sysmon_pswitch.9,v 1.3 2010/01/29 11:24:31 jruoho Exp $
.\"
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Jukka Ruohonen.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 26, 2010
.Dt SYSMON_PSWITCH 9
.Os
.Sh NAME
.Nm sysmon_pswitch
.Nd framework for power switches
.Sh SYNOPSIS
.In dev/sysmon/sysmonvar.h
.Ft int
.Fn sysmon_pswitch_register "struct sysmon_pswitch *smpsw"
.Ft void
.Fn sysmon_pswitch_unregister "struct sysmon_pswitch *smpsw"
.Ft void
.Fn sysmon_pswitch_event "struct sysmon_pswitch *smpsw" "int event"
.Sh DESCRIPTION
The machine-independent
.Nm
provides a framework for power management.
The interface has been largely superceded by the
.Xr pmf 9
framework, but
.Nm
is still used to manage power switches as well as
related mechanical adapters and buttons.
These are encapsulated in the following structure:
.Bd -literal
struct sysmon_pswitch {
	const char *smpsw_name;		/* power switch name */
	int smpsw_type;			/* power switch type */

	LIST_ENTRY(sysmon_pswitch) smpsw_list;
};
.Ed
.Pp
Unsurprisingly,
.Fa smpsw_name
specifies the name of the power switch and
.Fa smpsw_type
defines the type of it.
The following types are defined:
.Pp
.Bl -tag -width PSWITCH_HK_VENDOR_BUTTON -compact -offset indent
.It PSWITCH_TYPE_POWER
.It PSWITCH_TYPE_SLEEP
.It PSWITCH_TYPE_LID
.It PSWITCH_TYPE_RESET
.It PSWITCH_TYPE_ACADAPTER
.It PSWITCH_TYPE_HOTKEY
.El
.Pp
If the type is
.Dv PSWITCH_TYPE_HOTKEY ,
there are few predefined names that can be used for
.Fa smpsw_name :
.Pp
.Bl -tag -width PSWITCH_HK_VENDOR_BUTTON -compact -offset indent
.It PSWITCH_HK_DISPLAY_CYCLE
.Em display-cycle
.It PSWITCH_HK_LOCK_SCREEN
.Em lock-screen
.It PSWITCH_HK_BATTERY_INFO
.Em battery-info
.It PSWITCH_HK_EJECT_BUTTON
.Em eject-button
.It PSWITCH_HK_ZOOM_BUTTON
.Em zoom-button
.It PSWITCH_HK_VENDOR_BUTTON
.Em vendor-button
.El
.Pp
Once a power switch event has been proceeded,
.Nm
will inform the user space
.Xr powerd 8 ,
which will possibly execute a script matching the type of the power switch.
.Sh FUNCTIONS
After the
.Em sysmon_pswitch
structure has been initialized,
a new power switch device can be registered by using
.Fn sysmon_pswitch_register .
The device can be detached from the framework by
.Fn sysmon_pswitch_unregister .
.Pp
The
.Fn sysmon_pswitch_event
is used to signal a new power switch event.
There are two possibilities for the value of
.Fa event :
.Bl -tag -width PSWITCH_HK_VENDOR_BUTTON -offset indent
.It PSWITCH_EVENT_PRESSED
A button has been pressed, the lid has been closed, the AC adapter is off, etc.
.It PSWITCH_EVENT_RELEASED
A button has been released, the lid is open, the AC adapter is on, etc.
.El
.Pp
The corresponding events in
.Xr powerd 8
are
.Em pressed
and
.Em released .
.Sh SEE ALSO
.Xr powerd 8 ,
.Xr pmf 9 ,
.Xr sysmon_envsys 9 ,
.Xr sysmon_taskq 9
.Sh AUTHORS
.An Jason R. Thorpe Aq thorpej@NetBSD.org