Commit Graph

4270 Commits

Author SHA1 Message Date
Jaroslav Kysela
6b72840569 ucm: compound_merge - use snd_config_merge()
It's useful to do the full tree merge (append).

Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/92
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-24 12:14:47 +02:00
Jaroslav Kysela
b623b5dfed conf: snd_config_merge() - substitute non-compound config handles
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-24 12:14:47 +02:00
Jaroslav Kysela
6a944d1b2a conf: snd_config_merge() - merge (concat) correctly arrays
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-24 12:14:45 +02:00
Jaroslav Kysela
e3edbf6e3b conf: return count of items in snd_config_is_array()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-24 09:27:17 +02:00
Jaroslav Kysela
3fd1de5cbe ucm: recognize first '-' character as ignore error for exec/shell
It may be useful to ignore the returned errors (like modprobe etc).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-18 16:37:17 +02:00
Jaroslav Kysela
8eaa03b7c9 conf: print quoted string more wisely
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-18 13:17:13 +02:00
Jaroslav Kysela
0ee4642a69 ucm: cfg-save - allow to save the sub-tree including root keys
The leading '+' in the keys specification add the key prefix
(sub-tree root identification) to the saved configuration.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-18 12:33:43 +02:00
Jaroslav Kysela
225d3aecb6 ucm: libconfig - merge not override items
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-18 11:30:21 +02:00
Jaroslav Kysela
b2b3658fb9 ucm: libconfig parser - fix memory leaks
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-18 11:30:21 +02:00
Jaroslav Kysela
4522e2008f conf: fix snd_config_merge() - merge schema
All child compounds must be traversed and merged.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-18 11:30:15 +02:00
Jaroslav Kysela
d6f9e9f590 control: remap - add no-op when the remapping is not active
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-17 17:03:39 +02:00
Jaroslav Kysela
5e7c507152 ucm: add cfg-save command
Allow to save whole (or partial) local UCM alsa library configuration
to a file.

Syntax (saves key1.key2 sub-tree):

	Sequence [
		cfg-save "/tmp/my-file.conf:key1.key2"
	]

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-17 16:49:46 +02:00
Jaroslav Kysela
f821f09727 ucm: fix memory leak in execute_cset()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-14 12:49:14 +02:00
Jaroslav Kysela
d9658b7509 ucm: parse LibraryConfig also in the toplevel file
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 18:28:20 +02:00
Jaroslav Kysela
ffb401ba22 conf: load the card specific configurations to the config sub-tree
The /var/lib/alsa/card<CARDNO>.conf.d configurations are loaded
to the cards.<CARDNO> tree only (overwrite mode).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 11:04:33 +02:00
Jaroslav Kysela
1aef5a8f8a conf: add snd_config_make_path() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 11:02:41 +02:00
Jaroslav Kysela
3050af4b90 conf: add snd_config_is_empty() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 10:59:47 +02:00
Jaroslav Kysela
da33eda632 pcm: fix open in direct plugins - wrong pointer assignment
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 10:18:27 +02:00
Jaroslav Kysela
15b59a5647 conf: _snd_config_evaluate - remove 'delete compound members' call
With the recent snd_config_substitute() fix, remove the duplicate
code.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-12 12:13:31 +02:00
Jaroslav Kysela
8f236983b6 conf: fix snd_config_substitute() - memory leak
There's an issue with the current code: It says append for compounds,
but it does overwrite without the proper members delete from
the overwritten (destination) compound node.

Don't change the behaviour, just fix the comment and memory leak.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-12 12:09:37 +02:00
Jaroslav Kysela
1a52373fbc conf: fix snd_config_merge() - double free in overwrite mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-12 12:08:49 +02:00
Jaroslav Kysela
414e4a759b ucm: fix regexec() REG_NOMATCH state handling for define regex
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-12 09:53:18 +02:00
Jaroslav Kysela
590df3a5b1 ucm: add exec sequence command
This change renames the original exec command to shell which
is more appropriate. Implement a light version of the exec
command which calls directly the specified executable without
the shell interaction (man 3 system).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-12 08:32:45 +02:00
Jaroslav Kysela
a468505c96 alsa: conf - use card number roots for device redirects
The change device definitions (pcm.front etc.) from the driver
roots (cards.<DRIVER_NAME>) to the card number roots (cards.<CARDNO>).

This will allow us to do custom overrides (like UCM) in
/var/lib/alsa/card<CARDNO>.conf.d.

For dmix and dsnoop default values, use the card ID instead
the card driver name. It's more flexible.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-04 20:51:16 +02:00
Jaroslav Kysela
63f7745be5 conf: extend load_for_all_cards hook (id/value table)
For the per-card configuration, add possibility to define
card number -> card driver link table.

