From owner-freebsd-bugs Sun Sep 29 18:20: 6 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D12AE37B401 for ; Sun, 29 Sep 2002 18:20:02 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1299443E75 for ; Sun, 29 Sep 2002 18:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8U1K1Co055761 for ; Sun, 29 Sep 2002 18:20:01 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8U1K1b0055760; Sun, 29 Sep 2002 18:20:01 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AAD2F37B401 for ; Sun, 29 Sep 2002 18:16:05 -0700 (PDT) Received: from rwcrmhc53.attbi.com (rwcrmhc53.attbi.com [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B26E43E4A for ; Sun, 29 Sep 2002 18:16:05 -0700 (PDT) (envelope-from swear@attbi.com) Received: from localhost.localdomain ([12.242.158.67]) by rwcrmhc53.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020930011604.FBPB15492.rwcrmhc53.attbi.com@localhost.localdomain> for ; Mon, 30 Sep 2002 01:16:04 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost.localdomain (8.12.5/8.12.5) with ESMTP id g8U1J5hY003134 for ; Sun, 29 Sep 2002 18:19:05 -0700 (PDT) (envelope-from swear@attbi.com) Received: (from jojo@localhost) by localhost.localdomain (8.12.5/8.12.5/Submit) id g8U1J0wI003129; Sun, 29 Sep 2002 18:19:00 -0700 (PDT) (envelope-from swear@attbi.com) Message-Id: Date: 29 Sep 2002 18:18:59 -0700 From: "Gary W. Swearingen" Reply-To: swear@attbi.com To: FreeBSD-gnats-submit@FreeBSD.org Subject: conf/43500: [patch] rc.syscons "allscreens" improvements Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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