ChangeSet 1.1321, 2003/05/30 10:25:11-07:00, [EMAIL PROTECTED]

[PATCH] USB: fix address assignment after device reset

Until my ambitious project gets going, this patch at least fixes the
problem of assigning a device's new address following a device reset.
The only change needed to David's original suggestion was to handle the
pathway involved in registering root hubs.


 drivers/usb/core/hcd.c |    1 +
 drivers/usb/core/hub.c |    3 +++
 drivers/usb/core/usb.c |    3 ---
 3 files changed, 4 insertions(+), 3 deletions(-)


diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c    Fri May 30 11:34:53 2003
+++ b/drivers/usb/core/hcd.c    Fri May 30 11:34:53 2003
@@ -720,6 +720,7 @@
        int retval;
 
        sprintf (&usb_dev->dev.bus_id[0], "usb%d", usb_dev->bus->busnum);
+       usb_dev->state = USB_STATE_DEFAULT;
        retval = usb_new_device (usb_dev, parent_dev);
        if (retval)
                dev_err (parent_dev, "can't register root hub for %s, %d\n",
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    Fri May 30 11:34:53 2003
+++ b/drivers/usb/core/hub.c    Fri May 30 11:34:53 2003
@@ -737,6 +737,9 @@
                if (status != -1) {
                        usb_clear_port_feature(hub,
                                port + 1, USB_PORT_FEAT_C_RESET);
+                       dev->state = status
+                                       ? USB_STATE_NOTATTACHED
+                                       : USB_STATE_DEFAULT;
                        return status;
                }
 
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c    Fri May 30 11:34:53 2003
+++ b/drivers/usb/core/usb.c    Fri May 30 11:34:53 2003
@@ -1017,9 +1017,6 @@
        /* dma masks come from the controller; readonly, except to hcd */
        dev->dev.dma_mask = parent->dma_mask;
 
-       /* it's not usable yet */
-       dev->state = USB_STATE_DEFAULT;
-
        /* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
         * it's fixed size except for full speed devices.
         */



-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to