All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Stewart <thomas@stewarts.org.uk>
To: linux-kernel@vger.kernel.org
Cc: thomas@stewarts.org.uk
Subject: Griffin Powermate broken in 2.6.0-test-9
Date: Tue, 4 Nov 2003 15:29:18 +0000	[thread overview]
Message-ID: <200311041529.18102.thomas@stewarts.org.uk> (raw)

(Please CC me, I'm not on the list)

Hi,
My Griffin Powermate (www.griffintechnology.com/products/powermate/) stopped 
working when I switched to 2.6.0-testx. I'm using 2.6-test9 now.

It worked fine when using 2.4.21 and this patch 
http://sowerbutts.com/powermate/powermate-2.4.21.patch, this patch was 
included in 2.4.22, and it continued to work fine.

As far as I can tell, only part of that patch made it into 2.6-0-testx. I have 
the newer variant of the device, which is of coarse is a bit different. It 
sends more data.

I had a stab at getting it working, and the patch I produced appears to work 
fine. I have been using it for about a week, with no obvious problems.

Has anyone else come across this? Or maybe I'm the only person with a 
powermate and 2.6.0-testx running. Anyhow can someone more clever than me 
look at it and get it in test10?

Here it is:-

--- linux-2.6.0-test9/drivers/usb/input/powermate.c.orig	2003-11-04 14:36:23.000000000 +0000
+++ linux-2.6.0-test9/drivers/usb/input/powermate.c	2003-11-04 14:38:07.000000000 +0000
@@ -54,7 +54,11 @@
 #define UPDATE_PULSE_AWAKE       (1<<2)
 #define UPDATE_PULSE_MODE        (1<<3)
 
-#define POWERMATE_PAYLOAD_SIZE 3
+/* at least two versions of the hardware exist, with differing payload 
+   sizes. the first three bytes always contain the "interesting" data in
+   the relevant format. */
+#define POWERMATE_PAYLOAD_SIZE_MAX 6
+#define POWERMATE_PAYLOAD_SIZE_MIN 3
 struct powermate_device {
 	signed char *data;
 	dma_addr_t data_dma;
@@ -269,7 +273,7 @@
 
 static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_device *pm)
 {
-	pm->data = usb_buffer_alloc(udev, POWERMATE_PAYLOAD_SIZE,
+	pm->data = usb_buffer_alloc(udev, POWERMATE_PAYLOAD_SIZE_MAX,
 				    SLAB_ATOMIC, &pm->data_dma);
 	if (!pm->data)
 		return -1;
@@ -284,7 +288,7 @@
 static void powermate_free_buffers(struct usb_device *udev, struct powermate_device *pm)
 {
 	if (pm->data)
-		usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE,
+		usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE_MAX,
 				pm->data, pm->data_dma);
 	if (pm->configcr)
 		usb_buffer_free(udev, sizeof(*(pm->configcr)),
@@ -347,12 +351,14 @@
 	pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
 	maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
 
-	if (maxp != POWERMATE_PAYLOAD_SIZE)
-		printk("powermate: Expected payload of %d bytes, found %d bytes!\n", POWERMATE_PAYLOAD_SIZE, maxp);
-
+	if(maxp < POWERMATE_PAYLOAD_SIZE_MIN || maxp > POWERMATE_PAYLOAD_SIZE_MAX){
+		printk("powermate: Expected payload of %d--%d bytes, found %d bytes!\n",
+			POWERMATE_PAYLOAD_SIZE_MIN, POWERMATE_PAYLOAD_SIZE_MAX, maxp);
+		maxp = POWERMATE_PAYLOAD_SIZE_MAX;
+	}
 
 	usb_fill_int_urb(pm->irq, udev, pipe, pm->data,
-			 POWERMATE_PAYLOAD_SIZE, powermate_irq,
+			 maxp, powermate_irq,
 			 pm, endpoint->bInterval);
 	pm->irq->transfer_dma = pm->data_dma;
 	pm->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

-- 
Tom

PGP Fingerprint [DCCD 7DCB A74A 3E3B 60D5  DF4C FC1D 1ECA 68A7 0C48]
PGP Publickey   [http://www.stewarts.org.uk/public-key.asc]
PGP ID		[0x68A70C48]

                 reply	other threads:[~2003-11-04 15:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200311041529.18102.thomas@stewarts.org.uk \
    --to=thomas@stewarts.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.