NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/57788: Change maximum ttys from 8 to 12



>Number:         57788
>Category:       kern
>Synopsis:       Change maximum ttys from 8 to 12
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 09:40:00 +0000 2023
>Originator:     Dan-Simon Myrland
>Release:        10.0 RC1
>Organization:
>Environment:
NetBSD  10.0_RC1 NetBSD 10.0_RC1 (CUSTOM) #6: Mon Dec 18 15:47:41 CET 2023  root@:/usr/src/sys/arch/amd64/compile/CUSTOM amd64

>Description:
NetBSD has a hard limit of 8 tty consoles. It makes sense to me if this were changed to 12, at least for regular PC architectures like i386/amd64, since these machines usually have 12 function keys.

The default configuration of having four active consoles after installation is fine, but if the following changes are implemented, a user can enable 12 tty consoles by compiling a kernel with "options WSDISPLAY_DEFAULTSCREENS=12" and adding four ttys to /etc/ttys.

PS: The changes work on amd64, but I do not have the means to test this on all architectures. In particular, using the F11/F12 keys for tty switching may conflict with keyboard bindings in dec and hpc.

PPS: The eleventh and twelfth tty is called ttyE10, ttyE11, contrary to normal BSD conventions. Free/Dragonfly/OpenBSD call these ttyXa, ttyXb. If it is desirable to follow the same naming conventions in NetBSD the /dev/MAKEDEV scripts needs to be refined.
>How-To-Repeat:
Adding more then 8 ttys in /etc/ttys and compiling a kernel with "options WSDISPLAY_DEFAULTSCREENS=12" will not work. Even if "#define WSDISPLAY_MAXSCREEN" is set to 12 in /usr/src/sys/dev/wscons/wsdisplay.c and four new tty nodes are created in /dev, the kernel lacks keyboard bindings for Ctrl-Alt-F11 and F12.
>Fix:
Apply the following patch in /usr/src, with src.tgz and syssrc.tgz installed. Recompile kernel and userland. You can now set up to 12 ttys in /etc/ttys and compile a kernel with "options WSDISPLAY_DEFAULTSCREENS=12" to use up to 12 tty consoles.

diff -ru ./etc/MAKEDEV.tmpl /usr/src/etc/MAKEDEV.tmpl
--- ./etc/MAKEDEV.tmpl	2023-01-13 20:08:30.000000000 +0100
+++ /usr/src/etc/MAKEDEV.tmpl	2023-12-20 09:37:57.460550811 +0100
@@ -1025,7 +1025,7 @@
 	;;
 
 wscons)
-	makedev ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 ttyE6 ttyE7
+	makedev ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 ttyE6 ttyE7 ttyE8 ttyE9 ttyE10 ttyE11
 	makedev ttyF0 ttyF1 ttyF2 ttyF3 ttyF4 ttyF5 ttyF6 ttyF7
 	makedev ttyG0 ttyG1 ttyG2 ttyG3 ttyG4 ttyG5 ttyG6 ttyG7
 	makedev ttyH0 ttyH1 ttyH2 ttyH3 ttyH4 ttyH5 ttyH6 ttyH7
diff -ru ./sys/dev/hid/hidkbdmap.c /usr/src/sys/dev/hid/hidkbdmap.c
--- ./sys/dev/hid/hidkbdmap.c	2021-09-22 19:37:32.000000000 +0200
+++ /usr/src/sys/dev/hid/hidkbdmap.c	2023-12-20 09:53:55.021946309 +0100
@@ -108,8 +108,8 @@
     KC(65),  KS_Cmd_Screen7,	KS_f8,
     KC(66),  KS_Cmd_Screen8,	KS_f9,
     KC(67),  KS_Cmd_Screen9,	KS_f10,
-    KC(68), 			KS_f11,
-    KC(69), 			KS_f12,
+    KC(68),  KS_Cmd_Screen10,	KS_f11,
+    KC(69),  KS_Cmd_Screen11,	KS_f12,
     KC(70),			KS_Print_Screen,
     KC(71), 			KS_Hold_Screen,
     KC(72),			KS_Pause,
diff -ru ./sys/dev/pckbport/wskbdmap_mfii.c /usr/src/sys/dev/pckbport/wskbdmap_mfii.c
--- ./sys/dev/pckbport/wskbdmap_mfii.c	2021-09-22 19:37:31.000000000 +0200
+++ /usr/src/sys/dev/pckbport/wskbdmap_mfii.c	2023-12-20 09:54:18.195306967 +0100
@@ -125,8 +125,8 @@
     KC(81), KS_Cmd_ScrollFastDown, KS_KP_Next,	KS_KP_3,
     KC(82), 			KS_KP_Insert,	KS_KP_0,
     KC(83), 			KS_KP_Delete,	KS_KP_Decimal,
-    KC(87), 			KS_f11,
-    KC(88), 			KS_f12,
+    KC(87),  KS_Cmd_Screen10,	KS_f11,
+    KC(88),  KS_Cmd_Screen11,	KS_f12,
     KC(127),			KS_Pause, /* Break */
     KC(136),			KS_Help,
     KC(137),			KS_Stop,
diff -ru ./sys/dev/wscons/wsdisplay.c /usr/src/sys/dev/wscons/wsdisplay.c
--- ./sys/dev/wscons/wsdisplay.c	2023-03-20 18:24:15.000000000 +0100
+++ /usr/src/sys/dev/wscons/wsdisplay.c	2023-12-15 10:05:02.565041956 +0100
@@ -129,7 +129,7 @@
 static void wsdisplay_closescreen(struct wsdisplay_softc *, struct wsscreen *);
 static int wsdisplay_delscreen(struct wsdisplay_softc *, int, int);
 
-#define WSDISPLAY_MAXSCREEN 8
+#define WSDISPLAY_MAXSCREEN 12
 
 struct wsdisplay_softc {
 	device_t sc_dev;
diff -ru ./sys/dev/wscons/wskbd.c /usr/src/sys/dev/wscons/wskbd.c
--- ./sys/dev/wscons/wskbd.c	2020-12-27 17:09:33.000000000 +0100
+++ /usr/src/sys/dev/wscons/wskbd.c	2023-12-15 16:55:47.292658268 +0100
@@ -1622,6 +1622,8 @@
 	case KS_Cmd_Screen7:
 	case KS_Cmd_Screen8:
 	case KS_Cmd_Screen9:
+	case KS_Cmd_Screen10:
+	case KS_Cmd_Screen11:
 		wsdisplay_switch(sc->sc_base.me_dispdv, ksym - KS_Cmd_Screen0, 0);
 		return (1);
 	case KS_Cmd_ResetEmul:
diff -ru ./sys/dev/wscons/wsksymdef.h /usr/src/sys/dev/wscons/wsksymdef.h
--- ./sys/dev/wscons/wsksymdef.h	2021-09-22 19:37:32.000000000 +0200
+++ /usr/src/sys/dev/wscons/wsksymdef.h	2023-12-20 09:55:48.349664816 +0100
@@ -564,6 +564,8 @@
 #define KS_Cmd_Screen7		0xf407
 #define KS_Cmd_Screen8		0xf408
 #define KS_Cmd_Screen9		0xf409
+#define KS_Cmd_Screen10		0xf40a
+#define KS_Cmd_Screen11		0xf40b
 #define KS_Cmd_Debugger		0xf420
 #define KS_Cmd_ResetEmul	0xf421
 #define KS_Cmd_ResetClose	0xf422



Home | Main Index | Thread Index | Old Index