From root@trumma.int.saeab.se  Thu Aug 21 07:54:18 2003
Return-Path: <root@trumma.int.saeab.se>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 068D116A4BF
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Aug 2003 07:54:18 -0700 (PDT)
Received: from trumma.int.saeab.se (ture.saeab.se [213.80.3.133])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3767D43FD7
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Aug 2003 07:54:16 -0700 (PDT)
	(envelope-from root@trumma.int.saeab.se)
Received: from trumma.int.saeab.se (localhost [127.0.0.1])
	by trumma.int.saeab.se (8.12.8p1/8.12.8) with ESMTP id h7LEsFtU000342
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Aug 2003 16:54:15 +0200 (CEST)
	(envelope-from root@trumma.int.saeab.se)
Received: (from root@localhost)
	by trumma.int.saeab.se (8.12.8p1/8.12.8/Submit) id h7LEsE5e000341;
	Thu, 21 Aug 2003 16:54:14 +0200 (CEST)
Message-Id: <200308211454.h7LEsE5e000341@trumma.int.saeab.se>
Date: Thu, 21 Aug 2003 16:54:14 +0200 (CEST)
From: thn@saeab.se
Reply-To: thn@saeab.se
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Dual characters from keyboard in X on Toshiba laptop
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         55838
>Category:       i386
>Synopsis:       [kbd] [patch] Dual characters from keyboard in X on Toshiba laptop
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 21 08:00:35 PDT 2003
>Closed-Date:    Sat Nov 11 08:37:14 GMT 2006
>Last-Modified:  Sat Nov 11 08:37:14 GMT 2006
>Originator:     Thomas Nystrm (thn@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@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:
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Mon Sep 11 12:24:12 UTC 2006 
State-Changed-Why:  
Hello, 

is the double character problem still there in more recent 
freebsd releases like 6.1? 

thanks 


Responsible-Changed-From-To: freebsd-i386->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Mon Sep 11 12:24:12 UTC 2006 
Responsible-Changed-Why:  
grab the pr 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55838 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Sat Nov 11 08:35:12 UTC 2006 
State-Changed-Why:  
I recieved no feedback so far, closing the PR. Untill I recieve feedback I will close the ticket. 
Please inform me when there is feedback so that we can work on this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55838 
>Unformatted:
