Re: [RFC PATCH V3 3/3] usb : Add sysfs files to control usb port's power
From: Alan Stern <stern@rowland.harvard.edu>
Date: 2012-06-07 14:24:03
From: Alan Stern <stern@rowland.harvard.edu>
Date: 2012-06-07 14:24:03
On Thu, 7 Jun 2012, Lan Tianyu wrote:
quoted
One more problem -- your implementation of "off" isn't quite right. You need to update hub_power_on() too.How about this?--- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c@@ -861,7 +861,9 @@ static unsigned hub_power_on(struct usb_hub *hub, bool do_delay) dev_dbg(hub->intfdev, "trying to enable port power on " "non-switchable hub\n"); for (port1 = 1; port1 <= hub->descriptor->bNbrPorts; port1++) - set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER); + if (hub->port_data[port1 - 1].port_power_policy + == USB_PORT_POWER_ON) + set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER);
Yes, that's the idea. Alan Stern