From: Felipe Ferreri Tonello <eu@felipetonello.com>
To: Felipe Balbi <balbi@kernel.org>, linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Michal Nazarewicz <mina86@mina86.com>,
Clemens Ladisch <clemens@ladisch.de>
Subject: Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes
Date: Mon, 7 Mar 2016 09:40:20 +0000 [thread overview]
Message-ID: <56DD4C84.1090506@felipetonello.com> (raw)
In-Reply-To: <87egbmkah0.fsf@intel.com>
[-- Attachment #1: Type: text/plain, Size: 3374 bytes --]
Hi Balbi,
On 07/03/16 07:34, Felipe Balbi wrote:
>
> Hi,
>
> Felipe Ferreri Tonello <eu@felipetonello.com> writes:
>> [ text/plain ]
>> Hi Balbi,
>>
>> On March 4, 2016 7:16:42 AM GMT+00:00, Felipe Balbi <balbi@kernel.org> wrote:
>>>
>>> Hi,
>>>
>>> "Felipe F. Tonello" <eu@felipetonello.com> writes:
>>>> [ text/plain ]
>>>> This gadget uses a bmAttributes and MaxPower that requires the USB
>>> bus to be
>>>> powered from the host, which is not correct because this
>>> configuration is device
>>>> specific, not a USB-MIDI requirement.
>>>>
>>>> This patch adds two modules parameters, bmAttributes and MaxPower,
>>> that allows
>>>> the user to set those flags. The default values are what the gadget
>>> used to use
>>>> for backward compatibility.
>>>>
>>>> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
>>>> ---
>>>> drivers/usb/gadget/legacy/gmidi.c | 14 ++++++++++++--
>>>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/usb/gadget/legacy/gmidi.c
>>> b/drivers/usb/gadget/legacy/gmidi.c
>>>> index fc2ac150f5ff..0553435cc360 100644
>>>> --- a/drivers/usb/gadget/legacy/gmidi.c
>>>> +++ b/drivers/usb/gadget/legacy/gmidi.c
>>>> @@ -63,6 +63,14 @@ static unsigned int out_ports = 1;
>>>> module_param(out_ports, uint, S_IRUGO);
>>>> MODULE_PARM_DESC(out_ports, "Number of MIDI output ports");
>>>>
>>>> +static unsigned int bmAttributes = USB_CONFIG_ATT_ONE;
>>>> +module_param(bmAttributes, uint, S_IRUGO);
>>>> +MODULE_PARM_DESC(bmAttributes, "Configuration Descriptor's
>>> bmAttributes parameter");
>>>> +
>>>> +static unsigned int MaxPower = CONFIG_USB_GADGET_VBUS_DRAW;
>>>> +module_param(MaxPower, uint, S_IRUGO);
>>>> +MODULE_PARM_DESC(MaxPower, "Used to calculate Configuration
>>> Descriptor's bMaxPower parameter");
>>>
>>> you didn't run checkpatch, did you ? Also, are you sure you will need
>>> to
>>> change this by simply reloading the module ? I'm not convinced.
>>
>> Yes I always run checkpatch :)
>
> do you really ? Why do you have a 98-character line, then ?
>
>> What do you mean by reloading the module?
>
> modprobe g_midi MaxPower=4
> modprobe -r g_midi
> modprobe g_midi MaxPower=10
>
> I'm not convinced this is a valid use-case. Specially since you can just
> provide several configurations and let the host choose the one it suits
> it best.
Ok, I will further test it.
>
>>>> @@ -119,8 +127,8 @@ static struct usb_configuration midi_config = {
>>>> .label = "MIDI Gadget",
>>>> .bConfigurationValue = 1,
>>>> /* .iConfiguration = DYNAMIC */
>>>> - .bmAttributes = USB_CONFIG_ATT_ONE,
>>>
>>> nack, nackety nack nack nack :-)
>>>
>>> USB_CONFIG_ATT_ONE *must* always be set. With your module parameter you
>>> give users the oportunity to violate USB spec.
>>
>> You are right. It needs to check the value before it assigns to
>> bmAttributes.
>
> why check ? You can just unconditionally or USB_CONFIG_ATT_ONE. In any
> case, I'm not convinced this is necessary at all.
Right.
This is necessary because this driver is actually wrong in which is
asking for the host to power itself. This is not specified on USB-MIDI
specification, neither makes any sense since this configuration is
device specific.
What is your suggestion to make it configurable? Maybe at compile-time?
I really don't know what is the best solution if this is not something
you like it.
Felipe
[-- Attachment #2: 0x92698E6A.asc --]
[-- Type: application/pgp-keys, Size: 7310 bytes --]
next prev parent reply other threads:[~2016-03-07 9:38 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 19:40 [PATCH 0/5] MIDI USB Gadget improvements Felipe F. Tonello
2016-03-02 19:40 ` [PATCH 1/5] usb: gadget: f_midi: refactor state machine Felipe F. Tonello
2016-03-02 21:09 ` Clemens Ladisch
2016-03-03 8:57 ` Felipe Ferreri Tonello
2016-03-03 11:38 ` Clemens Ladisch
2016-03-03 16:30 ` Felipe Ferreri Tonello
2016-03-04 8:07 ` Clemens Ladisch
2016-03-04 18:39 ` Felipe Ferreri Tonello
2016-03-04 18:43 ` Clemens Ladisch
2016-03-02 19:40 ` [PATCH 2/5] usb: gadget: f_midi: added spinlock on transmit function Felipe F. Tonello
2016-03-04 7:20 ` Felipe Balbi
2016-03-04 18:49 ` Felipe Ferreri Tonello
2016-03-07 7:32 ` Felipe Balbi
2016-03-07 9:28 ` Felipe Ferreri Tonello
2016-03-08 7:37 ` Felipe Balbi
2016-03-08 13:46 ` Felipe Ferreri Tonello
2016-03-08 14:01 ` Felipe Balbi
2016-03-08 15:40 ` Felipe Ferreri Tonello
2016-03-09 7:22 ` Felipe Balbi
2016-03-02 19:40 ` [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe F. Tonello
2016-03-04 7:16 ` Felipe Balbi
2016-03-04 18:46 ` Felipe Ferreri Tonello
2016-03-07 7:34 ` Felipe Balbi
2016-03-07 9:40 ` Felipe Ferreri Tonello [this message]
2016-03-07 10:59 ` Felipe Balbi
2016-03-07 11:13 ` Felipe Ferreri Tonello
2016-03-08 7:43 ` Felipe Balbi
2016-03-08 10:14 ` Krzysztof Opasiak
2016-03-08 10:34 ` Felipe Balbi
2016-03-08 13:54 ` Felipe Ferreri Tonello
2016-03-08 14:04 ` Felipe Balbi
2016-03-08 14:15 ` Krzysztof Opasiak
2016-03-08 14:20 ` Felipe Balbi
2016-03-08 15:24 ` Felipe Ferreri Tonello
2016-03-02 19:40 ` [PATCH 4/5] usb: gadget: f_midi: cleanups and typos fixes Felipe F. Tonello
2016-03-04 7:13 ` Felipe Balbi
2016-03-04 19:17 ` Michal Nazarewicz
2016-03-04 20:17 ` Felipe Ferreri Tonello
2016-03-05 16:28 ` Michal Nazarewicz
2016-03-05 19:39 ` Greg KH
2016-03-05 23:53 ` Felipe Ferreri Tonello
2016-03-06 3:02 ` Greg KH
2016-03-05 23:57 ` Felipe Ferreri Tonello
2016-03-07 7:35 ` Felipe Balbi
2016-03-07 9:32 ` Felipe Ferreri Tonello
2016-03-08 7:44 ` Felipe Balbi
2016-03-02 19:40 ` [PATCH 5/5] usb: gadget: f_midi: updated copyright Felipe F. Tonello
2016-03-04 7:13 ` Felipe Balbi
2016-03-04 18:41 ` Felipe Ferreri Tonello
2016-03-07 7:36 ` Felipe Balbi
2016-03-07 9:23 ` Felipe Ferreri Tonello
2016-03-04 7:11 ` [PATCH 0/5] MIDI USB Gadget improvements Felipe Balbi
2016-03-04 18:43 ` Felipe Ferreri Tonello
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=56DD4C84.1090506@felipetonello.com \
--to=eu@felipetonello.com \
--cc=balbi@kernel.org \
--cc=clemens@ladisch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mina86@mina86.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox