Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Feb 1999 04:13:51 +0100 (CET)
From:      Christian Weisgerber <naddy@mips.rhein-neckar.de>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/10113: [PATCH] syscons: switch to previous console
Message-ID:  <199902160313.EAA00626@bigeye.rhein-neckar.de>

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

>Number:         10113
>Category:       kern
>Synopsis:       [PATCH] syscons: switch to previous console
>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:   Mon Feb 15 21:40:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Christian Weisgerber
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

>Description:

The syscons console driver has a special key to switch to the next
virtual console but none to switch to the previous console.

The appended patch adds this missing functionality. Files touched:
  sys/i386/include/console.h            console driver symbol PREV
  sys/dev/syscons/syscons.c             actual functionality
  usr.sbin/kbdcontrol/lex.h             internal symbol TPREV
  usr.sbin/kbdcontrol/lex.l             map "pscr" to TPREV
  usr.sbin/kbdcontrol/kbdcontrol.c      tie "pscr", TPREV, and PREV

>How-To-Repeat:

For testing purposes, I created a keymap with the switch previous/next
screen special keys on cursor left/right:

--- /usr/share/syscons/keymaps/us.iso.kbd	Mon Feb 15 20:21:50 1999
+++ test.kbd	Tue Feb 16 02:03:49 1999
@@ -99,8 +99,8 @@
   094   fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49  O
   095   fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50  O
   096   fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51  O
-  097   fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53  O
-  098   fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55  O
+  097   fkey53 pscr   pscr   pscr   fkey53 fkey53 fkey53 fkey53  O
+  098   fkey55 nscr   nscr   nscr   fkey55 fkey55 fkey55 fkey55  O
   099   fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57  O
   100   fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58  O
   101   fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59  O

>Fix:
	
--- sys/i386/include/console.h.orig	Sat Feb  6 13:33:53 1999
+++ sys/i386/include/console.h	Tue Feb 16 03:16:37 1999
@@ -440,6 +440,7 @@
 #define L_ACC		DCAR		/* last accent key		*/
 
 #define STBY		0x98		/* Go into standby mode (apm)   */
+#define PREV		0x99		/* switch to previous screen 	*/
 
 #define F(x)		((x)+F_FN-1)
 #define	S(x)		((x)+F_SCR-1)
--- sys/dev/syscons/syscons.c.orig	Sat Feb  6 13:33:48 1999
+++ sys/dev/syscons/syscons.c	Tue Feb 16 02:43:56 1999
@@ -3718,6 +3718,18 @@
 		}
 		break;
 
+	    case PREV:
+    		this_scr = get_scr_num();
+		for (i = (this_scr - 1 < 0) ? MAXCONS - 1 : this_scr - 1;
+                     i != this_scr; i = (i - 1 < 0) ? MAXCONS - 1 : i - 1) {
+		    struct tty *tp = VIRTUAL_TTY(i);
+		    if (tp->t_state & TS_ISOPEN) {
+			switch_scr(cur_console, i);
+			break;
+		    }
+		}
+		break;
+
 	    default:
 		if (KEYCHAR(c) >= F_SCR && KEYCHAR(c) <= L_SCR) {
 		    switch_scr(cur_console, KEYCHAR(c) - F_SCR);
--- usr.sbin/kbdcontrol/lex.h.orig	Mon Aug  3 13:33:22 1998
+++ usr.sbin/kbdcontrol/lex.h	Tue Feb 16 01:29:06 1999
@@ -53,6 +53,7 @@
 #define TSUSP		278
 #define TACC		279
 #define TSPSC		280
+#define TPREV		281
 
 extern int number;
 extern char letter;
--- usr.sbin/kbdcontrol/lex.l.orig	Thu Aug  6 11:44:23 1998
+++ usr.sbin/kbdcontrol/lex.l	Tue Feb 16 03:16:40 1999
@@ -51,6 +51,7 @@
 btab		{ return TBTAB; }
 lctrl|ctrl 	{ return TLCTR; }
 nscr 		{ return TNEXT; }
+pscr 		{ return TPREV; }
 rctrl 		{ return TRCTR; }
 ralt 		{ return TRALT; }
 alock 		{ return TALK; }
--- usr.sbin/kbdcontrol/kbdcontrol.c.orig	Sun Jan 24 02:38:37 1999
+++ usr.sbin/kbdcontrol/kbdcontrol.c	Tue Feb 16 03:24:54 1999
@@ -163,6 +163,8 @@
 		return LCTR | 0x100;
 	case TNEXT:
 		return NEXT | 0x100;
+	case TPREV:
+		return PREV | 0x100;
 	case TRCTR:
 		return RCTR | 0x100;
 	case TRALT:
@@ -360,6 +362,9 @@
 		break;
 	case NEXT | 0x100:
 		fprintf(fp, " nscr  ");
+		break;
+	case PREV | 0x100:
+		fprintf(fp, " pscr  ");
 		break;
 	case RCTR | 0x100:
 		fprintf(fp, " rctrl ");
>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?199902160313.EAA00626>