]> git.alsa-project.org Git - alsa-utils.git/commitdiff
aconnect: Show sequencer sound card numer/PID via aconnect
authorMartin Koegler <martin.koegler@chello.at>
Tue, 8 Mar 2016 22:06:47 +0000 (23:06 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 9 Mar 2016 08:15:43 +0000 (09:15 +0100)
rawmidi devices expose the card number via IOCTLs, which allows to
find the corresponding device in sysfs.

The sequencer provides no identifing data. Chromium works around this
issue by scanning rawmidi as well as sequencer devices and matching
them by using assumtions, how the kernel register sequencer devices.

This patch adds support for displaying the sound card number/PID to
aconnect.

Signed-off-by: Martin Koegler <martin.koegler@chello.at>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
configure.ac
seq/aconnect/aconnect.c

index bdb133ce1a81686eaea268b385f729382db2aa96..9e48190fe42d886137da7e903fd45acdf3e88ed6 100644 (file)
@@ -41,6 +41,15 @@ AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"],
 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
   [#include <samplerate.h>])
 
+AC_CHECK_LIB([asound], [snd_seq_client_info_get_card], [HAVE_SEQ_CLIENT_INFO_GET_CARD="yes"])
+if test "$HAVE_SEQ_CLIENT_INFO_GET_CARD" = "yes" ; then
+    AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_CARD], 1, [alsa-lib supports snd_seq_client_info_get_card])
+fi
+AC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_PID="yes"])
+if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then
+    AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid])
+fi
+
 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
index 8d6cebbc7b0c4f0d92c8a80ec74623ed6784cfb3..85a7770156aa4ab431553a1a05368d6304cc0487 100644 (file)
@@ -166,11 +166,26 @@ static void print_port(snd_seq_t *seq, snd_seq_client_info_t *cinfo,
                       snd_seq_port_info_t *pinfo, int count)
 {
        if (! count) {
-               printf(_("client %d: '%s' [type=%s]\n"),
+               int card = -1, pid = -1;
+
+               printf(_("client %d: '%s' [type=%s"),
                       snd_seq_client_info_get_client(cinfo),
                       snd_seq_client_info_get_name(cinfo),
                       (snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ?
                        _("user") : _("kernel")));
+
+#ifdef HAVE_SEQ_CLIENT_INFO_GET_CARD
+               card = snd_seq_client_info_get_card(cinfo);
+#endif
+               if (card != -1)
+                       printf(",card=%d", card);
+
+#ifdef HAVE_SEQ_CLIENT_INFO_GET_PID
+               pid = snd_seq_client_info_get_pid(cinfo);
+#endif
+               if (pid != -1)
+                       printf(",pid=%d", pid);
+               printf("]\n");
        }
        printf("  %3d '%-16s'\n",
               snd_seq_port_info_get_port(pinfo),