On Fri, 23 Jan 2004, Rogério Brito wrote:

> Yes! It seems that this time you hit the nail in the head. I booted my
> system (7 boots in a row, both cold and warm boots) with the new patch
> applied and, for each boot, I plugged the drive and it was promptly
> recognized after I loaded uhci-hcd and usb-storage.
> 
> I think that the probability of this being just sheer luck is so low,
> given the probability of success of it working that I can say that now I
> think that it is working for good with your newest patch. :-)

That's good news.  Here's another patch to try.  It's almost the same as 
the previous one; the only difference is that it turns on power to all the 
ports of the internal hub at the same time.  That's how the regular Linux 
driver works.  I want to see what is the smallest change needed for your 
device to be okay.

> But the patch had a side effect, which I have not yet identified
> completely. It seems that if I plug the drive, without having X started,
> and then start X, my psaux mouse doesn't work.
> 
> It also seems that a cold boot with starting X and *then* loading the
> drive cures the problem, but I am not sure of what I am saying here.

I doubt very much that there is any relation unless you're using a USB 
mouse.  But if you were it wouldn't be psaux, would it?  The mouse trouble 
almost certainly has nothing to do with the patch.

Alan Stern


--- 2.6/drivers/usb/core/hub.c.orig     Tue Jan 20 16:10:29 2004
+++ 2.6/drivers/usb/core/hub.c  Mon Jan 26 11:28:17 2004
@@ -270,13 +270,17 @@
 {
        struct usb_device *dev;
        int i;
+       int ret;
 
        /* Enable power to the ports */
        dev_dbg(hubdev(interface_to_usbdev(hub->intf)),
                "enabling power on all ports\n");
        dev = interface_to_usbdev(hub->intf);
-       for (i = 0; i < hub->descriptor->bNbrPorts; i++)
-               set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
+       for (i = 0; i < hub->descriptor->bNbrPorts; i++) {
+               ret = set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
+               dev_dbg(hubdev(interface_to_usbdev(hub->intf)),
+                       "port %d power on: %d\n", i+1, ret);
+       }
 
        /* Wait for power to be enabled */
        wait_ms(hub->descriptor->bPwrOn2PwrGood * 2);
@@ -452,6 +456,8 @@
        dev_dbg(hub_dev, "%sover-current condition exists\n",
                (hubstatus & HUB_STATUS_OVERCURRENT) ? "" : "no ");
 
+       hub_power_on(hub);
+
        /* Start the interrupt endpoint */
        pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
        maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
@@ -470,6 +476,16 @@
                hub, endpoint->bInterval);
        hub->urb->transfer_dma = hub->buffer_dma;
        hub->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
+       if (hub->descriptor->wHubCharacteristics & HUB_CHAR_COMPOUND) {
+               dev_dbg(hub_dev, "skipping status urb for compound hub\n");
+               spin_lock_irq(&hub_event_lock);
+               list_add(&hub->event_list, &hub_event_list);
+               wake_up(&khubd_wait);
+               spin_unlock_irq(&hub_event_lock);
+               return 0;
+       }
+
        ret = usb_submit_urb(hub->urb, GFP_KERNEL);
        if (ret) {
                message = "couldn't submit status urb";
@@ -477,11 +493,6 @@
        }
        hub->urb_active = 1;
 
-       /* Wake up khubd */
-       wake_up(&khubd_wait);
-
-       hub_power_on(hub);
-
        return 0;
 
 fail:
@@ -741,6 +752,8 @@
 
                /* read and decode port status */
                ret = hub_port_status(hub, port, &portstatus, &portchange);
+               dev_dbg(hubdev(hub), "wait_reset %d, port %d, status %x, change %x\n",
+                               ret, port+1, portstatus, portchange);
                if (ret < 0) {
                        return -1;
                }
@@ -785,7 +798,8 @@
 
        /* Reset the port */
        for (i = 0; i < HUB_RESET_TRIES; i++) {
-               set_port_feature(hub, port + 1, USB_PORT_FEAT_RESET);
+               status = set_port_feature(hub, port + 1, USB_PORT_FEAT_RESET);
+               dev_dbg(hubdev(hub), "port reset = %d\n", status);
 
                /* return on disconnect or reset */
                status = hub_port_wait_reset(hub, port, dev, delay);
@@ -855,6 +869,8 @@
                wait_ms(HUB_DEBOUNCE_STEP);
 
                ret = hub_port_status(hub, port, &portstatus, &portchange);
+               dev_dbg(hubdev(hub), "port_status= %d, port %d status %x change %x\n",
+                       ret, port+1, portstatus, portchange);
                if (ret < 0)
                        return -1;
 
@@ -869,7 +885,8 @@
                connection = portstatus & USB_PORT_STAT_CONNECTION;
 
                if ((portchange & USB_PORT_STAT_C_CONNECTION)) {
-                       clear_port_feature(hub, port+1, USB_PORT_FEAT_C_CONNECTION);
+                       ret = clear_port_feature(hub, port+1, 
USB_PORT_FEAT_C_CONNECTION);
+                       dev_dbg(hubdev(hub), "clear C_CONNECTION2 = %d\n", ret);
                }
        }
 
@@ -893,7 +910,8 @@
                port + 1, portstatus, portchange, portspeed (portstatus));
 
        /* Clear the connection change status */
-       clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION);
+       i = clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION);
+       dev_dbg(&hubstate->intf->dev, "clear C_CONNECTION1 = %d\n", i);
 
        /* Disconnect any existing devices under this port */
        if (hub->children[port])
@@ -1064,6 +1082,8 @@
 
                for (i = 0; i < hub->descriptor->bNbrPorts; i++) {
                        ret = hub_port_status(dev, i, &portstatus, &portchange);
+                       dev_dbg(hubdev(dev),
+                               "initial port %d status: ret = %d\n", i+1, ret);
                        if (ret < 0) {
                                continue;
                        }




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to