[alsa-devel] [PATCH] rawmidi.c Set a name for a newly allocated rawmidi substream

Ralf Beck musical_snake at gmx.de
Wed May 7 19:24:13 CEST 2014

Rationale: Bitwig Studio (and possibly other rawmidi clients) enumerate 
the Midi I/Os by
substream names. With the current rawmidi implementation, the name is an 
empty string
and only the USB mididriver changes it to a meaningful value after 

This patch sets a default substream name of the form "somename x-y-z"

--- linux-source-3.13.0/sound/core/rawmidi.c.orig    2014-05-06 
20:25:33.683081389 +0200
+++ linux-source-3.13.0/sound/core/rawmidi.c    2014-05-06 
17:42:35.058097185 +0200
@@ -34,6 +34,7 @@
  #include <sound/control.h>
  #include <sound/minors.h>
  #include <sound/initval.h>
+#include <linux/string.h>

  MODULE_AUTHOR("Jaroslav Kysela <perex at perex.cz>");
  MODULE_DESCRIPTION("Midlevel RawMidi code for ALSA.");
@@ -1420,6 +1421,8 @@ static int snd_rawmidi_alloc_substreams(
          substream->number = idx;
          substream->rmidi = rmidi;
          substream->pstr = stream;
+            snprintf(substream->name, sizeof(substream->name),
+                 "%s %d-%d-%d", rmidi->id, rmidi->card->number, 
rmidi->device, idx);
          list_add_tail(&substream->list, &stream->substreams);

More information about the Alsa-devel mailing list