]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm2: Separate the configuration lookups (hw based) from the configuration tree
authorJaroslav Kysela <perex@perex.cz>
Wed, 3 Feb 2021 16:13:01 +0000 (17:13 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 11 Feb 2021 19:03:36 +0000 (20:03 +0100)
Introduce ucm2/conf.d/ tree with symlinks to the real hardware configurations.
In this way, we do not rely to create the configuration paths based on
simple driver / device identification, but we can store the configurations
more logically to make the maintenance (code reuse, multiple changes)
more easy.

This commit keeps the older lookup paths active, but they will be
turned off in the next release.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/70
BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/76
BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/78
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/ucm.conf

index 9e78df118f83b4358e18cf57a63f70026aef2fe2..8577c300e46b9f1190cebb245745f18df5ecf76f 100644 (file)
@@ -14,8 +14,9 @@
 Syntax 3
 
 Define.V1 ""           # non-empty string to enable ucm v1 paths
-Define.V2Module yes    # empty string to disable
-Define.V2Name yes      # empty string to disable
+Define.V2ConfD yes     # empty string to disable
+Define.V2Module yes    # non-empty string to enable module name lookups (obsolete)
+Define.V2Name yes      # non-empty string to enable driver & card name lookups (obsolete)
 
 If.driver {
        Condition {
@@ -40,11 +41,40 @@ If.driver {
                #
                # The probed path when hw-card is found:
                #
-               #   ucm2/${KernelModule}/${KernelModule}.conf
-               #   ucm2/${CardDriver}/${CardLongName}.conf
-               #   ucm2/${CardDriver}/${CardDriver}.conf
+               #   ucm2/conf.d/[${CardDriver}|${KernelDriver}]/${CardLongName}.conf
+               #   ucm2/conf.d/[${CardDriver}|${KernelDriver}]/[${CardDriver}|${KernelDriver}].conf
+               #   ucm2/${KernelModule}/${KernelModule}.conf (obsolete)
+               #   ucm2/${CardDriver}/${CardLongName}.conf (obsolete)
+               #   ucm2/${CardDriver}/${CardDriver}.conf (obsolete)
                #
 
+               If.V2ConfD {
+                       Condition {
+                               Type String
+                               Empty "${var:V2ConfD}"
+                       }
+                       False {
+                               Define.Driver "${CardDriver}"
+                               If.nodrv {
+                                       Condition {
+                                               Type String
+                                               Empty "${var:Driver}"
+                                       }
+                                       True.Define {
+                                               KernelDriverPath "class/sound/card${CardNumber}/device/driver"
+                                               Driver "${sys:$KernelDriverPath}"
+                                       }
+                               }
+                               UseCasePath.confd1 {
+                                       Directory "conf.d/${var:Driver}"
+                                       File "${CardLongName}.conf"
+                               }
+                               UseCasePath.confd2 {
+                                       Directory "conf.d/${var:Driver}"
+                                       File "${var:Driver}.conf"
+                               }
+                       }
+               }
                If.V2Module {
                        Condition {
                                Type String