Skip to content

Commit e375b8a

Browse files
committed
ALSA: ump: Add more attributes to UMP EP and FB info
Add a few more fields to snd_ump_endpoint_info and snd_ump_block_info that are added in the new v1.1 spec. Those are filled by the UMP Stream messages. The rawmidi protocol version is bumped to 2.0.4 to indicate those updates. Also, update the proc outputs to show the newly introduced fields. Link: https://lore.kernel.org/r/20230612081054.17200-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 8c15a18 commit e375b8a

2 files changed

Lines changed: 48 additions & 3 deletions

File tree

include/uapi/sound/asound.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ enum {
708708
* Raw MIDI section - /dev/snd/midi??
709709
*/
710710

711-
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3)
711+
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)
712712

713713
enum {
714714
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
@@ -797,7 +797,11 @@ struct snd_ump_endpoint_info {
797797
unsigned int protocol; /* current protocol */
798798
unsigned int num_blocks; /* # of function blocks */
799799
unsigned short version; /* UMP major/minor version */
800-
unsigned short padding[7];
800+
unsigned short family_id; /* MIDI device family ID */
801+
unsigned short model_id; /* MIDI family model ID */
802+
unsigned int manufacturer_id; /* MIDI manufacturer ID */
803+
unsigned char sw_revision[4]; /* software revision */
804+
unsigned short padding;
801805
unsigned char name[128]; /* endpoint name string */
802806
unsigned char product_id[128]; /* unique product id string */
803807
unsigned char reserved[32];
@@ -812,6 +816,12 @@ struct snd_ump_endpoint_info {
812816
#define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0) /* MIDI 1.0 port w/o restrict */
813817
#define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1) /* 31.25Kbps B/W MIDI1 port */
814818

819+
/* UMP block user-interface hint */
820+
#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00
821+
#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01
822+
#define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02
823+
#define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03
824+
815825
/* UMP groups and blocks */
816826
#define SNDRV_UMP_MAX_GROUPS 16
817827
#define SNDRV_UMP_MAX_BLOCKS 32
@@ -825,7 +835,9 @@ struct snd_ump_block_info {
825835
unsigned char active; /* Activeness */
826836
unsigned char first_group; /* first group ID */
827837
unsigned char num_groups; /* number of groups */
828-
unsigned char padding[3];
838+
unsigned char midi_ci_version; /* MIDI-CI support version */
839+
unsigned char sysex8_streams; /* max number of sysex8 streams */
840+
unsigned char ui_hint; /* user interface hint */
829841
unsigned int flags; /* various info flags */
830842
unsigned char name[128]; /* block name string */
831843
unsigned char reserved[32];

sound/core/ump.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,20 @@ static const char *ump_direction_string(int dir)
448448
}
449449
}
450450

451+
static const char *ump_ui_hint_string(int dir)
452+
{
453+
switch (dir) {
454+
case SNDRV_UMP_BLOCK_UI_HINT_RECEIVER:
455+
return "receiver";
456+
case SNDRV_UMP_BLOCK_UI_HINT_SENDER:
457+
return "sender";
458+
case SNDRV_UMP_BLOCK_UI_HINT_BOTH:
459+
return "both";
460+
default:
461+
return "unknown";
462+
}
463+
}
464+
451465
/* Additional proc file output */
452466
static void snd_ump_proc_read(struct snd_info_entry *entry,
453467
struct snd_info_buffer *buffer)
@@ -461,6 +475,17 @@ static void snd_ump_proc_read(struct snd_info_entry *entry,
461475
snd_iprintf(buffer, "UMP Version: 0x%04x\n", ump->info.version);
462476
snd_iprintf(buffer, "Protocol Caps: 0x%08x\n", ump->info.protocol_caps);
463477
snd_iprintf(buffer, "Protocol: 0x%08x\n", ump->info.protocol);
478+
if (ump->info.version) {
479+
snd_iprintf(buffer, "Manufacturer ID: 0x%08x\n",
480+
ump->info.manufacturer_id);
481+
snd_iprintf(buffer, "Family ID: 0x%04x\n", ump->info.family_id);
482+
snd_iprintf(buffer, "Model ID: 0x%04x\n", ump->info.model_id);
483+
snd_iprintf(buffer, "SW Revision: 0x%02x%02x%02x%02x\n",
484+
ump->info.sw_revision[0],
485+
ump->info.sw_revision[1],
486+
ump->info.sw_revision[2],
487+
ump->info.sw_revision[3]);
488+
}
464489
snd_iprintf(buffer, "Num Blocks: %d\n\n", ump->info.num_blocks);
465490

466491
list_for_each_entry(fb, &ump->block_list, list) {
@@ -476,6 +501,14 @@ static void snd_ump_proc_read(struct snd_info_entry *entry,
476501
snd_iprintf(buffer, " Is MIDI1: %s%s\n",
477502
(fb->info.flags & SNDRV_UMP_BLOCK_IS_MIDI1) ? "Yes" : "No",
478503
(fb->info.flags & SNDRV_UMP_BLOCK_IS_LOWSPEED) ? " (Low Speed)" : "");
504+
if (ump->info.version) {
505+
snd_iprintf(buffer, " MIDI-CI Version: %d\n",
506+
fb->info.midi_ci_version);
507+
snd_iprintf(buffer, " Sysex8 Streams: %d\n",
508+
fb->info.sysex8_streams);
509+
snd_iprintf(buffer, " UI Hint: %s\n",
510+
ump_ui_hint_string(fb->info.ui_hint));
511+
}
479512
snd_iprintf(buffer, "\n");
480513
}
481514
}

0 commit comments

Comments
 (0)