Skip to content

Commit

Permalink
usb: gadget: f_midi: set altsettings only for MIDIStreaming interface
Browse files Browse the repository at this point in the history
This avoids duplication of USB requests for OUT endpoint and
re-enabling endpoints.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Felipe F. Tonello authored and Felipe Balbi committed Dec 16, 2015
1 parent 03e4352 commit 919de44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/usb/gadget/function/f_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct f_midi {
struct usb_ep *in_ep, *out_ep;
struct snd_card *card;
struct snd_rawmidi *rmidi;
u8 ms_id;

struct snd_rawmidi_substream *in_substream[MAX_PORTS];
struct snd_rawmidi_substream *out_substream[MAX_PORTS];
Expand Down Expand Up @@ -321,8 +322,8 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
unsigned i;
int err;

/* For Control Device interface we do nothing */
if (intf == 0)
/* we only set alt for MIDIStreaming interface */
if (intf != midi->ms_id)
return 0;

err = f_midi_start_ep(midi, f, midi->in_ep);
Expand Down Expand Up @@ -730,6 +731,7 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
goto fail;
ms_interface_desc.bInterfaceNumber = status;
ac_header_desc.baInterfaceNr[0] = status;
midi->ms_id = status;

status = -ENODEV;

Expand Down

0 comments on commit 919de44

Please sign in to comment.