alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Martin Koegler <martin.koegler@chello.at>
To: alsa-devel@alsa-project.org
Cc: Martin Koegler <martin.koegler@chello.at>
Subject: [PATCH] Show sequencer sound card numer/PID via aconnect
Date: Sat, 13 Feb 2016 14:42:16 +0100	[thread overview]
Message-ID: <1455370937-501-2-git-send-email-martin@mail.zuhause> (raw)
In-Reply-To: <1455370937-501-1-git-send-email-martin@mail.zuhause>

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 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/seq/aconnect/aconnect.c b/seq/aconnect/aconnect.c
index 8d6cebb..3508e1b 100644
--- a/seq/aconnect/aconnect.c
+++ b/seq/aconnect/aconnect.c
@@ -166,11 +166,19 @@ 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"),
+		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")));
+		int owner = snd_seq_client_info_get_owner(cinfo);
+		if (owner != -1) {
+			if (snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT)
+				printf(",pid=%d", owner);
+			else
+				printf(",card=%d", owner);
+		}
+		printf("]\n");
 	}
 	printf("  %3d '%-16s'\n",
 	       snd_seq_port_info_get_port(pinfo),
-- 
2.6.2

  reply	other threads:[~2016-02-13 13:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-13 13:42 [PATCH] Provide sequencer sound card number / PID via alsa-lib Martin Koegler
2016-02-13 13:42 ` Martin Koegler [this message]
2016-02-13 13:42 ` [PATCH] Provide card number / PID via sequencer client info Martin Koegler
2016-02-15 10:30   ` Takashi Iwai
2016-02-15 10:37     ` Clemens Ladisch
2016-02-15 18:32     ` Martin Koegler
2016-02-15 19:08       ` Takashi Iwai
2016-02-15 21:44         ` Martin Koegler
2016-02-15 22:34           ` Takashi Iwai
2016-02-16  8:03             ` Martin Koegler
2016-02-16  8:41               ` Takashi Iwai
2016-02-16  8:59                 ` Clemens Ladisch
2016-02-16  9:27                   ` Takashi Iwai
2016-02-16 18:21                     ` Martin Koegler
2016-02-17 14:07                       ` Takashi Iwai
2016-02-17 21:30                         ` Martin Koegler
2016-02-15 10:39 ` [PATCH] Provide sequencer sound card number / PID via alsa-lib Clemens Ladisch
  -- strict thread matches above, loose matches on Subject: below --
2016-03-08 22:06 [PATCH] Show sequencer sound card numer/PID via aconnect Martin Koegler
2016-03-09  8:16 ` Takashi Iwai
2016-02-12 18:56 Martin Koegler
2016-02-13 12:30 ` Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455370937-501-2-git-send-email-martin@mail.zuhause \
    --to=martin.koegler@chello.at \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).