Hi,

Here is a patch against 2.6.1-rc1 for hid force feedback devices.

hid-core.c:
- Use INT out urbs instead of bulk out urbs. That's the way it should be.

hid-ff.c:
- Email address update.
- Added ids of Logitech MOMO force wheel.

hid-lgff.c:
- Fixes an obvious list handling issue.
- The first value in the "rumble" report was actually the report's id.
Removed it, since hid-core.c takes care of it.
- Email address update.

--
Johann Deneux
PS: please CC to me when replying, I am not registred on linux-usb-devel.


diff -u linux-2.6.1-rc1/drivers/usb/input/hid-core.c 
linux-2.6.1-rc1-new/drivers/usb/input/hid-core.c
--- linux-2.6.1-rc1/drivers/usb/input/hid-core.c        2004-01-06 17:43:56.000000000 
+0000
+++ linux-2.6.1-rc1-new/drivers/usb/input/hid-core.c    2004-01-06 17:50:37.000000000 
+0000
@@ -1525,9 +1526,9 @@
                                continue;
                        if (!(hid->urbout = usb_alloc_urb(0, GFP_KERNEL)))
                                goto fail;
-                       pipe = usb_sndbulkpipe(dev, endpoint->bEndpointAddress);
-                       usb_fill_bulk_urb(hid->urbout, dev, pipe, hid->outbuf, 0,
-                                         hid_irq_out, hid);
+                       pipe = usb_sndintpipe(dev, endpoint->bEndpointAddress);
+                       usb_fill_int_urb(hid->urbout, dev, pipe, hid->outbuf, 0,
+                                         hid_irq_out, hid, 1);
                        hid->urbout->transfer_dma = hid->outbuf_dma;
                        hid->urbout->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
                }
diff -u linux-2.6.1-rc1/drivers/usb/input/hid-ff.c 
linux-2.6.1-rc1-new/drivers/usb/input/hid-ff.c
--- linux-2.6.1-rc1/drivers/usb/input/hid-ff.c  2003-12-18 02:58:49.000000000 +0000
+++ linux-2.6.1-rc1-new/drivers/usb/input/hid-ff.c      2004-01-06 17:56:00.000000000 
+0000
@@ -5,7 +5,7 @@
  *  Not all hid devices use the same protocol. For example, some use PID,
  *  other use their own proprietary procotol.
  *
- *  Copyright (c) 2002 Johann Deneux
+ *  Copyright (c) 2002-2004 Johann Deneux
  */
 
 /*
@@ -24,7 +24,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so by
- * e-mail - mail your message to <[EMAIL PROTECTED]>
+ * e-mail - mail your message to <[EMAIL PROTECTED]>
  */
 
 #include <linux/input.h>
@@ -52,8 +52,9 @@
 
 static struct hid_ff_initializer inits[] = {
 #ifdef CONFIG_LOGITECH_FF
-       {0x46d, 0xc211, hid_lgff_init},
-       {0x46d, 0xc283, hid_lgff_init},
+       {0x46d, 0xc211, hid_lgff_init}, // Logitech Cordless rumble pad
+       {0x46d, 0xc283, hid_lgff_init}, // Logitech Wingman Force 3d
+       {0x46d, 0xc295, hid_lgff_init}, // Logitech MOMO force wheel
 #endif
 #ifdef CONFIG_HID_PID
        {0x45e, 0x001b, hid_pid_init},
diff -u linux-2.6.1-rc1/drivers/usb/input/hid-lgff.c 
linux-2.6.1-rc1-new/drivers/usb/input/hid-lgff.c
--- linux-2.6.1-rc1/drivers/usb/input/hid-lgff.c        2003-12-18 02:59:17.000000000 
+0000
+++ linux-2.6.1-rc1-new/drivers/usb/input/hid-lgff.c    2004-01-06 17:50:37.000000000 
+0000
@@ -6,7 +6,7 @@
  * - WingMan Cordless RumblePad
  * - WingMan Force 3D
  *
- *  Copyright (c) 2002 Johann Deneux
+ *  Copyright (c) 2002-2004 Johann Deneux
  */
 
 /*
@@ -25,13 +25,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so by
- * e-mail - mail your message to <[EMAIL PROTECTED]>
+ * e-mail - mail your message to <[EMAIL PROTECTED]>
  */
 
 #include <linux/input.h>
 #include <linux/sched.h>
 
-#define DEBUG
+//#define DEBUG
 #include <linux/usb.h>
 
 #include <linux/circ_buf.h>
@@ -179,8 +179,7 @@
                kfree(private);
                return -1;
        }
-       private->rumble->field[0]->value[0] = 0x03;
-       private->rumble->field[0]->value[1] = 0x42;
+       private->rumble->field[0]->value[0] = 0x42;
 
 
        private->condition = hid_lgff_duplicate_report(report);
@@ -207,7 +206,7 @@
        add_timer(&private->timer);  /*TODO: only run the timer when at least
                                       one effect is playing */
 
-       printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann 
Deneux <[EMAIL PROTECTED]>\n");
+       printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann 
Deneux <[EMAIL PROTECTED]>\n");
 
        return 0;
 }
@@ -254,7 +253,7 @@
        signed short* ff;
        u16 idVendor = hid->dev->descriptor.idVendor;
        u16 idProduct = hid->dev->descriptor.idProduct;
-       struct hid_input *hidinput = list_entry(&hid->inputs, struct hid_input, list);
+       struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, 
list);
 
        while (dev->idVendor && (idVendor != dev->idVendor || idProduct != 
dev->idProduct))
                dev++;
@@ -511,10 +510,10 @@
                hid_submit_report(hid, lgff->constant, USB_DIR_OUT);
        }
 
-       if (left != lgff->rumble->field[0]->value[3]
-           || right != lgff->rumble->field[0]->value[4]) {
-               lgff->rumble->field[0]->value[3] = left;
-               lgff->rumble->field[0]->value[4] = right;
+       if (left != lgff->rumble->field[0]->value[2]
+           || right != lgff->rumble->field[0]->value[3]) {
+               lgff->rumble->field[0]->value[2] = left;
+               lgff->rumble->field[0]->value[3] = right;
                dbg("(left,right)=(%04x, %04x)", left, right);
                hid_submit_report(hid, lgff->rumble, USB_DIR_OUT);
        }


Reply via email to