Greg, if this doesn't apply to your 2.4.x tree, could you please send me
an updated tarball of your tree?


--- linux/drivers/usb.new/hid-input.c   Thu May 22 22:47:00 2003
+++ linux/drivers/usb/hid-input.c       Tue Jun  3 20:35:46 2003
@@ -73,8 +73,11 @@
 
                hidinput = list_entry(lh, struct hid_input, list);
 
-               for (i = 0; i < hidinput->maxfield; i++)
-                       if (hidinput->fields[i] == field)
+               if (! hidinput->report)
+                       continue;
+
+               for (i = 0; i < hidinput->report->maxfield; i++)
+                       if (hidinput->report->field[i] == field)
                                return &hidinput->input;
        }
 
@@ -340,8 +343,7 @@
        struct input_dev *input = find_input(hid, field);
        int *quirks = &hid->quirks;
 
-       if (!input)
-               return;
+       BUG_ON(!input);
 
        if (usage->hat_min != usage->hat_max) {
                value = (value - usage->hat_min) * 8 / (usage->hat_max - 
usage->hat_min + 1) + 1;
@@ -423,7 +425,7 @@
        struct hid_report *report;
        struct list_head *list;
        struct hid_input *hidinput = NULL;
-       int i, j;
+       int i, j, k;
 
        INIT_LIST_HEAD(&hid->inputs);
 
@@ -434,53 +436,54 @@
        if (i == hid->maxapplication)
                return -1;
 
-       report_enum = hid->report_enum + HID_INPUT_REPORT;
-       list = report_enum->report_list.next;
-       while (list != &report_enum->report_list) {
-               report = (struct hid_report *) list;
+       for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) {
+               report_enum = hid->report_enum + HID_INPUT_REPORT;
+               list = report_enum->report_list.next;
+               while (list != &report_enum->report_list) {
+                       report = (struct hid_report *) list;
 
-               if (!report->maxfield)
-                       continue;
+                       if (!report->maxfield)
+                               continue;
 
-               if (!hidinput) {
-                       hidinput = kmalloc(sizeof(*hidinput), GFP_KERNEL);
                        if (!hidinput) {
-                               err("Out of memory during hid input probe");
-                               return -1;
+                               hidinput = kmalloc(sizeof(*hidinput), GFP_KERNEL);
+                               if (!hidinput) {
+                                       err("Out of memory during hid input probe");
+                                       return -1;
+                               }
+                               memset(hidinput, 0, sizeof(*hidinput));
+                               list_add_tail(&hidinput->list, &hid->inputs);
+
+                               hidinput->input.private = hid;
+                               hidinput->input.event = hidinput_input_event;
+                               hidinput->input.open = hidinput_open;
+                               hidinput->input.close = hidinput_close;
+
+                               hidinput->input.name = hid->name;
+                               hidinput->input.idbus = BUS_USB;
+                               hidinput->input.idvendor = dev->descriptor.idVendor;
+                               hidinput->input.idproduct = dev->descriptor.idProduct;
+                               hidinput->input.idversion = dev->descriptor.bcdDevice;
                        }
-                       memset(hidinput, 0, sizeof(*hidinput));
-                       list_add_tail(&hidinput->list, &hid->inputs);
 
-                       hidinput->input.private = hid;
-                       hidinput->input.event = hidinput_input_event;
-                       hidinput->input.open = hidinput_open;
-                       hidinput->input.close = hidinput_close;
-
-                       hidinput->input.name = hid->name;
-                       hidinput->input.idbus = BUS_USB;
-                       hidinput->input.idvendor = dev->descriptor.idVendor;
-                       hidinput->input.idproduct = dev->descriptor.idProduct;
-                       hidinput->input.idversion = dev->descriptor.bcdDevice;
-               }
+                       for (i = 0; i < report->maxfield; i++)
+                               for (j = 0; j < report->field[i]->maxusage; j++)
+                                       hidinput_configure_usage(hidinput, 
report->field[i],
+                                                                
report->field[i]->usage + j);
+
+                       if (hid->quirks & HID_QUIRK_MULTI_INPUT) {
+                               /* This will leave hidinput NULL, so that it
+                                * allocates another one if we have more inputs on
+                                * the same interface. Some devices (e.g. Happ's
+                                * UGCI) cram a lot of unrelated inputs into the
+                                * same interface. */
+                               hidinput->report = report;
+                               input_register_device(&hidinput->input);
+                               hidinput = NULL;
+                       }
 
-               for (i = 0; i < report->maxfield; i++)
-                       for (j = 0; j < report->field[i]->maxusage; j++)
-                               hidinput_configure_usage(hidinput, report->field[i],
-                                                        report->field[i]->usage + j);
-
-               if (hid->quirks & HID_QUIRK_MULTI_INPUT) {
-                       /* This will leave hidinput NULL, so that it
-                        * allocates another one if we have more inputs on
-                        * the same interface. Some devices (e.g. Happ's
-                        * UGCI) cram a lot of unrelated inputs into the
-                        * same interface. */
-                       hidinput->fields = report->field;
-                       hidinput->maxfield = report->maxfield;
-                       input_register_device(&hidinput->input);
-                       hidinput = NULL;
+                       list = list->next;
                }
-
-               list = list->next;
        }
 
        if (hidinput)
--- linux/drivers/usb.new/hid.h Thu May 29 18:49:55 2003
+++ linux/drivers/usb/hid.h     Tue Jun  3 20:33:25 2003
@@ -299,8 +299,7 @@
 
 struct hid_input {
        struct list_head list;
-       struct hid_field **fields;
-       int maxfield;
+       struct hid_report *report;
        struct input_dev input;
 };
 


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to