Skip site navigation (1)Skip section navigation (2)
Date:      29 Sep 2002 18:18:59 -0700
From:      "Gary W. Swearingen" <swear@attbi.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   conf/43500: [patch] rc.syscons "allscreens" improvements
Message-ID:  <g8heg8tgu4.eg8@localhost.localdomain>

next in thread | raw e-mail | index | archive | help

>Number:         43500
>Category:       conf
>Synopsis:       rc.syscons "allscreens" improvements
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 29 18:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Gary W. Swearingen
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
none
>Environment:
n/a
================
>Description:

This patch fixes several problems related to the use of the envars
"allscreens_flags" and "allscreens_kbdflags" in the /etc/rc.syscons
file:

1) If either envar is used error message noise will appear in the boot
messages if the kernel is not configured to have a virtual terminal for
each of the /dev/ttyv* files.  The standard /dev/MAKEFILE makes 12,
while some users will have built a kernel MAXCONS reduced from the
default 16 to something less than 12.  It's better to make the script
more robust than to force such users to mess with /dev/ttyv* and MAKEDEV
files (eg, during upgrades), especially since it's an easy change.

2) If "allscreens_flags" is used to try to change the video mode to
one of the VESA* or 132* modes, the script will fail to do so unless
the "vesa" module has been built into the kernel; the module won't
even auto-load.  It's better to make the script more robust (by
trying to load the module, if needed) than to force users to rebuild
their kernel or otherwise fix the problem.  If the module fails to
load because it wasn't built, it will give an additional clue for the
error message which will follow when the mode change is attempted.

3) The "allscreens" use of vidcontrol and kbdcontrol were attempting
(only partially successfully) to redirect stdout and stderr to the VT
being configured instead of to the current terminal (the console) where
it would be more likely to be noticed.
================
>How-To-Repeat:
n/a
================
>Fix:

1) Script determines which device files have VTs configured.
2) Script loads "vesa" module if needed and not already loaded.
    (It can be already loaded after shutting down to single-user
    mode and then exiting back to multi-user mode.)
3) Script allows vidcontrol and kbdcontrol to output to the console.


--- /usr/src/etc/rc.syscons	Sun Aug 18 15:05:29 2002
+++ /etc/rc.syscons	Sun Sep 29 16:54:35 2002
@@ -171,21 +171,40 @@
 	;;
 esac
 
-# set this mode for all virtual screens
+# Use ${allscreens_flags) and ${allscreens_kbdflags} for all virtual terminals:
 #
+vt_list() {
+	# Assume that VTs are the /dev/ttyv* devices which the shell
+	#	redirection mechanism can successfully open; it should
+	#	mean that the device has been kernel-configured as a VT.
+	for ttyv in /dev/ttyv*; do
+		if { : <${ttyv}; } 2>/dev/null; then
+			## keep the braces to redirect the error messages
+			echo "${ttyv}"
+		fi
+	done
+}
+
 if [ -n "${allscreens_flags}" ]; then
+	# load the "vesa" kernel module if it looks like one of the "VESA" or
+	#	"132" modes has been requested and it's not already loaded.
+	if [ "${allscreens_flags#VESA} != "${allscreens_flags}" -o \
+	     "${allscreens_flags#132} != "${allscreens_flags}" ] ; then
+		if ! kldstat -n vesa >/dev/null 2>&1; then 
+			kldload vesa >/dev/null
+		fi
+	fi
+	# continue
 	echo -n ' allscreens'
-	for ttyv in /dev/ttyv*; do
-		vidcontrol ${allscreens_flags} < ${ttyv} > ${ttyv} 2>&1
+	for vt in $(vt_list); do
+		vidcontrol ${allscreens_flags} < ${vt}
 	done
 fi
 
-# set this keyboard mode for all virtual terminals
-#
 if [ -n "${allscreens_kbdflags}" ]; then
 	echo -n ' allscreens_kbd'
-	for ttyv in /dev/ttyv*; do
-		kbdcontrol ${allscreens_kbdflags} < ${ttyv} > ${ttyv} 2>&1
+	for vt in $(vt_list); do
+		kbdcontrol ${allscreens_kbdflags} < ${vt}
 	done
 fi
 
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?g8heg8tgu4.eg8>