summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-01-10 18:59:34 +0300
committerTakashi Iwai <tiwai@suse.de>2025-01-12 15:12:20 +0300
commitbdf46443f350dd5d226fd528a5a5954ff762f591 (patch)
treeae3e0c2b0c92a107b02f0f77237a2ab75259055f /sound/core
parent7579790915387396e26041ceafbc07348658edef (diff)
downloadlinux-bdf46443f350dd5d226fd528a5a5954ff762f591.tar.xz
ALSA: rawmidi: Expose the tied device number in info ioctl
The UMP legacy rawmidi is derived from the UMP rawmidi, but currently there is no way to know which device is involved in other side. This patch extends the rawmidi info ioctl to show the tied device number. As default it stores -1, indicating that no tied device. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250110155943.31578-2-tiwai@suse.de
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/rawmidi.c2
-rw-r--r--sound/core/ump.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 348ce1b7725e..858878fe487a 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -635,6 +635,7 @@ static int snd_rawmidi_info(struct snd_rawmidi_substream *substream,
info->subdevices_count = substream->pstr->substream_count;
info->subdevices_avail = (substream->pstr->substream_count -
substream->pstr->substream_opened);
+ info->tied_device = rmidi->tied_device;
return 0;
}
@@ -1834,6 +1835,7 @@ int snd_rawmidi_init(struct snd_rawmidi *rmidi,
INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams);
INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams);
rmidi->info_flags = info_flags;
+ rmidi->tied_device = SNDRV_RAWMIDI_DEVICE_UNKNOWN;
if (id != NULL)
strscpy(rmidi->id, id, sizeof(rmidi->id));
diff --git a/sound/core/ump.c b/sound/core/ump.c
index 9198bff4768c..0bfab84eaafb 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -1314,6 +1314,9 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
ump->legacy_rmidi = rmidi;
update_legacy_names(ump);
+ rmidi->tied_device = ump->core.device;
+ ump->core.tied_device = rmidi->device;
+
ump_dbg(ump, "Created a legacy rawmidi #%d (%s)\n", device, id);
return 0;
}