kern/55838: Dual characters from keyboard in X on Toshiba laptop

thn at saeab.se thn at saeab.se
Thu Aug 21 08:00:37 PDT 2003


>Number:         55838
>Category:       kern
>Synopsis:       Dual characters from keyboard in X on Toshiba laptop
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 21 08:00:35 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Nyström (thn at saeab.se)
>Release:        FreeBSD 4.8-RELEASE-p1 i386
>Organization:
Sv. Aktuell Elektronik AB
>Environment:
	System: FreeBSD trumma.int.saeab.se 4.8-RELEASE-p1 FreeBSD 4.8-RELEASE-p1 #3: Thu Aug 21 16:13:43 CEST 2003 root at trumma.int.saeab.se:/usr/obj/usr/src/sys/TRUMMA i386

	Hardware is Toshiba Satellite S1410-303

>Description:
	When running X (4.3.0) and typing on the keyboard, characters
	are repeated sometimes. "Likke thhis andd  it iss verry annnoyying"

	Same problem have been seen on other Toshiba laptops running
	Linux and X (I have found that in mailarchives through Google).

	The root cause of the problem is buggy hardware.

	No problem have been seen when running in non-X mode.

>How-To-Repeat:
	See above.

>Fix:
	The following patch is a workaround for the problem by removing
	identical release codes that is coming back-to-back.

****************************************************************
--- sys/dev/kbd/atkbd.c.org	Mon Apr  8 21:21:38 2002
+++ sys/dev/kbd/atkbd.c	Thu Aug 21 16:17:09 2003
@@ -183,6 +183,7 @@
 	int		ks_polling;
 	int		ks_state;	/* shift/lock key state */
 	int		ks_accents;	/* accent key index (> 0) */
+	int		ks_last_code;	/* last seen scancode */
 	u_int		ks_composed_char; /* composed char code (> 0) */
 	u_char		ks_prefix;	/* AT scan code prefix */
 } atkbd_state_t;
@@ -592,6 +593,11 @@
 	printf("atkbd_read_char(): scancode:0x%x\n", scancode);
 #endif
 
+	/* Don't allow two identical release-scancodes back-to-back */
+	if ((scancode & 0x80) && (scancode == state->ks_last_code))
+		goto next_code;
+	state->ks_last_code = scancode;
+
 	/* return the byte as is for the K_RAW mode */
 	if (state->ks_mode == K_RAW)
 		return scancode;
@@ -947,6 +953,7 @@
 	state->ks_polling = 0;
 	state->ks_state &= LOCK_MASK;	/* preserve locking key state */
 	state->ks_accents = 0;
+	state->ks_last_code = 0;
 	state->ks_composed_char = 0;
 #if 0
 	state->ks_prefix = 0; /* XXX */
****************************************************************
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list