From patchwork Tue Mar 8 22:06:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Koegler X-Patchwork-Id: 8543811 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D92309F38C for ; Wed, 9 Mar 2016 07:58:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 615ED20204 for ; Wed, 9 Mar 2016 07:58:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 852E5201BC for ; Wed, 9 Mar 2016 07:58:08 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4D4462606F5; Wed, 9 Mar 2016 08:58:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 918F7260524; Wed, 9 Mar 2016 08:57:58 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8BFBC260541; Wed, 9 Mar 2016 08:57:57 +0100 (CET) Received: from vie01a-dmta-pe04-1.mx.upcmail.net (vie01a-dmta-pe04-1.mx.upcmail.net [62.179.121.163]) by alsa0.perex.cz (Postfix) with ESMTP id DF5EC260515 for ; Wed, 9 Mar 2016 08:57:51 +0100 (CET) Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.72) (envelope-from ) id 1adZ0B-0003Qa-GN for alsa-devel@alsa-project.org; Wed, 09 Mar 2016 08:57:51 +0100 Received: from master.zuhause ([80.108.242.240]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id Tjxp1s00t5BuuEg01jxrtW; Wed, 09 Mar 2016 08:57:51 +0100 X-SourceIP: 80.108.242.240 Received: by master.zuhause (Postfix, from userid 1006) id 3B4D050A818D; Tue, 8 Mar 2016 23:06:48 +0100 (CET) From: Martin Koegler To: alsa-devel@alsa-project.org Date: Tue, 8 Mar 2016 23:06:47 +0100 Message-Id: <1457474807-10240-1-git-send-email-martin@mail.zuhause> X-Mailer: git-send-email 2.1.4 Cc: Martin Koegler Subject: [alsa-devel] [PATCH] Show sequencer sound card numer/PID via aconnect X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Koegler 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 --- configure.ac | 9 +++++++++ seq/aconnect/aconnect.c | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bdb133c..9e48190 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) +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") diff --git a/seq/aconnect/aconnect.c b/seq/aconnect/aconnect.c index 8d6cebb..85a7770 100644 --- a/seq/aconnect/aconnect.c +++ b/seq/aconnect/aconnect.c @@ -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),