Skip to content

Commit 1761f4c

Browse files
committed
ALSA: ump: Fill group names for legacy rawmidi substreams
To make it clearer which legacy substream corresponds to which UMP group, fill the subname field of each substream object with the group number and the endpoint name, e.g. "Group 1 (My Device)". Ideally speaking, we should have some better link information to the derived UMP, but it's another feature extension. Fixes: 0b5288f ("ALSA: ump: Add legacy raw MIDI support") Link: https://lore.kernel.org/r/20230824075108.29958-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 5f11dd9 commit 1761f4c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

sound/core/ump.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,16 @@ static void process_legacy_input(struct snd_ump_endpoint *ump, const u32 *src,
11231123
spin_unlock_irqrestore(&ump->legacy_locks[dir], flags);
11241124
}
11251125

1126+
static void fill_substream_names(struct snd_ump_endpoint *ump,
1127+
struct snd_rawmidi *rmidi, int dir)
1128+
{
1129+
struct snd_rawmidi_substream *s;
1130+
1131+
list_for_each_entry(s, &rmidi->streams[dir].substreams, list)
1132+
snprintf(s->name, sizeof(s->name), "Group %d (%s)",
1133+
s->number + 1, ump->info.name);
1134+
}
1135+
11261136
int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
11271137
char *id, int device)
11281138
{
@@ -1156,6 +1166,11 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
11561166
rmidi->ops = &snd_ump_legacy_ops;
11571167
rmidi->private_data = ump;
11581168
ump->legacy_rmidi = rmidi;
1169+
if (input)
1170+
fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_INPUT);
1171+
if (output)
1172+
fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT);
1173+
11591174
ump_dbg(ump, "Created a legacy rawmidi #%d (%s)\n", device, id);
11601175
return 0;
11611176
}

0 commit comments

Comments
 (0)