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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Andreas Bauer <andreas.bauer.nexus@xxxxxxxxx> 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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux