From patchwork Wed May 2 06:08:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 10374975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 767A460384 for ; Wed, 2 May 2018 06:08:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64F672897E for ; Wed, 2 May 2018 06:08:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55E772898E; Wed, 2 May 2018 06:08:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 606DD2897E for ; Wed, 2 May 2018 06:08:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5C23A2675EE; Wed, 2 May 2018 08:08:20 +0200 (CEST) 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 96E0C2675FA; Wed, 2 May 2018 08:08:18 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id 54AEB2673A6 for ; Wed, 2 May 2018 08:08:16 +0200 (CEST) Received: from [125.35.49.90] (helo=hwang4-Lenovo-V480c.bluefin) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fDkw1-0002rS-P8; Wed, 02 May 2018 06:08:14 +0000 From: Hui Wang To: tiwai@suse.de Date: Wed, 2 May 2018 14:08:05 +0800 Message-Id: <1525241286-16498-1-git-send-email-hui.wang@canonical.com> X-Mailer: git-send-email 2.7.4 Cc: hui.wang@canonical.com, alsa-devel@alsa-project.org Subject: [alsa-devel] [alsa-lib][PATCH 1/2] ucm: adding the folder of card_long_name when finding verb conf file 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 The board configuration file and verb conf file are allowed to be in the folder named of card_long_name, so when finding the verb conf file, we need to check if it is in the folder of card_long_name or card_name. Signed-off-by: Hui Wang --- src/ucm/parser.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ucm/parser.c b/src/ucm/parser.c index 2d76152..219edb9 100644 --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -1056,6 +1056,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, char filename[MAX_FILE]; char *env = getenv(ALSA_CONFIG_UCM_VAR); int err; + char *folder_name; /* allocate verb */ verb = calloc(1, sizeof(struct use_case_verb)); @@ -1082,12 +1083,17 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, } /* open Verb file for reading */ + if (!strncmp(uc_mgr->conf_file_name, uc_mgr->card_long_name, MAX_CARD_LONG_NAME)) + folder_name = uc_mgr->card_long_name; + else + folder_name = uc_mgr->card_name; + if (env) snprintf(filename, sizeof(filename), "%s/%s/%s", - env, uc_mgr->card_name, file); + env, folder_name, file); else snprintf(filename, sizeof(filename), "%s/ucm/%s/%s", - snd_config_topdir(), uc_mgr->card_name, file); + snd_config_topdir(), folder_name, file); filename[sizeof(filename)-1] = '\0'; err = uc_mgr_config_load(filename, &cfg);