Alan,

Please apply to 2.4.0-test1-acLatest.

This patch changes the hub driver so that it does not
try to read a partial hub descriptor first, followed
by a full descriptor read.  Instad it just does a
max-size hub descriptor read.  This fixes a problem
with CTX monitor/hubs and hopefully with LGE monitor/hubs
also.

~Randy
--- linux/drivers/usb/hub.c.org Thu Jun 15 10:18:32 2000
+++ linux/drivers/usb/hub.c     Fri Jun 16 15:08:28 2000
@@ -119,33 +119,29 @@
 static int usb_hub_configure(struct usb_hub *hub)
 {
        struct usb_device *dev = hub->dev;
-       unsigned char buffer[4], *bitmap;
+       unsigned char buffer[HUB_DESCRIPTOR_MAX_SIZE], *bitmap;
        struct usb_hub_descriptor *descriptor;
        struct usb_descriptor_header *header;
        struct usb_hub_status *hubsts;
        int i, ret;
 
-       /* Get the length first */
-       ret = usb_get_hub_descriptor(dev, buffer, sizeof(*header));
+       /* Request the entire hub descriptor. */
+       header = (struct usb_descriptor_header *)buffer;
+       ret = usb_get_hub_descriptor(dev, buffer, sizeof(buffer));
+               /* <buffer> is large enough for a hub with 127 ports;
+                * the hub can/will return fewer bytes here. */
        if (ret < 0) {
-               err("Unable to get partial hub descriptor (err = %d)", ret);
+               err("Unable to get hub descriptor (err = %d)", ret);
                return -1;
        }
 
-       header = (struct usb_descriptor_header *)buffer;
        bitmap = kmalloc(header->bLength, GFP_KERNEL);
        if (!bitmap) {
                err("Unable to kmalloc %d bytes for bitmap", header->bLength);
                return -1;
        }
 
-       ret = usb_get_hub_descriptor(dev, bitmap, header->bLength);
-       if (ret < 0) {
-               err("Unable to get hub descriptor (err = %d)", ret);
-               kfree(bitmap);
-               return -1;
-       }
-
+       memcpy (bitmap, buffer, header->bLength);
        descriptor = (struct usb_hub_descriptor *)bitmap;
 
        hub->nports = dev->maxchild = descriptor->bNbrPorts;
--- linux/drivers/usb/hub.h.org Fri Mar 17 14:19:33 2000
+++ linux/drivers/usb/hub.h     Fri Jun 16 15:00:20 2000
@@ -72,6 +72,8 @@
 #define HUB_CHANGE_LOCAL_POWER 0x0001
 #define HUB_CHANGE_OVERCURRENT 0x0002
 
+#define HUB_DESCRIPTOR_MAX_SIZE        39      /* enough for 127 ports on a hub */
+
 /* Hub descriptor */
 struct usb_hub_descriptor {
        __u8  bLength;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to