Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sysmon_pswitch_register(9) [netbsd man page]

SYSMON_PSWITCH(9)					   BSD Kernel Developer's Manual					 SYSMON_PSWITCH(9)

NAME
sysmon_pswitch -- framework for power switches SYNOPSIS
#include <dev/sysmon/sysmonvar.h> int sysmon_pswitch_register(struct sysmon_pswitch *smpsw); void sysmon_pswitch_unregister(struct sysmon_pswitch *smpsw); void sysmon_pswitch_event(struct sysmon_pswitch *smpsw, int event); DESCRIPTION
The machine-independent sysmon_pswitch provides a framework for power management. The interface has been largely superceded by the pmf(9) framework, but sysmon_pswitch is still used to manage power switches as well as related mechanical adapters and buttons. These are encapsu- lated in the following structure: struct sysmon_pswitch { const char *smpsw_name; /* power switch name */ int smpsw_type; /* power switch type */ LIST_ENTRY(sysmon_pswitch) smpsw_list; }; Unsurprisingly, smpsw_name specifies the name of the power switch and smpsw_type defines the type of it. The following types are defined: PSWITCH_TYPE_POWER PSWITCH_TYPE_SLEEP PSWITCH_TYPE_LID PSWITCH_TYPE_RESET PSWITCH_TYPE_ACADAPTER PSWITCH_TYPE_HOTKEY If the type is PSWITCH_TYPE_HOTKEY, there are few predefined names that can be used for smpsw_name: PSWITCH_HK_DISPLAY_CYCLE display-cycle PSWITCH_HK_LOCK_SCREEN lock-screen PSWITCH_HK_BATTERY_INFO battery-info PSWITCH_HK_EJECT_BUTTON eject-button PSWITCH_HK_ZOOM_BUTTON zoom-button PSWITCH_HK_VENDOR_BUTTON vendor-button Once a power switch event has been proceeded, sysmon_pswitch will inform the user space powerd(8), which will possibly execute a script matching the type of the power switch. FUNCTIONS
After the sysmon_pswitch structure has been initialized, a new power switch device can be registered by using sysmon_pswitch_register(). The device can be detached from the framework by sysmon_pswitch_unregister(). The sysmon_pswitch_event() is used to signal a new power switch event. There are two possibilities for the value of event: PSWITCH_EVENT_PRESSED A button has been pressed, the lid has been closed, the AC adapter is off, etc. PSWITCH_EVENT_RELEASED A button has been released, the lid is open, the AC adapter is on, etc. The corresponding events in powerd(8) are pressed and released. SEE ALSO
powerd(8), pmf(9), sysmon_envsys(9), sysmon_taskq(9) AUTHORS
Jason R. Thorpe <thorpej@NetBSD.org> BSD
January 26, 2010 BSD

Check Out this Related Man Page

POWERD(8)						    BSD System Manager's Manual 						 POWERD(8)

NAME
powerd -- system power control utility SYNOPSIS
powerd [-a mode] [-b mode] [-i percent] [-m freq] [-M freq] [-n mode] [-p ival] [-P pidfile] [-r percent] [-v] DESCRIPTION
The powerd utility monitors the system state and sets various power control options accordingly. It offers power-saving modes that can be individually selected for operation on AC power or batteries. maximum Choose the highest performance values. May be abbreviated as max. minimum Choose the lowest performance values to get the most power savings. May be abbreviated as min. adaptive Attempt to strike a balance by degrading performance when the system appears idle and increasing it when the system is busy. It offers a good balance between a small performance loss for greatly increased power savings. May be abbreviated as adp. hiadaptive Like adaptive mode, but tuned for systems where performance and interactivity are more important than power consumption. It increases frequency faster, reduces frequency less aggressively, and will maintain full frequency for longer. May be abbreviated as hadp. The default mode is adaptive for battery power and hiadaptive for the rest. powerd recognizes these runtime options: -a mode Selects the mode to use while on AC power. -b mode Selects the mode to use while on battery power. -i percent Specifies the CPU load percent level when adaptive mode should begin to degrade performance to save power. The default is 50% or lower. -m freq Specifies the minimum frequency to throttle down to. -M freq Specifies the maximum frequency to throttle up to. -n mode Selects the mode to use normally when the AC line state is unknown. -p ival Specifies a different polling interval (in milliseconds) for AC line state and system idle levels. The default is 250 ms. -P pidfile Specifies an alternative file in which the process ID should be stored. The default is /var/run/powerd.pid. -r percent Specifies the CPU load percent level where adaptive mode should consider the CPU running and increase performance. The default is 75% or higher. -v Verbose mode. Messages about power changes will be printed to stdout and powerd will operate in the foreground. SEE ALSO
acpi(4), apm(4), cpufreq(4) HISTORY
The powerd utility first appeared in FreeBSD 6.0. AUTHORS
Colin Percival first wrote estctrl, the utility that powerd is based on. Nate Lawson then updated it for cpufreq(4), added features, and wrote this manual page. BUGS
The powerd utility should also power down idle disks and other components besides the CPU. If powerd is used with power_profile, they may override each other. The powerd utility should probably use the devctl(4) interface instead of polling for AC line state. BSD
July 4, 2013 BSD
Man Page