On 2012年07月23日 23:27, Alan Stern wrote:
On Mon, 23 Jul 2012, Lan Tianyu wrote:

@@ -3027,6 +3070,24 @@ int usb_port_resume(struct usb_device *u
        int             status;
        u16             portchange, portstatus;

+       if (hub->ports[port1 - 1]->port_power_policy == USB_PORT_POWER_AUTO
+                       &&  hub->ports[port1 - 1]->power_state == 
USB_PORT_POWER_STATE_OFF) {
+               set_port_feature(udev->parent, port1, USB_PORT_FEAT_POWER);
+
+               /*
+                * Wait for usb hub port to be reconnected in order to make
+                * the resume procedure successful.
+                */
+               status = usb_port_wait_for_connected(hub, port1);
+               if (status<  0) {
+                       dev_dbg(&udev->dev, "can't get reconnection after setting  
port " \
+                               "power on, status %d\n", status);
+                       return status;
+               }
+               hub->ports[port1 - 1]->power_state = USB_PORT_POWER_STATE_ON;
+               pr_info("%s: port%d connect state on %ld\n", __func__, port1, 
jiffies);
+       }
+
        /* Skip the initial Clear-Suspend step for a remote wakeup */
        status = hub_port_status(hub, port1,&portstatus,&portchange);
        if (status == 0&&  !port_is_suspended(hub, portstatus))

A few lines later the driver does:

        set_bit(port1, hub->busy_bits);

You merely need to move this line up before the point where you turn
port power back on.  Make it the first executable line of the function.

I test and it works. Thanks



Alan Stern


--
Best Regards
Tianyu Lan
linux kernel enabling team
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to