Example:

  cards.0 'cards.USB-Audio'
  cards.1 'cards.USB-Audio'
  cards.2 'cards.HDA-Intel'
  cards.3 'cards.USB-Audio'

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-04 20:27:52 +02:00
Hans de Goede
d00d7a184c mixer: simple - Fix "Capture Volume" and "Capture Switch" being seen as global controls
Fix the "Capture Volume" and "Capture Switch" exceptions no longer
working after commit 86b9c67774 ("mixer: simple - Unify simple_none:
base_len() exception handling") because they were moved to after the
suffix checking, so they would be treated as CTL_GLOBAL_VOLUME resp.
CTL_GLOBAL_SWITCH based on their suffix before the exception check
has a chance to check for a match.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-04 18:21:18 +02:00
Hans de Goede
06543e06e9 ucm: Fix sysw sequence command not working when requesting to ignore errors
When the user requests to ignore sysfs write errors by prefixing
the path with a '-' then we need to skip the '-' when building the
actual path otherwise the write will never work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-04 10:36:22 +02:00
Jaroslav Kysela
6ddba54a07 ucm: fix the local ucm control device name caching
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-23 21:19:34 +02:00
Jaroslav Kysela
3e731ff51e control: remap - don't allow I/O on renamed IDs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-23 21:11:25 +02:00
Jaroslav Kysela
278462583c control: add missing src/conf/ctl/Makefile.am
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-23 13:06:07 +02:00
Jaroslav Kysela
22dfb4bc20 ucm: limit the master config scan to conf.virt.d
The composition of the list of valid UCM cards is a bit
tricky. Scan only ucm2/conf.virt.d tree.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-22 11:47:52 +02:00
Jaroslav Kysela
508506a80c ucm: fixed find-device substitution (non-continuous PCM devices)
The PCM device numbers may be non-continous. Skip them when -ENOENT error
is returned.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-16 14:48:11 +02:00
Jaroslav Kysela
652ddf866f ucm: allow to escape the trailing variable substitution character
Example:

  ${find-device:ctl='hw:0',type=pcm,field=id,regex='USB A{1\\}'}

Unescaped find-device arguments:

  ctl='hw:0',type=pcm,field=id,regex='USB A{1}'

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-16 12:38:29 +02:00
Jaroslav Kysela
ddb0871ec6 ucm: find-device / pcm - the ctl_list may be empty
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-16 10:48:35 +02:00
Jaroslav Kysela
447a676ee5 ucm: add missing uc_mgr_card_close() call to snd_use_case_mgr_open()
Handle the error path correctly.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-15 16:58:29 +02:00
Jaroslav Kysela
02b234a39c ucm: cosmetic code reshuffle in rval_lookup_main()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-15 16:45:12 +02:00
Jaroslav Kysela
1237905559 ucm: fix uc_mgr_has_local_config()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-15 11:49:32 +02:00
Jaroslav Kysela
8e097fd14a ucm: rewrite device value only when the local config exists
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-15 11:38:39 +02:00
asavah
e4aed044f9 utils/alsa.m4: another quick fix for the brackets
BugLink: https://github.com/alsa-project/alsa-lib/pull/133
From: asavah <asavah@avh.od.ua>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-14 08:08:43 +02:00
Jaroslav Kysela
f9ace404fd utils/alsa.m4: a quick fix for missing end brackets
Fixes: c6e0f24e ("utils/alsa.m4: update for newer autoconf.")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 20:30:20 +02:00
Jaroslav Kysela
8f2b64f0d7 conf: usb - correct 'SB Omni Surround 5.1' iec958 device
BugLink: https://github.com/alsa-project/alsa-lib/issues/101
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 19:58:04 +02:00
Jaroslav Kysela
c71bb0fb39 test: audio_time - fix timestamp2ns() and usage()
BugLink: https://github.com/alsa-project/alsa-lib/issues/132
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 19:49:48 +02:00
Ozkan Sezer
c6e0f24ef9 utils/alsa.m4: update for newer autoconf.
fixes autoconf-2.70 warnings. should be compatible down to autoconf-2.59.

BugLink: https://github.com/alsa-project/alsa-lib/pull/106
Signed-off-by: Ozkan Sezer <sezeroz@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 19:45:33 +02:00
Jaroslav Kysela
c83ddd8e56 ucm: return error if fixedboot_list is empty
The application should know, that there is no special
initialization sequence. It's counterpart for
"ucm: return error if boot_list is empty".

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 19:13:20 +02:00
Hui Wang
2368a95b8f ucm: return error if boot_list is empty
If bootlist is empty, that means there is no BootSequence defined
in the ucm for this sound card, let set_boot_user() return error,
then alsactl could have chance to use non-ucm ways to initialize the
sound card.

BugLink: https://github.com/alsa-project/alsa-lib/pull/94
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 19:12:35 +02:00
Hui Wang
64680bb398 conf: USB - add "Cmedia Audio" to USB-Audio.pcm.iec958_device
Otherwise, there will be a "Digital Output(S/PDIF)-Cmedia Audio" from
Gnome UI, but there is no this physical interface on the card.

BugLink: https://github.com/alsa-project/alsa-lib/pull/122
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 19:03:31 +02:00
James
748f844106 Remove non-existent SPDIF output on Dell AE515
The Dell Professional Sound Bar AE515 shows up in GNOME Settings with
a digital output that doesn't physically exist. Add it to the list
to suppress this.

BugLink: https://github.com/alsa-project/alsa-lib/pull/124
From: drjhe
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 19:00:55 +02:00
James
2a7432d995 conf: No SPDIF on Plantronics 3220 headset
The Plantronics Blackwire 3220 Series headset (USB ID 047f:c056) shows up
in GNOME Settings with a non-existent digital output. Add it to the list
to suppress this.

BugLink: https://github.com/alsa-project/alsa-lib/pull/126
From: drjhe
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 18:59:21 +02:00
Jaroslav Kysela
27f4a85a95 pcm: direct - move the direct struct init to _snd_pcm_direct_new()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 18:55:37 +02:00
Vanitha Channaiah
446777c67e pcm: dshare - fix shared memory pointer check
Currently shared memory pointer is initialized to 0 and set to -1
in some, but not in all error paths.
In cleanup path of open the shm pointer is only compared to be non-NULL
before dereferencing it which leads to SEGFAULT in case it was set to -1.

This patch initializes pointer to -1 to have a unique identification
for invalid pointer and also checks for pointer being not -1 on
access in cleanup path.

Signed-off-by: Vanitha Channaiah <vanitha.channaiah@in.bosch.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 18:21:53 +02:00