Subject: capslock under console
To: None <port-mac68k@NetBSD.ORG>
From: Stephen Brown <sbrown@best.com>
List: port-mac68k
Date: 04/13/1997 15:58:48
Hi all,

It has vexed me for some time that the "capslock" key does not
work on the console.  I now have a patch that fixes this that
I think will suit everyone and offend no one.  Please check the
attached diffs to -current ite.c.  If anyone is interested,
the "isealpha()" part was lifted entirely from the "dt" source
(if it works, why not use it ;-) ).  I guess the fact that it
has always worked under "dt" is another plug for using "dt".
But there's no excuse to leave the console code broken if
we know how to fix it.

Steve Brown,
sbrown@best.com


*** ite.c	1997/04/12 20:59:32	1.6
--- ite.c	1997/04/13 23:46:25
***************
*** 174,179 ****
--- 174,181 ----
  static void	(*putpixel) __P((int x, int y, int *c, int num));
  static void	(*reversepixel) __P((int x, int y, int num));
  
+ /* For capslock key functionality */
+ #define isealpha(ch)  (((ch)>='A'&&(ch)<='Z')||((ch)>='a'&&(ch)<='z')||((ch)>=0xC0&&(ch)<=0xFF))
  
  /*
   * Bitmap handling functions
***************
*** 1142,1148 ****
  int
  ite_intr(adb_event_t * event)
  {
! 	static int shift = 0, control = 0;
  	int key, press, val, state;
  	char str[10], *s;
  
--- 1144,1150 ----
  int
  ite_intr(adb_event_t * event)
  {
! 	static int shift = 0, control = 0, capslock = 0;
  	int key, press, val, state;
  	char str[10], *s;
  
***************
*** 1152,1157 ****
--- 1154,1162 ----
  
  	if (val == ADBK_SHIFT)
  		shift = press;
+ 	else if (val == ADBK_CAPSLOCK) {
+ 		capslock = !capslock;
+ 	}
  	else if (val == ADBK_CONTROL)
  		control = press;
  	else if (press) {
***************
*** 1182,1187 ****
--- 1187,1196 ----
  			break;
  		default:
  			state = 0;
+ 			if (capslock)
+ 			  if(isealpha(keyboard[val][1])) {
+ 				state = 1;
+ 			  }
  			if (shift)
  				state = 1;
  			if (control)