kern/125675: [PATCH] Add hw.syscons.kbd_suspend new sysctl variable to disable keyboard suspend

Taketo Kabe kabe at sra-tohoku.co.jp
Wed Jul 16 11:20:02 UTC 2008


>Number:         125675
>Category:       kern
>Synopsis:       [PATCH] Add hw.syscons.kbd_suspend new sysctl variable to disable keyboard suspend
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 16 11:20:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Taketo Kabe
>Release:        FreeBSD 7.0-RELEASE-p3 i386
>Organization:
>Environment:
System: FreeBSD tunnel.local 7.0-RELEASE-p3 FreeBSD 7.0-RELEASE-p3 #2: Wed Jul 16 18:32:37 JST 2008 root at tunnel.local:/usr/obj/usr/src/sys/GENERIC i386

>Description:

This patch adds a new sysctl variable,
	hw.syscons.kbd_suspend
to disable suspend by Ctl-Alt-Space/Alt-Break keyboard sequence.
Is an suspend counterpart of existing hw.syscons.kbd_debug and
hw.syscons.kbd_reboot sysctl variable.

The suspend key sequence could be easily misinvoked, especially on
non-US input method users using meta keys and space key for various
character conversion.

Alternative approach: Create your own kbdmap(5) with "susp" function deleted.

>How-To-Repeat:

>Fix:
Patch:

This patch adds a new sysctl variable,
	hw.syscons.kbd_suspend
to disable suspend by Ctl-Alt-Space/Alt-Break keyboard sequence.
Is an suspend counterpart of existing hw.syscons.kbd_debug and
hw.syscons.kbd_reboot sysctl variable.

Alternative approach: Create your own kbdmap(5) with "susp" function deleted.


diff -Naru sys.70p3/conf/NOTES sys/conf/NOTES
--- sys.70p3/conf/NOTES	2007-09-26 21:14:17.000000000 +0000
+++ sys/conf/NOTES	2008-07-16 09:16:01.000000000 +0000
@@ -1350,6 +1350,7 @@
 makeoptions	SC_DFLT_FONT=cp850
 options 	SC_DISABLE_KDBKEY	# disable `debug' key
 options 	SC_DISABLE_REBOOT	# disable reboot key sequence
+options 	SC_DISABLE_SUSPEND	# disable suspend key sequence
 options 	SC_HISTORY_SIZE=200	# number of history buffer lines
 options 	SC_MOUSE_CHAR=0x3	# char code for text mode mouse cursor
 options 	SC_PIXEL_MODE		# add support for the raster text mode
diff -Naru sys.70p3/conf/options sys/conf/options
--- sys.70p3/conf/options	2007-09-23 07:34:23.000000000 +0000
+++ sys/conf/options	2008-07-16 09:00:50.000000000 +0000
@@ -689,6 +689,7 @@
 SC_DFLT_FONT		opt_syscons.h
 SC_DISABLE_KDBKEY	opt_syscons.h
 SC_DISABLE_REBOOT	opt_syscons.h
+SC_DISABLE_SUSPEND	opt_syscons.h
 SC_HISTORY_SIZE		opt_syscons.h
 SC_KERNEL_CONS_ATTR	opt_syscons.h
 SC_KERNEL_CONS_REV_ATTR	opt_syscons.h
diff -Naru sys.70p3/dev/syscons/syscons.c sys/dev/syscons/syscons.c
--- sys.70p3/dev/syscons/syscons.c	2008-01-28 12:49:33.000000000 +0000
+++ sys/dev/syscons/syscons.c	2008-07-16 09:23:13.000000000 +0000
@@ -123,6 +123,10 @@
 static  int		enable_kdbkey = TRUE; /* enable keyboard debug */
 #endif
 
+#ifndef SC_DISABLE_SUSPEND
+static  int		enable_suspend = TRUE; /* enable keyboard suspend */
+#endif
+
 static	long        	scrn_blank_time = 0;    /* screen saver timeout value */
 #ifdef DEV_SPLASH
 static	int     	scrn_blanked;		/* # of blanked screen */
@@ -146,6 +150,10 @@
 SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_debug, CTLFLAG_RW|CTLFLAG_SECURE, &enable_kdbkey,
     0, "enable keyboard debug");
 #endif
+#ifndef SC_DISABLE_SUSPEND
+SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_suspend, CTLFLAG_RW|CTLFLAG_SECURE, &enable_suspend,
+    0, "enable keyboard suspend");
+#endif
 #if !defined(SC_NO_FONT_LOADING) && defined(SC_DFLT_FONT)
 #include "font.h"
 #endif
@@ -3366,7 +3374,10 @@
 		break;
 
 	    case SUSP:
-		power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+#ifndef SC_DISABLE_SUSPEND
+		if (enable_suspend)
+			power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+#endif
 		break;
 	    case STBY:
 		power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
diff -Naru share.70p3/man/man4/syscons.4 share/man/man4/syscons.4
--- share.70p3/man/man4/syscons.4	2006-12-14 16:40:57.000000000 +0000
+++ share/man/man4/syscons.4	2008-07-16 09:13:43.000000000 +0000
@@ -40,6 +40,7 @@
 .Cd "options SC_CUT_SPACES2TABS"
 .Cd "options SC_DISABLE_KDBKEY"
 .Cd "options SC_DISABLE_REBOOT"
+.Cd "options SC_DISABLE_SUSPEND"
 .Cd "options SC_HISTORY_SIZE=N"
 .Cd "options SC_MOUSE_CHAR=C"
 .Cd "options SC_NO_CUTPASTE"
@@ -302,6 +303,15 @@
 .Xr sysctl 8
 variable
 .Va hw.syscons.kbd_reboot .
+.It Dv SC_DISABLE_SUSPEND
+This option disables the ``suspend'' key (by default, it is
+.Dv Ctl-Alt-Space or Alt-Break ) ,
+in case suspend does not work properly on your system.
+If this option is not defined, this behavior may be controlled at runtime
+by the
+.Xr sysctl 8
+variable
+.Va hw.syscons.kbd_suspend .
 .It Dv SC_HISTORY_SIZE=N
 Sets the size of back scroll buffer to
 .Fa N

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list