Hi,
Here's a patch against 2.4.11-pre6 that updates the USB hub driver to
the almost the same version that is in the -ac tree. I have not
included Pete's locking change that is currently in the -ac tree.
thanks,
greg k-h
(temporary USB maintainer)
diff --minimal -Nru a/drivers/usb/hub.c b/drivers/usb/hub.c
--- a/drivers/usb/hub.c Tue Oct 9 14:16:55 2001
+++ b/drivers/usb/hub.c Tue Oct 9 14:16:55 2001
@@ -4,6 +4,8 @@
* (C) Copyright 1999 Linus Torvalds
* (C) Copyright 1999 Johannes Erdfelt
* (C) Copyright 1999 Gregory P. Smith
+ * (C) Copyright 2001 Brad Hards ([EMAIL PROTECTED])
+ *
*/
#include <linux/config.h>
@@ -51,6 +53,7 @@
}
#endif
+/* USB 2.0 spec Section 11.24.4.5 */
static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size)
{
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
@@ -58,24 +61,38 @@
USB_DT_HUB << 8, 0, data, size, HZ);
}
+/*
+ * USB 2.0 spec Section 11.24.2.1
+ */
static int usb_clear_hub_feature(struct usb_device *dev, int feature)
{
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_CLEAR_FEATURE, USB_RT_HUB, feature, 0, NULL, 0, HZ);
}
+/*
+ * USB 2.0 spec Section 11.24.2.2
+ * BUG: doesn't handle port indicator selector in high byte of wIndex
+ */
static int usb_clear_port_feature(struct usb_device *dev, int port, int feature)
{
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ);
}
+/*
+ * USB 2.0 spec Section 11.24.2.13
+ * BUG: doesn't handle port indicator selector in high byte of wIndex
+ */
static int usb_set_port_feature(struct usb_device *dev, int port, int feature)
{
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ);
}
+/*
+ * USB 2.0 spec Section 11.24.2.6
+ */
static int usb_get_hub_status(struct usb_device *dev, void *data)
{
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
@@ -83,6 +100,9 @@
data, sizeof(struct usb_hub_status), HZ);
}
+/*
+ * USB 2.0 spec Section 11.24.2.7
+ */
static int usb_get_port_status(struct usb_device *dev, int port, void *data)
{
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
@@ -230,7 +250,7 @@
dbg("hub controller current requirement: %dmA",
hub->descriptor->bHubContrCurrent);
for (i = 0; i < dev->maxchild; i++)
- portstr[i] = hub->descriptor->bitmap[((i + 1) / 8)] & (1 << ((i + 1) %
8)) ? 'F' : 'R';
+ portstr[i] = hub->descriptor->DeviceRemovable[((i + 1) / 8)] & (1 <<
+((i + 1) % 8)) ? 'F' : 'R';
portstr[dev->maxchild] = 0;
dbg("port removable status: %s", portstr);
@@ -838,6 +858,7 @@
dbg("usb_hub_thread exiting");
+ unlock_kernel();
complete_and_exit(&khubd_exited, 0);
}
diff --minimal -Nru a/drivers/usb/hub.h b/drivers/usb/hub.h
--- a/drivers/usb/hub.h Tue Oct 9 14:16:55 2001
+++ b/drivers/usb/hub.h Tue Oct 9 14:16:55 2001
@@ -12,12 +12,14 @@
/*
* Hub Class feature numbers
+ * See USB 2.0 spec Table 11-17
*/
#define C_HUB_LOCAL_POWER 0
#define C_HUB_OVER_CURRENT 1
/*
* Port feature numbers
+ * See USB 2.0 spec Table 11-17
*/
#define USB_PORT_FEAT_CONNECTION 0
#define USB_PORT_FEAT_ENABLE 1
@@ -99,7 +101,10 @@
#define HUB_CHANGE_OVERCURRENT 0x0002
-/* Hub descriptor */
+/*
+ * Hub descriptor
+ * See USB 2.0 spec Table 11-13
+ */
struct usb_hub_descriptor {
__u8 bDescLength;
__u8 bDescriptorType;
@@ -107,9 +112,9 @@
__u16 wHubCharacteristics;
__u8 bPwrOn2PwrGood;
__u8 bHubContrCurrent;
- /* DeviceRemovable and PortPwrCtrlMask want to be variable-length
- bitmaps that hold max 256 entries, but for now they're ignored */
- __u8 bitmap[2 * ((USB_MAXCHILDREN + 1 + 7) / 8)];
+ /* add 1 bit for hub status change; round to bytes */
+ __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
+ __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
} __attribute__ ((packed));
struct usb_device;
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel