lkml.org 
[lkml]   [1999]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Toshiba kbd patch
On Tue, Dec 07, 1999 at 12:56:36AM +0100, Vojtech Pavlik wrote:

> On Mon, Dec 06, 1999 at 03:37:00PM -0800, Linus Torvalds wrote:
>
> > > Here is my latest version of the patch for fixing bad Toshiba notebook
> > > keyboards - making sure the PC keyboard delay is at least 250ms, which
> > > seems to be a good thing for others with broken keyboards.
> >
> > Well, it looks reasonable, but at the very least the magic constant "25"
> > would need to be something readable like "HZ/2" so that it would actually
> > work on correctly other architectures than x86 too.
> >
> > Also, I'm really rather nervous about 250ms being too long. Are there any
> > really good touch-typists out there? I can easily see somebody pressing
> > the same key more than four times a second, and I'd hate to lose
> > keystrokes for good typists. Please convince me this is safe..
>
> It should be fine - if someone is typing fast, he's also generating
> key releases and thus the condition won't be met. It guards against
> consecutive presses only, which only happens with autorepeat.

While I agree this is a good workaround, I'd like to note that my
keyboard will miss the first repeat as a result of this patch, because
when my keyboard is set to a 250 ms delay before the first repeat, it
actually only takes about 242 ms. There is then a 33 ms before the next
repeat, which I may throw off my judgement enough to make things annoying
for me.

I am sure that there are other keyboards with even less of a delay that
people are used to, and perhaps some that can be set to even less for the
initial delay. This patch doesn't have any option to support these, but
I don't see any easy alternative (easiest thing is probably a config
option, which is pretty silly).

Attached is a happy delay test program, enter key only. You may wish to
clear the screen first (especially in an X terminal or framebuffer), to
reduce console overhead.

Output from my keyboard:

0.242143

0.033059

0.033039

0.033066

Simon-

[ Stormix Technologies Inc. ][ NetNation Communcations Inc. ]
[ sim@stormix.com ][ sim@netnation.com ]
[ Opinions expressed are not necessarily those of my employers. ]
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>

int main(){
struct timeval tv[3];
struct timeval *current = &tv[0];
struct timeval *last = &tv[1];
struct timeval *difference = &tv[2];
struct timeval *swapper;
int tsnap = 0;
char c;

gettimeofday(last,NULL);

fprintf(stderr,"Press and hold [ENTER] until key repeats and times are printed.\n");

for (;;){
if (read(fileno(stdin),&c,1) != 1)
break;
gettimeofday(current,NULL);
if (current->tv_usec > last->tv_usec){
difference->tv_usec = current->tv_usec - last->tv_usec;
difference->tv_sec = current->tv_sec - last->tv_sec;
} else {
difference->tv_usec = current->tv_usec + 1000000 - last->tv_usec;
difference->tv_sec = current->tv_sec - last->tv_sec - 1;
}
fprintf(stderr,"%u.%06u\n",difference->tv_sec,difference->tv_usec);

swapper = last; last = current; current = swapper;
}

exit(0);
}
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.096 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site