| SYSMON_PSWITCH(9) | Kernel Developer's Manual | SYSMON_PSWITCH(9) | 
sysmon_pswitch —
#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);
sysmon_pswitch provides a
  framework for power management. The interface has been largely superseded 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 encapsulated 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:
If the type is PSWITCH_TYPE_HOTKEY, there
    are few predefined names that can be used for
    smpsw_name:
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.
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:
The corresponding events in powerd(8) are pressed and released.
| January 6, 2015 | NetBSD 9.4 |