diff mbox

[v2,3/3] Show sequencer sound card numer/PID via aconnect

Message ID 1456943188-29600-2-git-send-email-martin@mail.zuhause (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Koegler March 2, 2016, 6:26 p.m. UTC
From: Martin Koegler <martin.koegler@chello.at>

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>
---
 seq/aconnect/aconnect.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Takashi Iwai March 8, 2016, 10 a.m. UTC | #1
On Wed, 02 Mar 2016 19:26:27 +0100,
Martin Koegler wrote:
> 
> From: Martin Koegler <martin.koegler@chello.at>
> 
> 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>

This patch alone would break the build if alsa-utils is built against
the alsa-lib without your patch.  So some check is needed.


Takashi

> ---
>  seq/aconnect/aconnect.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/seq/aconnect/aconnect.c b/seq/aconnect/aconnect.c
> index 8d6cebb..d299f5c 100644
> --- a/seq/aconnect/aconnect.c
> +++ b/seq/aconnect/aconnect.c
> @@ -166,11 +166,22 @@ 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, pid;
> +
> +		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")));
> +
> +		card = snd_seq_client_info_get_card(cinfo);
> +		if (card != -1)
> +			printf(",card=%d", card);
> +
> +		pid = snd_seq_client_info_get_pid(cinfo);
> +		if (pid != -1)
> +			printf(",pid=%d", pid);
> +		printf("]\n");
>  	}
>  	printf("  %3d '%-16s'\n",
>  	       snd_seq_port_info_get_port(pinfo),
> -- 
> 2.1.4
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
diff mbox

Patch

diff --git a/seq/aconnect/aconnect.c b/seq/aconnect/aconnect.c
index 8d6cebb..d299f5c 100644
--- a/seq/aconnect/aconnect.c
+++ b/seq/aconnect/aconnect.c
@@ -166,11 +166,22 @@  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, pid;
+
+		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")));
+
+		card = snd_seq_client_info_get_card(cinfo);
+		if (card != -1)
+			printf(",card=%d", card);
+
+		pid = snd_seq_client_info_get_pid(cinfo);
+		if (pid != -1)
+			printf(",pid=%d", pid);
+		printf("]\n");
 	}
 	printf("  %3d '%-16s'\n",
 	       snd_seq_port_info_get_port(pinfo),