Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1349909

Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes

From Felipe Balbi <balbi@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes
Date 2016-03-04 08:20 +0100
Message-ID <r8SbM-33v-13@gated-at.bofh.it> (permalink)
References <r8kMN-4cl-3@gated-at.bofh.it> <r8kMN-4cl-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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.

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

-- 
balbi

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes "Felipe F. Tonello" <eu@felipetonello.com> - 2016-03-02 20:40 +0100
  Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Balbi <balbi@kernel.org> - 2016-03-04 08:20 +0100
    Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-03-04 19:50 +0100
      Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Balbi <balbi@kernel.org> - 2016-03-07 08:40 +0100
        Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on  bmAttributes Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-03-07 10:40 +0100
          Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Balbi <balbi@kernel.org> - 2016-03-07 12:10 +0100
            Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on  bmAttributes Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-03-07 12:20 +0100
              Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Balbi <balbi@kernel.org> - 2016-03-08 08:50 +0100
                Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on  bmAttributes Krzysztof Opasiak <k.opasiak@samsung.com> - 2016-03-08 11:20 +0100
                Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Balbi <balbi@kernel.org> - 2016-03-08 11:40 +0100
                Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on  bmAttributes Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-03-08 15:00 +0100
                Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Balbi <balbi@kernel.org> - 2016-03-08 15:10 +0100
                Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on  bmAttributes Krzysztof Opasiak <k.opasiak@samsung.com> - 2016-03-08 15:20 +0100
                Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes Felipe Balbi <balbi@kernel.org> - 2016-03-08 15:30 +0100
                Re: [PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on  bmAttributes Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-03-08 16:30 +0100

csiph-web