*BSD News Article 18651


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!bruce.cs.monash.edu.au!monu6!aggedor.rmit.OZ.AU!minyos.xx.rmit.OZ.AU!s902113
From: s902113@minyos.xx.rmit.OZ.AU (Luke Mewburn)
Newsgroups: comp.os.386bsd.bugs
Subject: [HACK:]  fix CAPSLOCK for good...
Date: 20 Jul 1993 15:11:56 GMT
Organization: Not RMIT (this is an implicit disclaimer :)
Lines: 220
Message-ID: <22h1vs$6a6@aggedor.rmit.OZ.AU>
Reply-To: zak@rmit.edu.au
NNTP-Posting-Host: minyos.xx.rmit.oz.au
Summary: map capslock to ctrl, rshift+caps to caps
Keywords: netbsd, 386bsd, hack, capslock

Recently I obtained a very old DOS TSR (330 bytes long) which mapped 
the capslock key to ctrl (another control key), and to get caps,
you have to hold right shift with caps. I like this alot (after many
times of accidently hitting caps when I meant shift, tab, or A), and
a ctrl key there is useful.

So, I proceed to hack pccons.c (took about 30 minutes all up,
including working out how the k/b routines worked). I provide the
following context diff to patch this in, (/sys/i386/isa/pccons.c
is the full file). This was done off the NetBSD 0.8 source, but should
work with all other versions of 386bsd. You may have to force the
patch in, cause I changed the source slightly before backing it up
(undefining FAT_CURSOR), but it shouldn't be too hard.

I've been running this for a few days without problems - but I don't
have XSERVER compiled and didn't try that.. Should work as advertised
for that case anyway.

diff follows:

*** ORIG_pccons.c	Mon Jul 19 13:11:57 1993
--- pccons.c	Mon Jul 19 13:13:02 1993
***************
*** 50,55 ****
--- 50,58 ----
   *					minor. 
   * 14 Mar 93	Chris G. Demetriou	Moved pg() to i386/cons.c, code
   *					cleanup, removed ctl-alt-del.
+  * 18 Jul 93	Luke Mewburn		if NO_CAPSLOCK defined, capslock
+  *					acts as CTRL (unless RSHIFT held
+  *					down) (Email: <zak@rmit.edu.au>)
   */
  
  static char rcsid[] = "/b/source/CVS/src/sys.386bsd/i386/isa/pccons.c,v 1.6 1993/04/11 10:16:54 deraadt Exp";
***************
*** 121,128 ****
  };
  
  /* block cursor so wfj does not go blind on laptop hunting for
- 	the verdamnt cursor -wfj */
  #define	FAT_CURSOR
  
  #define	COL		80
  #define	ROW		25
--- 124,136 ----
  };
  
  /* block cursor so wfj does not go blind on laptop hunting for
  #define	FAT_CURSOR
+ 	the verdamnt cursor -wfj */
+ 
+ /* Zak, 930718: ignore that damn capslock key.
+ */
+ #define NO_CAPSLOCK
+ 
  
  #define	COL		80
  #define	ROW		25
***************
*** 1229,1235 ****
  	char	ctrl[CODE_SIZE];
  } Scan_def;
  
! #define	SHIFT		0x0002	/* keyboard shift */
  #define	ALT		0x0004	/* alternate shift -- alternate chars */
  #define	NUM		0x0008	/* numeric shift  cursors vs. numeric */
  #define	CTL		0x0010	/* control shift  -- allows ctl function */
--- 1237,1244 ----
  	char	ctrl[CODE_SIZE];
  } Scan_def;
  
! #define	RSHIFT		0x0001	/* right keyboard shift */
! #define	LSHIFT		0x0002	/* left keyboard shift */
  #define	ALT		0x0004	/* alternate shift -- alternate chars */
  #define	NUM		0x0008	/* numeric shift  cursors vs. numeric */
  #define	CTL		0x0010	/* control shift  -- allows ctl function */
***************
*** 1284,1290 ****
  	ASCII,	";",		":",		";",		/* 39 ; */
  	ASCII,	"'",		"\"",		"'",		/* 40 ' */
  	ASCII,	"`",		"~",		"`",		/* 41 ` */
! 	SHIFT,	"",		"",		"",		/* 42 shift */
  	ASCII,	"\\",		"|",		"\034",		/* 43 \ */
  	ASCII,	"z",		"Z",		"\032",		/* 44 z */
  	ASCII,	"x",		"X",		"\030",		/* 45 x */
