On Sat, 27 Dec 2014, Deepak Das wrote:
> Kool, that was my argument with my client. We added a policy to
> tell kernel that user wants to turn off the port . I already modified the
> port
> power policy mechanism by adding following check :-
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -4456,7 +4456,8 @@ static void hub_port_connect_change(struct usb_hub
> *hub, int port1,
> test_bit(port1, hub->removed_bits)) {
>
> /* maybe switch power back on (e.g. root hub was reset) */
> - if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
> + if ((hub->ports[port1 - 1]->port_power_policy ==
> USB_PORT_POWER_ON) &&
> + (wHubCharacteristics & HUB_CHAR_LPSM) < 2
> && !port_is_power_on(hub, portstatus))
> set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
>
> but the issue is that they don't want to use sysfs because they want their
> code to be
> platform independent so they are using libusb.
> I understand and agree with your explaination regarding the power mechanism.
> I think your previous patch where port should be claimed by userspace before
> turning the
> power off is the only way to achieve it. If you agree then I will go ahead
> and make that
> change.
I don't know if it's the _only_ way, but it is one way to do this. Go
ahead and make the change.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html