From patchwork Wed Jan 18 03:53:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mengdong.lin@linux.intel.com X-Patchwork-Id: 9522845 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 866F3601C3 for ; Wed, 18 Jan 2017 07:56:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76CFC28532 for ; Wed, 18 Jan 2017 07:56:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B44428539; Wed, 18 Jan 2017 07:56:56 +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=-1.9 required=2.0 tests=BAYES_00, 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 974E628532 for ; Wed, 18 Jan 2017 07:56:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D34D2267ABD; Wed, 18 Jan 2017 08:56:51 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 868CC267AB9; Wed, 18 Jan 2017 08:54:33 +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 586E7266C0E; Wed, 18 Jan 2017 04:50:27 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 2695F266BF5 for ; Wed, 18 Jan 2017 04:50:23 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 17 Jan 2017 19:50:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.33,247,1477983600"; d="scan'208"; a="1084261681" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.21]) by orsmga001.jf.intel.com with ESMTP; 17 Jan 2017 19:50:21 -0800 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org Date: Wed, 18 Jan 2017 11:53:42 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com, Mengdong Lin , mengdong.lin@intel.com Subject: [alsa-devel] [PATCH v6 3/3] ucm: Add command 'get _file' to get the config file name of the opened card 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: Mengdong Lin After opening a card, this command can show the name of the actually loaded configuration file, either matches the card name or card long name. So developers can check if there is a device-sepcific configuration file available for a given card. Signed-off-by: Mengdong Lin diff --git a/include/use-case.h b/include/use-case.h index 8911645..ae22bde 100644 --- a/include/use-case.h +++ b/include/use-case.h @@ -230,6 +230,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, * Known identifiers: * - NULL - return current card * - _verb - return current verb + * - _file - return configuration file loaded for current card * * - [=]{NAME}[/[{modifier}|{/device}][/{verb}]] * - value identifier {NAME} diff --git a/src/ucm/main.c b/src/ucm/main.c index 38a5e81..2d33886 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -1528,6 +1528,20 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, goto __end; } err = 0; + } else if (strcmp(identifier, "_file") == 0) { + /* get the conf file name of the opened card */ + if ((uc_mgr->card_name == NULL) + || (uc_mgr->conf_file_name[0] == '\0')) { + err = -ENOENT; + goto __end; + } + *value = strndup(uc_mgr->conf_file_name, MAX_FILE); + if (*value == NULL) { + err = -ENOMEM; + goto __end; + } + err = 0; + } else if (identifier[0] == '_') { err = -ENOENT; goto __end;