@@ -1120,3 +1120,22 @@ ssize_t snd_rawmidi_tread(snd_rawmidi_t *rawmidi, struct timespec *tstamp, void
return -ENOTSUP;
return (rawmidi->ops->tread)(rawmidi, tstamp, buffer, size);
}
+
+#ifndef DOXYGEN
+/*
+ * internal API functions for obtaining UMP info from rawmidi instance
+ */
+int _snd_rawmidi_ump_endpoint_info(snd_rawmidi_t *rmidi, void *info)
+{
+ if (!rmidi->ops->ump_endpoint_info)
+ return -ENXIO;
+ return rmidi->ops->ump_endpoint_info(rmidi, info);
+}
+
+int _snd_rawmidi_ump_block_info(snd_rawmidi_t *rmidi, void *info)
+{
+ if (!rmidi->ops->ump_block_info)
+ return -ENXIO;
+ return rmidi->ops->ump_block_info(rmidi, info);
+}
+#endif /* DOXYGEN */
@@ -272,6 +272,28 @@ static ssize_t snd_rawmidi_hw_tread(snd_rawmidi_t *rmidi, struct timespec *tstam
return ret + result;
}
+static int snd_rawmidi_hw_ump_endpoint_info(snd_rawmidi_t *rmidi, void *buf)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+
+ if (rmidi->version < SNDRV_PROTOCOL_VERSION(2, 0, 3))
+ return -ENXIO;
+ if (ioctl(hw->fd, SNDRV_UMP_IOCTL_ENDPOINT_INFO, buf) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_rawmidi_hw_ump_block_info(snd_rawmidi_t *rmidi, void *buf)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+
+ if (rmidi->version < SNDRV_PROTOCOL_VERSION(2, 0, 3))
+ return -ENXIO;
+ if (ioctl(hw->fd, SNDRV_UMP_IOCTL_BLOCK_INFO, buf) < 0)
+ return -errno;
+ return 0;
+}
+
static const snd_rawmidi_ops_t snd_rawmidi_hw_ops = {
.close = snd_rawmidi_hw_close,
.nonblock = snd_rawmidi_hw_nonblock,
@@ -282,7 +304,9 @@ static const snd_rawmidi_ops_t snd_rawmidi_hw_ops = {
.drain = snd_rawmidi_hw_drain,
.write = snd_rawmidi_hw_write,
.read = snd_rawmidi_hw_read,
- .tread = snd_rawmidi_hw_tread
+ .tread = snd_rawmidi_hw_tread,
+ .ump_endpoint_info = snd_rawmidi_hw_ump_endpoint_info,
+ .ump_block_info = snd_rawmidi_hw_ump_block_info,
};
@@ -35,6 +35,8 @@ typedef struct {
ssize_t (*write)(snd_rawmidi_t *rawmidi, const void *buffer, size_t size);
ssize_t (*read)(snd_rawmidi_t *rawmidi, void *buffer, size_t size);
ssize_t (*tread)(snd_rawmidi_t *rawmidi, struct timespec *tstamp, void *buffer, size_t size);
+ int (*ump_endpoint_info)(snd_rawmidi_t *rmidi, void *buf);
+ int (*ump_block_info)(snd_rawmidi_t *rmidi, void *buf);
} snd_rawmidi_ops_t;
struct _snd_rawmidi {
@@ -62,3 +64,6 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
int merge, int mode);
#define snd_rawmidi_conf_generic_id(id) _snd_conf_generic_id(id)
+
+int _snd_rawmidi_ump_endpoint_info(snd_rawmidi_t *rmidi, void *info);
+int _snd_rawmidi_ump_block_info(snd_rawmidi_t *rmidi, void *info);
Just implement internal callbacks for two new ioctls for UMP (ump_endpoint_info and ump_block_info). No public API functions are added yet here. Signed-off-by: Takashi Iwai <tiwai@suse.de> --- src/rawmidi/rawmidi.c | 19 +++++++++++++++++++ src/rawmidi/rawmidi_hw.c | 26 +++++++++++++++++++++++++- src/rawmidi/rawmidi_local.h | 5 +++++ 3 files changed, 49 insertions(+), 1 deletion(-)