Subject: Re: More keyboard/X problems...
To: None <cato@df.lth.se>
From: Gordon W. Ross <gwr@mc.com>
List: port-sparc
Date: 10/27/1997 16:56:13
Here are some changes to print out some more helpful information
when the translation maps are producing unexpected keysyms.
We would learn a lot more if you run with this change.

Thanks,
Gordon



*** sys/dev/sun/kbd.c~	Mon Oct 27 16:28:42 1997
--- sys/dev/sun/kbd.c	Mon Oct 27 16:51:12 1997
***************
*** 649,655 ****
  
  static void kbd_input_string __P((struct kbd_softc *, char *));
  static void kbd_input_funckey __P((struct kbd_softc *, int));
! static void kbd_input_keysym __P((struct kbd_softc *, int));
  static void kbd_input_raw __P((struct kbd_softc *k, int));
  
  /*
--- 649,655 ----
  
  static void kbd_input_string __P((struct kbd_softc *, char *));
  static void kbd_input_funckey __P((struct kbd_softc *, int));
! static int  kbd_input_keysym __P((struct kbd_softc *, int));
  static void kbd_input_raw __P((struct kbd_softc *k, int));
  
  /*
***************
*** 760,767 ****
  /*
   * This is called by kbd_input_raw() or by kb_repeat()
   * to deliver ASCII input.  Called at spltty().
   */
! void
  kbd_input_keysym(k, keysym)
  	struct kbd_softc *k;
  	register int keysym;
--- 760,770 ----
  /*
   * This is called by kbd_input_raw() or by kb_repeat()
   * to deliver ASCII input.  Called at spltty().
+  *
+  * Return zero on success, else the keysym that we
+  * could not handle (so the caller may complain).
   */
! int
  kbd_input_keysym(k, keysym)
  	struct kbd_softc *k;
  	register int keysym;
***************
*** 812,821 ****
  			break;
  		/* fall through */
  	default:
! 		log(LOG_WARNING, "%s: unexpected keysym 0x%x\n",
! 			k->k_dev.dv_xname, keysym);
! 		break;
  	}
  }
  
  /*
--- 815,824 ----
  			break;
  		/* fall through */
  	default:
! 		/* We could not handle it. */
! 		return (keysym);
  	}
+ 	return (0);
  }
  
  /*
***************
*** 829,835 ****
  	int s = spltty();
  
  	if (k->k_repeating && k->k_repeatsym >= 0) {
! 		kbd_input_keysym(k, k->k_repeatsym);
  		timeout(kbd_repeat, k, k->k_repeat_step);
  	}
  	splx(s);
--- 832,838 ----
  	int s = spltty();
  
  	if (k->k_repeating && k->k_repeatsym >= 0) {
! 		(void)kbd_input_keysym(k, k->k_repeatsym);
  		timeout(kbd_repeat, k, k->k_repeat_step);
  	}
  	splx(s);
***************
*** 907,913 ****
  		keysym = kbd_code_to_keysym(ks, c);
  
  		/* Pass up to the next layer. */
! 		kbd_input_keysym(k, keysym);
  
  		/* Does this symbol get auto-repeat? */
  		if (KEYSYM_NOREPEAT(keysym))
--- 910,923 ----
  		keysym = kbd_code_to_keysym(ks, c);
  
  		/* Pass up to the next layer. */
! 		if (kbd_input_keysym(k, keysym)) {
! 			log(LOG_WARNING, "%s: code=0x%x with mod=0x%x"
! 				" produced unexpected keysym 0x%x\n",
! 				k->k_dev.dv_xname, c,
! 				ks->kbd_modbits, keysym);
! 			/* No point in auto-repeat here. */
! 			return;
! 		}
  
  		/* Does this symbol get auto-repeat? */
  		if (KEYSYM_NOREPEAT(keysym))
***************
*** 1413,1420 ****
  kbd_update_leds(k)
      struct kbd_softc *k;
  {
!     struct kbd_state *ks = &k->k_state;
!     register char leds;
  
  	leds = ks->kbd_leds;
  	leds &= ~(LED_CAPS_LOCK|LED_NUM_LOCK);
--- 1423,1430 ----
  kbd_update_leds(k)
      struct kbd_softc *k;
  {
! 	struct kbd_state *ks = &k->k_state;
! 	register char leds;
  
  	leds = ks->kbd_leds;
  	leds &= ~(LED_CAPS_LOCK|LED_NUM_LOCK);