All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Andreas Bauer <andreas.bauer.nexus@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget/legacy/ether: assume saner default power mode
Date: Fri, 17 Sep 2021 11:29:02 +0300	[thread overview]
Message-ID: <87lf3va9hr.fsf@kernel.org> (raw)
In-Reply-To: <YURAlSpAWT0s9dVr@ws2>


Hi,

Andreas Bauer <andreas.bauer.nexus@gmail.com> writes:
> 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.

No worries :)

>> > -	.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.

that's okay. It's because of this sort of thing that we've switched to a
configfs-based approach where we don't need to make assumptions about
the application. That's also why the pre-composed gadgets have been
moved to the "legacy" directory and we don't take changes to those
anymore, unless it's a bugfix, which $subject doesn't appear to be :)

> 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.

Finding that out is going to be pretty hard, I'm afraid.

>> 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...

We have configfs to cope with all of the possible variations, might want
to give that a shot?

https://www.kernel.org/doc/html/latest/usb/gadget_configfs.html

-- 
balbi

  reply	other threads:[~2021-09-17  8:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 14:56 [PATCH] usb: gadget/legacy/ether: assume saner default power mode Andreas Bauer
2021-09-16 15:36 ` Greg KH
2021-09-17  5:28 ` Felipe Balbi
2021-09-17  7:15   ` Andreas Bauer
2021-09-17  8:29     ` Felipe Balbi [this message]
2021-09-17 17:12       ` Andreas Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf3va9hr.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=andreas.bauer.nexus@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.