--- 1293,1299 ----
  	ASCII,	";",		":",		";",		/* 39 ; */
  	ASCII,	"'",		"\"",		"'",		/* 40 ' */
  	ASCII,	"`",		"~",		"`",		/* 41 ` */
! 	LSHIFT,	"",		"",		"",		/* 42 shift */
  	ASCII,	"\\",		"|",		"\034",		/* 43 \ */
  	ASCII,	"z",		"Z",		"\032",		/* 44 z */
  	ASCII,	"x",		"X",		"\030",		/* 45 x */
***************
*** 1296,1302 ****
  	ASCII,	",",		"<",		"<",		/* 51 , */
  	ASCII,	".",		">",		">",		/* 52 . */
  	ASCII,	"/",		"?",		"\177",		/* 53 / */
! 	SHIFT,	"",		"",		"",		/* 54 shift */
  	KP,	"*",		"*",		"*",		/* 55 kp * */
  	ALT,	"",		"",		"",		/* 56 alt */
  	ASCII,	" ",		" ",		" ",		/* 57 space */
--- 1305,1311 ----
  	ASCII,	",",		"<",		"<",		/* 51 , */
  	ASCII,	".",		">",		">",		/* 52 . */
  	ASCII,	"/",		"?",		"\177",		/* 53 / */
! 	RSHIFT,	"",		"",		"",		/* 54 shift */
  	KP,	"*",		"*",		"*",		/* 55 kp * */
  	ALT,	"",		"",		"",		/* 56 alt */
  	ASCII,	" ",		" ",		" ",		/* 57 space */
***************
*** 1431,1438 ****
  						update_led();
  						break;
  					case CAPS:
! 						caps ^= 1;
! 						update_led();
  						break;
  					case SCROLL:
  						scroll ^= 1;
--- 1440,1452 ----
  						update_led();
  						break;
  					case CAPS:
! #ifdef NO_CAPSLOCK
! 						if (shift_down == RSHIFT)
! #endif
! 						{
! 							caps ^= 1;
! 							update_led();
! 						}
  						break;
  					case SCROLL:
  						scroll ^= 1;
***************
*** 1489,1495 ****
  		dt = dt & 0x7f;
  		switch (scan_codes[dt].type)
  		{
! 			case SHIFT:
  				shift_down = 0;
  				break;
  			case ALT:
--- 1503,1510 ----
  		dt = dt & 0x7f;
  		switch (scan_codes[dt].type)
  		{
! 			case LSHIFT:
! 			case RSHIFT:
  				shift_down = 0;
  				break;
  			case ALT:
***************
*** 1498,1503 ****
--- 1513,1524 ----
  			case CTL:
  				ctrl_down = 0;
  				break;
+ #ifdef NO_CAPSLOCK
+ 			case CAPS:
+ 				if (shift_down != RSHIFT)
+ 					ctrl_down = 0;
+ 				break;
+ #endif
  		}
  	}
  	else
***************
*** 1516,1523 ****
  				update_led();
  				break;
  			case CAPS:
! 				caps ^= 1;
! 				update_led();
  				break;
  			case SCROLL:
  				scroll ^= 1;
--- 1537,1551 ----
  				update_led();
  				break;
  			case CAPS:
! #ifdef NO_CAPSLOCK
! 				if (shift_down == RSHIFT) {
! #endif
! 					caps ^= 1;
! 					update_led();
! #ifdef NO_CAPSLOCK
! 				} else
! 					ctrl_down = 1;
! #endif
  				break;
  			case SCROLL:
  				scroll ^= 1;
***************
*** 1527,1534 ****
  			/*
  			 *   Non-locking keys
  			 */
! 			case SHIFT:
! 				shift_down = 1;
  				break;
  			case ALT:
  				alt_down = 0x80;
--- 1555,1563 ----
  			/*
  			 *   Non-locking keys
  			 */
! 			case LSHIFT:
! 			case RSHIFT:
! 				shift_down = scan_codes[dt].type;
  				break;
  			case ALT:
  				alt_down = 0x80;


--
`Aah ... Yes, and how does madam wish to pay?'             Luke Mewburn  [Zak]
 She slapped her credit card on the counter.                <zak@rmit.edu.au>
`Eventually.'
    - Lady Sharrow, in Iain M. Banks' `Against a Dark Background'