I'm attaching two short patches required to allow the CH Pro Pedals
USB to work with Linux 2.4.17.  I believe that there are two different
sets of USB hardware attached to this device -- some people have seen
3 active axes, 1 dummy axis, and 1 dummy button reported, while I've
seen only the 3 axes.

These patches are originally the work of Tony Peden (joydev.c) and
Alex Perry (hid-core.c).  The joydev.c patch fixes a bug where
drivers/input/joydev.c fails to recognize joysticks with 0 buttons
(like rudder pedals).  The hid-core.c patch skips usb_set_idle and
hid_read_report for the CH USB rudder pedals and yoke (which
apparently has the same problem).

--- joydev.c.DIST       Fri Mar 29 05:34:26 2002
+++ joydev.c    Tue Apr  2 20:47:46 2002
@@ -413,10 +413,9 @@
        struct joydev *joydev;
        int i, j, minor;
 
-       if (!(test_bit(EV_KEY, dev->evbit) && test_bit(EV_ABS, dev->evbit) &&
-            (test_bit(ABS_X, dev->absbit) || test_bit(ABS_Y, dev->absbit)) &&
-            (test_bit(BTN_TRIGGER, dev->keybit) || test_bit(BTN_A, dev->keybit)
-               || test_bit(BTN_1, dev->keybit)))) return NULL; 
+       if (!(test_bit(EV_ABS, dev->evbit) &&
+             (test_bit(ABS_X, dev->absbit) || test_bit(ABS_Y, dev->absbit))))
+         return NULL;
 
        for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++);
        if (minor == JOYDEV_MINORS) {
--- hid-core.c.orig     Tue Apr  2 19:54:10 2002
+++ hid-core.c  Tue Apr  2 20:45:18 2002
@@ -1050,6 +1050,10 @@
                usb_unlink_urb(&hid->urb);
 }
 
+#define USB_VENDOR_ID_CHPRODUCTS        0x068e
+#define USB_DEVICE_ID_CHPRODUCTS_PEDALS 0x00f2
+#define USB_DEVICE_ID_CHPRODUCTS_YOKE   0x00ff
+
 /*
  * Initialize all readable reports
  */
@@ -1065,10 +1069,23 @@
                        report_enum = hid->report_enum + i;
                        list = report_enum->report_list.next;
                        while (list != &report_enum->report_list) {
-                               report = (struct hid_report *) list;
-                               usb_set_idle(hid->dev, hid->ifnum, 0, report->id);
-                               hid_read_report(hid, report);
-                               list = list->next;
+                           // Alex Perry added error detection here
+                           int err = 0;
+                           report = (struct hid_report *) list;
+                           if ( ( hid->dev->descriptor.idVendor 
+                                  == USB_VENDOR_ID_CHPRODUCTS      ) &&
+                                ( (hid->dev->descriptor.idProduct
+                                   == USB_DEVICE_ID_CHPRODUCTS_YOKE) ||
+                                  (hid->dev->descriptor.idProduct
+                                  == USB_DEVICE_ID_CHPRODUCTS_PEDALS) ) &&
+                            1 )
+                                err = -911;
+                           else err = usb_set_idle(hid->dev,
+                                               hid->ifnum, 0, report->id);
+                           if (err) warn("hid_init_reports usb_set_idle()=%d"
+                                       , err );
+                           else hid_read_report(hid, report);
+                           list = list->next;
                        }
                }
        }


All the best,


David

-- 
David Megginson
[EMAIL PROTECTED]

Reply via email to