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

> > Also, don't worry for now about what happens after you unplug the drive.  
> > I'm more interested in the part where you first plug it in.
> 
> Ok. I just plugged and replugged it in the hope that it would be
> identified after replugging.

That's not too likely.  Once you get that initial error, pretty much 
nothing else is going to work.  The internal hub in the drive box has 
failed.


> Well, I tried the patch. The first time I tried it, it worked and I was
> quite happy. I then unplugged the drive and then I inserted it a second
> time, to see if it behaved the same way it did in my old notebook (which
> you may remember that the drive always work there). It unfortunately
> didn't, which led me to think that it was only one of those "statistical
> noises".

It probably was.

> Anyway, I cold booted my system and tried the same process again and,
> this time, it didn't work. Here is the log of the failure and below it
> are the differences between it and the success case.


> hub 1-2:1.0: transfer --> -75
> usb 1-2: control timeout on ep0in
> 
>    Even after seeing the message above, I tried to load usb-storage,
>    just to see what would happen. Well, it obviously didn't work.

Once you start seeing those errors in the log, there's no point in loading 
usb-storage.  It's doomed to fail.

> BTW, I don't have Windows 2000 installed anymore (I needed the space for
> some data), but now I can install it again and if you want any logs from
> Windows 2000, I can surely install it again, if you wish to see another
> batch of logs from Windows 2000.

No, the ones from before are still okay.

Here's another patch.  This one makes the driver behave even more like
Windows, because it doesn't do the status polling during the debounce
period.  In fact, it doesn't do status polling at all for your internal
hub, which makes it unsuited for general use -- it won't even be able to
tell when you unplug the drive.  But if it gets your drive working, I'll
worry about that part later.

Another difference between the Linux and Windows drivers is the length of
the debounce and reset periods; they are longer in Linux.  That really
shouldn't matter, though.

By the way, does your drive require an external power source?  That is, do 
you have to plug it into the wall power before you can use it?  The 
Windows trace says that it uses external power, but the Linux log says 
that the local power source is inactive.  I don't really understand that.

Alan Stern


--- 2.6/drivers/usb/core/hub.c.orig     Tue Jan 20 16:10:29 2004
+++ 2.6/drivers/usb/core/hub.c  Fri Jan 23 10:32:53 2004
@@ -270,13 +270,18 @@
 {
        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_ms(500);
+       }
 
        /* Wait for power to be enabled */
        wait_ms(hub->descriptor->bPwrOn2PwrGood * 2);
@@ -452,6 +457,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 +477,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 +494,6 @@
        }
        hub->urb_active = 1;
 
-       /* Wake up khubd */
-       wake_up(&khubd_wait);
-
-       hub_power_on(hub);
-
        return 0;
 
 fail:
@@ -741,6 +753,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 +799,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 +870,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 +886,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 +911,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 +1083,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