SYSMON_PSWITCH(9) | Kernel Developer's Manual | SYSMON_PSWITCH(9) |
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);
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.
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 7.2 |