public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: torvalds@osdl.org, vojtech@ucw.cz, linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] Cleanup of the ADI gameport packet reading routine.
Date: Mon, 29 Sep 2003 19:42:51 +0200	[thread overview]
Message-ID: <10648573712586@twilight.ucw.cz> (raw)
In-Reply-To: 

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);
 


             reply	other threads:[~2003-09-29 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-29 17:42 Vojtech Pavlik [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10648573712586@twilight.ucw.cz \
    --to=vojtech@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=vojtech@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox