Cleanup of the ADI gameport packet reading routine.
PATCH 1/4 Cleanup of the ADI gameport packet reading routine.
You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/input
===================================================================
[email protected], 2003-09-28 09:21:37+02:00, [email protected]
input: Cleanup the ADI gameport packet reading routine a bit.
Thanks to a nice guy who wishes not to be named.
adi.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
===================================================================
drivers/input/joystick/adi.c +11 -6
@@ -136,13 +136,18 @@/* * adi_read_packet() reads a Logitech ADI packet. +* +* A packet is sent in response to a gameport trigger command, and can arrive +* over one or both pairs of gameport button signals. If the top bit of the +* pair changes, it's a 1. If the bottom bit changes, it's a 0. The end of a +* packet is signalled by a timeout. */ static void adi_read_packet (struct adi_port *port) {struct adi *adi = port->adi;struct gameport *gameport = port->gameport; -unsigned char u, v, w, x, z; +unsigned char u, v, w;int t[2 ], s[2 ], i;unsigned long flags;
@@ -155,19 +160,19 @@local_irq_save (flags);gameport_trigger (gameport); - v = z =gameport_read (gameport); + v =gameport_read (gameport);do { - u = v; - w = u ^ (v = x =gameport_read (gameport)); -for (i =0 ; i <2 ; i++, w >>=2 , x >>=2 ) { + w = v ^ (u =gameport_read (gameport)); + v = u; +for (i =0 ; i <2 ; i++, w >>=2 , u >>=2 ) { t[i]--;if ((w &0x30 ) && s[i]) {if ((w &0x30 ) <0x30 && adi[i].ret <ADI_MAX_LENGTH && t[i] >0 ) { adi[i].data[++adi[i].ret] = w; t[i] =gameport_time (gameport,ADI_MAX_STROBE ); }else t[i] =0 ; - }else if (!(x &0x30 )) s[i] =1 ; + }else if (!(u &0x30 )) s[i] =1 ; } }while (t[0 ] >0 || t[1 ] >0 );
PATCH 2/4 Fix atkbd_softrepeat kernel command line parameter.
You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/input
===================================================================
[email protected], 2003-09-28 18:48:05+02:00, [email protected]
input: Fix atkbd_softrepeat kernel command line parameter.
atkbd.c | 8 ++++++++ 1 files changed, 8 insertions(+)
===================================================================
drivers/input/keyboard/atkbd.c +8 -0
@@ -707,9 +707,17 @@if (ints[0 ] >0 ) atkbd_reset = ints[1 ]; return 1; } +static int __init atkbd_setup_softrepeat (char *str) +{ +int ints[4 ]; + str =get_options (str,ARRAY_SIZE (ints), ints); +if (ints[0 ] >0 ) atkbd_softrepeat = ints[1 ]; +return 1 ; +}__setup ("atkbd_set=" , atkbd_setup_set);__setup ("atkbd_reset" , atkbd_setup_reset); +__setup ("atkbd_softrepeat=" , atkbd_setup_softrepeat);#endif int __init atkbd_init (void )
PATCH 3/4 Explicitly set All-Repeat mode in Set3 on AT keyboards.
You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/input
===================================================================
[email protected], 2003-09-29 12:59:49+02:00, [email protected]
input: Explicitly set All-Repeat mode in Set3 on AT keyboards.
atkbd.c | 3 +++ 1 files changed, 3 insertions(+)
===================================================================
drivers/input/keyboard/atkbd.c +3 -0
@@ -111,6 +111,7 @@#define ATKBD_CMD_SETREP 0x10f3#define ATKBD_CMD_ENABLE 0x00f4#define ATKBD_CMD_RESET_DIS 0x00f5 +#define ATKBD_CMD_SETALL_MBR 0x00fa#define ATKBD_CMD_RESET_BAT 0x02ff#define ATKBD_CMD_RESEND 0x00fe#define ATKBD_CMD_EX_ENABLE 0x10ea
@@ -519,6 +520,8 @@if (atkbd_command (atkbd, param,ATKBD_CMD_SSCANSET ))return 2 ; } + +atkbd_command (atkbd, param,ATKBD_CMD_SETALL_MBR );return 3 ; }
PATCH 4/4 Fix AT keyboard repeat rate setting.
You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/input
===================================================================
[email protected], 2003-09-29 17:00:25+02:00, [email protected]
input: Fix AT keyboard repeat rate setting, also make rate selection
in finer steps.
atkbd.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
===================================================================
drivers/input/keyboard/atkbd.c +10 -9
@@ -370,10 +370,11 @@static int atkbd_event (struct input_dev *dev,unsigned int type,unsigned int code,int value) {struct atkbd *atkbd = dev->private; -struct {int p;u8 v; } period[] = - { {30 ,0x00 }, {25 ,0x02 }, {20 ,0x04 }, {15 ,0x08 }, {10 ,0x0c }, {7 ,0x10 }, {5 ,0x14 }, {0 ,0x14 } }; -struct {int d;u8 v; } delay[] = - { {1000 ,0x60 }, {750 ,0x40 }, {500 ,0x20 }, {250 ,0x00 }, {0 ,0x00 } }; +const short period[32 ] = + {33 ,37 ,42 ,46 ,50 ,54 ,58 ,63 ,67 ,75 ,83 ,92 ,100 ,109 ,116 ,125 , +133 ,149 ,167 ,182 ,200 ,217 ,232 ,250 ,270 ,303 ,333 ,370 ,400 ,435 ,470 ,500 }; +const short delay[4 ] = + {250 ,500 ,750 ,1000 };char param[2 ];int i, j;
@@ -407,11 +408,11 @@if (atkbd_softrepeat)return 0 ; i = j =0 ; -while (period[i].p > dev->rep[REP_PERIOD ]) i++; -while (delay[j].d > dev->rep[REP_DELAY ]) j++; - dev->rep[REP_PERIOD ] = period[i].p; - dev->rep[REP_DELAY ] = delay[j].d; - param[0 ] = period[i].v | delay[j].v; +while (i <32 && period[i] < dev->rep[REP_PERIOD ]) i++; +while (j <4 && delay[j] < dev->rep[REP_DELAY ]) j++; + dev->rep[REP_PERIOD ] = period[i]; + dev->rep[REP_DELAY ] = delay[j]; + param[0 ] = i | (j <<5 );atkbd_command (atkbd, param,ATKBD_CMD_SETREP );return 0 ;