Skip to content

Commit

Permalink
ucm2: add initial alsa library helpers
Browse files Browse the repository at this point in the history
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
perexg committed May 13, 2021
1 parent f801800 commit 548036b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ucm2/lib/card-init.conf
@@ -0,0 +1,10 @@
#
# Manage directory for the card specific configuration
#

Define.LibDir "/var/lib/alsa/card${CardNumber}.conf.d"

FixedBootSequence [
exec "/bin/rm -rf ${var:LibDir}/"

This comment has been minimized.

Copy link
@MarijnS95

MarijnS95 May 14, 2021

Contributor

@perexg Such trailing slashes always creep me out. If for whatever reason ${var:LibDir} expands to an empty string, this would call /bin/rm -rf / and only --no-preserve-root would be there to save us. Would this work without trailing /, too? And does it need -f?

This comment has been minimized.

Copy link
@perexg

perexg May 14, 2021

Author Member

Unfortunately, both -rf options should be there to let rm return zero return code (otherwise the ucm sequence will fail early). I removed the trailing slash. It seems that rm -rf without arguments does no-op. Thank you for your comment.

Commit: ba358e8

This comment has been minimized.

Copy link
@MarijnS95

MarijnS95 May 14, 2021

Contributor

Ah, I guess those files are not writable so a -f is in place 👍

exec "/bin/mkdir -p -m 0755 ${var:LibDir}"
]
29 changes: 29 additions & 0 deletions ucm2/lib/generic.conf
@@ -0,0 +1,29 @@
#
# This is generic UCM configuration for alsa-lib
# Only hw devices are exposed to the UCM application
# Users are not allowed to overwrite this configuration
#

LibraryConfig.generic.SubstiConfig {

ctl.hw {
@args [ CARD ]
@args.CARD.type string
type hw
card $CARD
}

pcm.hw {
@args [ CARD DEV SUBDEV ]
@args {
CARD.type string
DEV.type integer
SUBDEV.type integer
}
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}

}

0 comments on commit 548036b

Please sign in to comment.