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


Groups > linux.kernel > #1256330

Re: [PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

From Robert Baldyga <r.baldyga@hackerion.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface
Date 2015-10-26 23:40 +0100
Message-ID <qnYAO-5xU-15@gated-at.bofh.it> (permalink)
References <qnThM-2d0-3@gated-at.bofh.it> <qnThN-2d0-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/26/2015 05:55 PM, Felipe F. Tonello wrote:
> This avoids duplication of USB requests for OUT endpoint and
> re-enabling endpoints.
> 
> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
> ---
>  drivers/usb/gadget/function/f_midi.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
> index 0e9cdeb..a617df3 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -323,6 +323,10 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
>  	unsigned i;
>  	int err;
>  
> +	/* We don't care if it is not MIDIStreaming interface */
> +	if (intf != ms_interface_desc.bInterfaceNumber)
> +		return 0;
> +

These global descriptors are overwritten in bind() of each instance of
f_midi, so you have no guarantee that your bInterfaceNumber is correct
for your current instance. Instead you should store value obtained from
usb_interface_id() during bind().

>  	err = f_midi_start_ep(midi, f, midi->in_ep);
>  	if (err)
>  		return err;
> 

Best regards,
Robert

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH v4 0/7] USB MIDI Gadget improvements and bug fixes "Felipe F. Tonello" <eu@felipetonello.com> - 2015-10-26 18:00 +0100
  [PATCH v4 3/7] usb: gadget: define free_ep_req as universal function "Felipe F. Tonello" <eu@felipetonello.com> - 2015-10-26 18:00 +0100
    Re: [PATCH v4 3/7] usb: gadget: define free_ep_req as universal  function Robert Baldyga <r.baldyga@samsung.com> - 2015-10-27 08:00 +0100
      Re: [PATCH v4 3/7] usb: gadget: define free_ep_req as universal  function Felipe Ferreri Tonello <eu@felipetonello.com> - 2015-10-27 10:20 +0100
        Re: [PATCH v4 3/7] usb: gadget: define free_ep_req as universal  function Robert Baldyga <r.baldyga@samsung.com> - 2015-10-27 10:50 +0100
          Re: [PATCH v4 3/7] usb: gadget: define free_ep_req as universal  function Felipe Ferreri Tonello <eu@felipetonello.com> - 2015-10-27 14:00 +0100
  [PATCH v4 6/7] usb: gadget: gmidi: Cleanup legacy code "Felipe F. Tonello" <eu@felipetonello.com> - 2015-10-26 18:00 +0100
  [PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface "Felipe F. Tonello" <eu@felipetonello.com> - 2015-10-26 18:00 +0100
    Re: [PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for  MIDIStreaming interface Robert Baldyga <r.baldyga@hackerion.com> - 2015-10-26 23:40 +0100
      Re: [PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for  MIDIStreaming interface Felipe Tonello <eu@felipetonello.com> - 2015-10-27 00:00 +0100
        Re: [PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for  MIDIStreaming interface Robert Baldyga <r.baldyga@samsung.com> - 2015-10-27 07:50 +0100
          Re: [PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for  MIDIStreaming interface Felipe Ferreri Tonello <eu@felipetonello.com> - 2015-10-27 10:20 +0100
  Re: [PATCH v4 0/7] USB MIDI Gadget improvements and bug fixes Felipe Ferreri Tonello <eu@felipetonello.com> - 2015-10-27 15:20 +0100

csiph-web