All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Jiang <scott.jiang.linux@gmail.com>
To: Takashi Iwai <tiwai@suse.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: uclinux-dist-devel@blackfin.uclinux.org,
	alsa-devel@alsa-project.org,
	Scott Jiang <scott.jiang.linux@gmail.com>
Subject: [PATCH] alsa-lib: if card driver name is empty string, use card name instead
Date: Tue, 20 Sep 2011 13:15:44 -0400	[thread overview]
Message-ID: <1316538944-31853-1-git-send-email-scott.jiang.linux@gmail.com> (raw)

Some drivers don't have a card driver name, but they have a nice card name containing enough info.
So we can use card name to search card config if we found driver name is not valid.

Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
---
 src/confmisc.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/confmisc.c b/src/confmisc.c
index 80b0027..3c4b5aa 100644
--- a/src/confmisc.c
+++ b/src/confmisc.c
@@ -666,6 +666,7 @@ int snd_determine_driver(int card, char **driver)
 	snd_ctl_t *ctl = NULL;
 	snd_ctl_card_info_t *info;
 	char *res = NULL;
+	const char *name = NULL;
 	int err;
 
 	assert(card >= 0 && card <= 32);
@@ -680,7 +681,12 @@ int snd_determine_driver(int card, char **driver)
 		SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
 		goto __error;
 	}
-	res = strdup(snd_ctl_card_info_get_driver(info));
+	name = snd_ctl_card_info_get_driver(info);
+	/* if card driver name is empty string, try to use card name */
+	if (name[0] == '\0')
+		name = snd_ctl_card_info_get_name(info);
+
+	res = strdup(name);
 	if (res == NULL)
 		err = -ENOMEM;
 	else {
-- 
1.7.0.4

             reply	other threads:[~2011-09-20  5:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20 17:15 Scott Jiang [this message]
2011-09-20  6:24 ` [PATCH] alsa-lib: if card driver name is empty string, use card name instead Takashi Iwai
2011-09-20  6:37   ` Scott Jiang
2011-09-20  6:39     ` Takashi Iwai
2011-09-20  6:55       ` Scott Jiang
2011-09-20  7:12         ` Takashi Iwai
2011-09-20 10:03           ` Mark Brown
2011-09-20 10:36             ` Scott Jiang
2011-09-20 10:53               ` Mark Brown
2011-09-20 10:14   ` Mark Brown
2011-09-20 10:33     ` Takashi Iwai
2011-09-20 10:51       ` Mark Brown
2011-09-20 10:58         ` Takashi Iwai

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=1316538944-31853-1-git-send-email-scott.jiang.linux@gmail.com \
    --to=scott.jiang.linux@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=tiwai@suse.de \
    --cc=uclinux-dist-devel@blackfin.uclinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.