diff options
author | Takashi Iwai <tiwai@suse.de> | 2024-08-07 11:22:58 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2024-08-07 11:31:37 +0200 |
commit | ac3a9185bd5f547cb16ef1388e8786ad5a6e8858 (patch) | |
tree | 40c994133185746a3efb41ea18b097cb50c60b4a /sound/usb | |
parent | b28654233f654cc16134b72751bf371c7bf0ce3a (diff) |
ALSA: usb-audio: Set MIDI1 flag appropriately for GTB MIDI 1.0 entry
When a MIDI 1.0 protocol is specified in a GTB entry while others are
set in MIDI 2.0, it should be seen as a legacy MIDI 1.0 port. Since
recently we allow drivers to set a flag SNDRV_UMP_BLOCK_IS_MIDI1 to a
FB for that purpose. This patch tries to set that flag when the
device shows such a configuration.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807092303.1935-4-tiwai@suse.de
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/midi2.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c index fa655aa4a56f..4fb43d9743d7 100644 --- a/sound/usb/midi2.c +++ b/sound/usb/midi2.c @@ -863,9 +863,23 @@ static int create_gtb_block(struct snd_usb_midi2_ump *rmidi, int dir, int blk) fb->info.flags |= SNDRV_UMP_BLOCK_IS_MIDI1 | SNDRV_UMP_BLOCK_IS_LOWSPEED; + /* if MIDI 2.0 protocol is supported and yet the GTB shows MIDI 1.0, + * treat it as a MIDI 1.0-specific block + */ + if (rmidi->ump->info.protocol_caps & SNDRV_UMP_EP_INFO_PROTO_MIDI2) { + switch (desc->bMIDIProtocol) { + case USB_MS_MIDI_PROTO_1_0_64: + case USB_MS_MIDI_PROTO_1_0_64_JRTS: + case USB_MS_MIDI_PROTO_1_0_128: + case USB_MS_MIDI_PROTO_1_0_128_JRTS: + fb->info.flags |= SNDRV_UMP_BLOCK_IS_MIDI1; + break; + } + } + usb_audio_dbg(umidi->chip, - "Created a UMP block %d from GTB, name=%s\n", - blk, fb->info.name); + "Created a UMP block %d from GTB, name=%s, flags=0x%x\n", + blk, fb->info.name, fb->info.flags); return 0; } |