Guys,

The patch came about as offshot of my anti-usbkbd crusade.
(Or shall I say Vojtech's anti-usbkbd policies? :)

This patch is truly a kludge, but it seems to work.
Some hardware by a certain company called "ATEN" crashes
if GET_REPORT is sent. I tried to modify our GET_REPORT, but
it seems that nothing helps. So, I simply switched GET_REPORT off.
It works for the piece of junk that Red Hat bought for my testing,
and I got several "thank you" notes since we shipped the patch.
The usbkbd works because it never sends GET_REPORT.

So, what do you think?

-- Pete

--- linux-2.4.19-pre2/drivers/usb/hid-core.c    Fri Dec 21 09:41:55 2001
+++ linux-2.4.19-pre2-p3/drivers/usb/hid-core.c Mon Mar 11 09:28:53 2002
@@ -63,6 +63,12 @@
                                "Gamepad", "Keyboard", "Keypad", "Multi-Axis 
Controller"};
 
 /*
+ * The module parameter is used to investigate if a particular device
+ * is to be added to the blacklist for broken GET_REPORT.
+ */
+static int no_get = 0;
+
+/*
  * Register a new report for a device.
  */
 
@@ -1025,6 +1031,7 @@
        if (hid->outhead == hid->outtail)
                hid->outtail = (hid->outtail + 1) & (HID_CONTROL_FIFO_SIZE - 1);
 
+       /* P3 XXX buggy - use separate flag. */
        if (hid->urbout.status != -EINPROGRESS)
                hid_submit_out(hid);
 }
@@ -1065,7 +1072,8 @@
                        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);
+                               if ((hid->quirks & HID_QUIRK_NOGET) == 0 && !no_get)
+                                       hid_read_report(hid, report);
                                list = list->next;
                        }
                }
@@ -1089,22 +1097,45 @@
        { 0, 0 }
 };
 
+#define USB_VENDOR_ID_ATEN             0x0557
+#define USB_DEVICE_ID_ATEN_UC100KM     0x2004
+#define USB_DEVICE_ID_ATEN_CS124U      0x2202
+#define USB_DEVICE_ID_ATEN_2PORTKVM    0x2204
+
+static struct hid_blacklist hid_blst_noget[] = {
+       { USB_VENDOR_ID_ATEN,   USB_DEVICE_ID_ATEN_UC100KM },
+       { USB_VENDOR_ID_ATEN,   USB_DEVICE_ID_ATEN_CS124U },
+       { USB_VENDOR_ID_ATEN,   USB_DEVICE_ID_ATEN_2PORTKVM },
+       { 0, 0 }
+};
+
 static struct hid_device *usb_hid_configure(struct usb_device *dev, int ifnum)
 {
        struct usb_interface_descriptor *interface = 
dev->actconfig->interface[ifnum].altsetting + 0;
        struct hid_descriptor *hdesc;
        struct hid_device *hid;
        unsigned rsize = 0;
+       int noget = 0;
        char *buf;
        int n;
 
        for (n = 0; hid_blacklist[n].idVendor; n++)
                if ((hid_blacklist[n].idVendor == dev->descriptor.idVendor) &&
-                       (hid_blacklist[n].idProduct == dev->descriptor.idProduct)) 
return NULL;
+                       (hid_blacklist[n].idProduct == dev->descriptor.idProduct)) {
+               return NULL;
+       }
+
+       for (n = 0; hid_blst_noget[n].idVendor; n++) {
+               if ((hid_blst_noget[n].idVendor == dev->descriptor.idVendor) &&
+                   (hid_blst_noget[n].idProduct == dev->descriptor.idProduct))
+               {
+                       noget = 1;
+               }
+       }
 
        if (usb_get_extra_descriptor(interface, USB_DT_HID, &hdesc) && 
((!interface->bNumEndpoints) ||
                usb_get_extra_descriptor(&interface->endpoint[0], USB_DT_HID, 
&hdesc))) {
-                       dbg("class descriptor not present\n");
+                       dbg("class descriptor not present");
                        return NULL;
        }
 
@@ -1176,6 +1207,9 @@
 
        hid->name[0] = 0;
 
+       if (noget)
+               hid->quirks |= HID_QUIRK_NOGET;
+
        if (!(buf = kmalloc(63, GFP_KERNEL)))
                return NULL;
 
@@ -1302,6 +1336,7 @@
 module_init(hid_init);
 module_exit(hid_exit);
 
+MODULE_PARM(no_get, "i");
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE("GPL");
--- linux-2.4.19-pre2/drivers/usb/hid.h Tue Nov 13 17:45:27 2001
+++ linux-2.4.19-pre2-p3/drivers/usb/hid.h      Mon Mar 11 09:27:13 2002
@@ -184,6 +184,7 @@
 
 #define HID_QUIRK_INVERT       0x01
 #define HID_QUIRK_NOTOUCH      0x02
+#define HID_QUIRK_NOGET                0x04
 
 /*
  * This is the global enviroment of the parser. This information is

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to