]> git.alsa-project.org Git - alsa-lib.git/commitdiff
rawmidi: add support for SNDRV_RAWMIDI_IOCTL_USER_PVERSION
authorJaroslav Kysela <perex@perex.cz>
Mon, 4 Oct 2021 15:25:06 +0000 (17:25 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 28 Oct 2021 06:40:20 +0000 (08:40 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
include/sound/uapi/asound.h
src/rawmidi/rawmidi_hw.c

index 9fe3943f5fbb754de52031466114c53d60238528..c3f65e1397f88300e18e61855bb984b78fe47a6e 100644 (file)
@@ -773,6 +773,7 @@ struct snd_rawmidi_status {
 
 #define SNDRV_RAWMIDI_IOCTL_PVERSION   _IOR('W', 0x00, int)
 #define SNDRV_RAWMIDI_IOCTL_INFO       _IOR('W', 0x01, struct snd_rawmidi_info)
+#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
 #define SNDRV_RAWMIDI_IOCTL_PARAMS     _IOWR('W', 0x10, struct snd_rawmidi_params)
 #define SNDRV_RAWMIDI_IOCTL_STATUS     _IOWR('W', 0x20, struct snd_rawmidi_status)
 #define SNDRV_RAWMIDI_IOCTL_DROP       _IOW('W', 0x30, int)
index c6afec10435084bb1d9ed48311be77a883ba81bd..390271a459495076861195073863ed3e32447f54 100644 (file)
@@ -354,6 +354,11 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
                snd_ctl_close(ctl);
                return -SND_ERROR_INCOMPATIBLE_VERSION;
        }
+       if (SNDRV_PROTOCOL_VERSION(2, 0, 2) <= ver) {
+               /* inform the protocol version we're supporting */
+               unsigned int user_ver = SNDRV_RAWMIDI_VERSION;
+               ioctl(fd, SNDRV_RAWMIDI_IOCTL_USER_PVERSION, &user_ver);
+       }
        if (subdevice >= 0) {
                memset(&info, 0, sizeof(info));
                info.stream = outputp ? SNDRV_RAWMIDI_STREAM_OUTPUT : SNDRV_RAWMIDI_STREAM_INPUT;