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

i386 hack: caps vs ctl key



I got tired of hitting the caps lock instead of the control key on
my portable when not running X.  This little hack is the result.
It makes the capslock a 2nd control key.  No guarantees, but it
seems to work for me.  This is for pccons.  The patch to pcvt is
quite similar.

Index: pccons.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/isa/pccons.c,v
retrieving revision 1.34
diff -u -u -r1.34 pccons.c
--- pccons.c	1997/03/03 12:01:15	1.34
+++ pccons.c	1997/05/11 02:21:06
@@ -1662,6 +1662,20 @@
 	KBD_DELAY;
 	dt = inb(KBDATAP);
 
+#ifdef CAPSCTL
+
+	/* If the scan code is for the caps-lock key, convert it to the
+	   control key. */
+
+#define CAPS_SCAN 58
+#define CTRL_SCAN 29
+
+	if (( dt & 0x7f ) == CAPS_SCAN ) {
+	    dt = CTRL_SCAN | ( dt & 0x80 );
+	}
+
+#endif /* CAPSCTL */
+
 	switch (dt) {
 	case KBR_ACK:
 		ack = 1;

----

To use, add

option          CAPSCTL         # make caps-lock an additional control key

to your configuration file and remove

	XkbOptions      "ctrl:swapcaps"

from your /etc/XF86Config (if it is there).

// marc

// marc