public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Cleanup of the ADI gameport packet reading routine.
@ 2003-09-29 17:42 Vojtech Pavlik
  2003-09-29 17:42 ` [PATCH 2/4] Fix atkbd_softrepeat kernel command line parameter Vojtech Pavlik
  0 siblings, 1 reply; 4+ messages in thread
From: Vojtech Pavlik @ 2003-09-29 17:42 UTC (permalink / raw)
  To: torvalds, vojtech, linux-kernel

You can pull this changeset from:
	bk://kernel.bkbits.net/vojtech/input

===================================================================

ChangeSet@1.1340.1.1, 2003-09-28 09:21:37+02:00, vojtech@suse.cz
  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(-)

===================================================================

diff -Nru a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c
--- a/drivers/input/joystick/adi.c	Mon Sep 29 19:37:19 2003
+++ b/drivers/input/joystick/adi.c	Mon Sep 29 19:37:19 2003
@@ -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);
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-09-29 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-29 17:42 [PATCH 1/4] Cleanup of the ADI gameport packet reading routine Vojtech Pavlik
2003-09-29 17:42 ` [PATCH 2/4] Fix atkbd_softrepeat kernel command line parameter Vojtech Pavlik
2003-09-29 17:42   ` [PATCH 3/4] Explicitly set All-Repeat mode in Set3 on AT keyboards Vojtech Pavlik
2003-09-29 17:42     ` [PATCH 4/4] Fix AT keyboard repeat rate setting Vojtech Pavlik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox