Add a "reset button" type.
This commit is contained in:
parent
5f8d1cd0cc
commit
4bbda47b54
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sysmon_power.c,v 1.2 2003/04/18 01:31:35 thorpej Exp $ */
|
||||
/* $NetBSD: sysmon_power.c,v 1.3 2003/04/20 20:48:28 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
@ -434,6 +434,21 @@ sysmon_pswitch_event(struct sysmon_pswitch *smpsw, int event)
|
||||
cpu_reboot(RB_POWERDOWN, NULL);
|
||||
break;
|
||||
|
||||
case PSWITCH_TYPE_RESET:
|
||||
if (event != PSWITCH_EVENT_PRESSED) {
|
||||
/* just ignore it */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt a somewhat graceful reboot of the system,
|
||||
* as if the user had issued a reboot(2) call.
|
||||
*/
|
||||
printf("%s: reset button pressed, rebooting!\n",
|
||||
smpsw->smpsw_name);
|
||||
cpu_reboot(0, NULL);
|
||||
break;
|
||||
|
||||
case PSWITCH_TYPE_SLEEP:
|
||||
if (event != PSWITCH_EVENT_PRESSED) {
|
||||
/* just ignore it */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: power.h,v 1.1 2003/04/18 01:31:35 thorpej Exp $ */
|
||||
/* $NetBSD: power.h,v 1.2 2003/04/20 20:48:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
@ -60,7 +60,15 @@
|
||||
* daemon present, an event on this button will
|
||||
* cause a semi-graceful shutdown of the system
|
||||
* to occur. This kind of button doesn't keep
|
||||
* state; we only know (care) if an event occurrs.
|
||||
* state; we only know (care) if an event occurs.
|
||||
*
|
||||
* Reset button This is the "reset" button on a system, or
|
||||
* another button which provides a similar
|
||||
* function. If there is no power management
|
||||
* daemon present, an event on this button will
|
||||
* cause a semi-graceful reboot of the system
|
||||
* to occur. This kind of button doesn't keep
|
||||
* state; we only know (care) if an event occurs.
|
||||
*
|
||||
* Sleep button This is a button which is dedicated to a
|
||||
* "sleep" function. This kind of button doesn't
|
||||
@ -75,6 +83,7 @@
|
||||
#define PSWITCH_TYPE_POWER 0 /* power button */
|
||||
#define PSWITCH_TYPE_SLEEP 1 /* sleep button */
|
||||
#define PSWITCH_TYPE_LID 2 /* lid switch */
|
||||
#define PSWITCH_TYPE_RESET 3 /* reset button */
|
||||
|
||||
#define PSWITCH_EVENT_PRESSED 0 /* button pressed */
|
||||
#define PSWITCH_EVENT_RELEASED 1 /* button released */
|
||||
|
Loading…
Reference in New Issue
Block a user