Commit 228a953e authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

usb: gadget: midi2: Fix the response for FB info with block 0xff

When the block number 0xff is given to Function Block Discovery
message, the device should return the information of all Function
Blocks, but currently the gadget driver treats it as an error.

Implement the proper behavior for the block 0xff instead.

Fixes: 8b645922 ("usb: gadget: Add support for USB MIDI 2.0 function driver")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240717095102.10493-1-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 16d73189
...@@ -642,12 +642,21 @@ static void process_ump_stream_msg(struct f_midi2_ep *ep, const u32 *data) ...@@ -642,12 +642,21 @@ static void process_ump_stream_msg(struct f_midi2_ep *ep, const u32 *data)
if (format) if (format)
return; // invalid return; // invalid
blk = (*data >> 8) & 0xff; blk = (*data >> 8) & 0xff;
if (blk >= ep->num_blks) if (blk == 0xff) {
return; /* inquiry for all blocks */
if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO) for (blk = 0; blk < ep->num_blks; blk++) {
reply_ump_stream_fb_info(ep, blk); if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO)
if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME) reply_ump_stream_fb_info(ep, blk);
reply_ump_stream_fb_name(ep, blk); if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME)
reply_ump_stream_fb_name(ep, blk);
}
} else if (blk < ep->num_blks) {
/* only the specified block */
if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO)
reply_ump_stream_fb_info(ep, blk);
if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME)
reply_ump_stream_fb_name(ep, blk);
}
return; return;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment