Re: [PATCH] usb: gadget/legacy/ether: assume saner default power mode

Andreas Bauer
2021-09-17T07:15:47Z

Am Fri, Sep 17, 2021 at 08:28:16AM +0300 schrieb Felipe Balbi:

> Have a look at other commits to get examples of how to write commits for
> upstream. You're missing your Signed-off-by, adding extra unnecessary
> spaces and making your signature show up in the commit log. All of
> these are described in kernel documentation this
> (https://www.kernel.org/doc/html/latest/process/submitting-patches.html)
> is a good starting point.

I apologize, this was my first try at contributing based on what I
observed on this list. Will fix all mentioned points and consult the
documentation before trying again.

> > - .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
> > + .bmAttributes = 0, /* bus powered implied */
> > + .bMaxPower = 250, /* 500mA in 2mA units */
>
> right, your "sane" default now prevents this gadget driver from working
> behind bus powered hubs. Considering that a linux-based device is likely
> to have its own battery, this is not really a sane default.

The linux-based battery-powered device I have here (Android) charges its
battery and is thus bus-powered while in gadget mode.

Are there really a lot of devices that use gadget mode and do NOT draw
power from the USB bus? Honest question, I don't know the answer.

> The default value of "self powered", seems much saner ;-)

It violates USB specification as is for most cases I reckon. It also
maximize functionality when the host does not enforce USB spec which
mostly seems to be the case.

Would a CONFIG option here make sense to differentiate between
bus-powered devices and self-powered ones? This would probably affect
most OTG drivers...

regards,

Andreas