Add the ability to define a "shutdown" and "shutdown and poweroff" key

to syscons. I have a man page to follow describing the format of the
kbdmap file.

PR:		19273
Reviewed by:	sheldonh
This commit is contained in:
David Malone 2000-09-11 20:37:42 +00:00
parent eed59f52da
commit 1c06ce6197
7 changed files with 47 additions and 0 deletions

View File

@ -1144,6 +1144,7 @@ genkbd_keyaction(keyboard_t *kbd, int keycode, int up, int *shiftstate,
/* NON-LOCKING KEYS */
case SPSC: case RBT: case SUSP: case STBY:
case DBG: case NEXT: case PREV: case PNC:
case HALT: case PDWN:
*accents = 0;
break;
case BTAB:

View File

@ -3102,6 +3102,18 @@ scgetc(sc_softc_t *sc, u_int flags)
#endif
break;
case HALT:
#ifndef SC_DISABLE_REBOOT
shutdown_nice(RB_HALT);
#endif
break;
case PDWN:
#ifndef SC_DISABLE_REBOOT
shutdown_nice(RB_HALT|RB_POWEROFF);
#endif
break;
#if NAPM > 0
case SUSP:
apm_suspend(PMST_SUSPEND);

View File

@ -3121,6 +3121,18 @@ scgetc(sc_softc_t *sc, u_int flags)
#endif
break;
case HALT:
#ifndef SC_DISABLE_REBOOT
shutdown_nice(RB_HALT);
#endif
break;
case PDWN:
#ifndef SC_DISABLE_REBOOT
shutdown_nice(RB_HALT|RB_POWEROFF);
#endif
break;
#if NAPM > 0
case SUSP:
apm_suspend(PMST_SUSPEND);

View File

@ -171,6 +171,8 @@ typedef struct keymap keymap_t;
#define RCTRA 0x9e /* right ctrl key / alt lock */
#define LALTA 0x9f /* left alt key / alt lock */
#define RALTA 0xa0 /* right alt key / alt lock */
#define HALT 0xa1 /* halt machine */
#define PDWN 0xa2 /* halt machine and power down */
#define F(x) ((x)+F_FN-1)
#define S(x) ((x)+F_SCR-1)

View File

@ -197,6 +197,10 @@ get_entry()
return LALTA | 0x100;
case TRALTA:
return RALTA | 0x100;
case THALT:
return HALT | 0x100;
case TPDWN:
return PDWN | 0x100;
case TACC:
if (ACC(number) > L_ACC)
return -1;
@ -428,6 +432,12 @@ print_entry(FILE *fp, int value)
case RALTA | 0x100:
fprintf(fp, " ralta ");
break;
case HALT | 0x100:
fprintf(fp, " halt ");
break;
case PDWN | 0x100:
fprintf(fp, " pdwn ");
break;
default:
if (value & 0x100) {
if (val >= F_FN && val <= L_FN)
@ -621,6 +631,12 @@ dump_entry(int value)
case RALTA:
printf("RALTA, ");
break;
case HALT:
printf(" HALT, ");
break;
case PDWN:
printf(" PDWN, ");
break;
default:
if (value >= F_FN && value <= L_FN)
printf(" F(%2d),", value - F_FN + 1);

View File

@ -61,6 +61,8 @@
#define TRCTRA 286
#define TLALTA 287
#define TRALTA 288
#define THALT 289
#define TPDWN 290
extern int number;
extern char letter;

View File

@ -68,6 +68,8 @@ lctrla|ctrla { return TLCTRA; }
rctrla { return TRCTRA; }
lalta|alta { return TLALTA; }
ralta { return TRALTA; }
halt { return THALT; }
pdwn { return TPDWN; }
NUL|nul { number = 0; return TNUM; }
SOH|soh { number = 1; return TNUM; }