Commit graph

4143 commits

Author SHA1 Message Date
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
Jaroslav Kysela
d18ebb79d7 include: fix SND_LIB_VER() macro
Fixes: c132509a ("include: add SND_LIB_VER() macro")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 18:01:09 +02:00
Jaroslav Kysela
f93a28730a ucm: ucm_filename() - avoid double //
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 17:20:01 +02:00
Jaroslav Kysela
7e4390137a ucm: handle better the system() call
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 17:14:30 +02:00
Jaroslav Kysela
8f5779eb3f ucm: add LibraryConfig support
This commit allows to define private alsa-lib's configuration. When
the configuration is present, the device values ("PlaybackCTL",
"CaptureCTL", "PlaybackMixer", "CaptureMixer", "CapturePCM")
are prefixed with '_ucmHEXA.' string where HEXA is replaced by the
unique hexadecimal number identifying the opened ucm manager handle.

    Syntax 4

    LibraryConfig.a_label.SubstiConfig {
            # substituted library configuration like:
            usr_share_dir "${ConfLibDir}"
    }

    LibraryConfig.b_label.Config {
            # non-substituted library configuration like:
            usr_share_dir "/usr/share/alsa"
    }

    The File counterparts:

    LibraryConfig.c_label.SubstiFile "/some/path"
    LibraryConfig.d_label.File "/some/path"

Note that for files the contents is substituted on the request,
but the file name is always substituted (useful for ${ConfDir} etc.).

The private configuration is not saved or preserved. It's life time
belongs to the opened ucm manager handle.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 17:14:28 +02:00
Jaroslav Kysela
3e0140088c output: Add snd_output_buffer_steal() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
4870358b2f conf: add snd_config_merge() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
62a51c1da1 ucm: add ${ConfLibDir} substitution
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
bb6bf8d22d conf: add /var/lib/alsa/conf.d directory lookup
It may be handy to put the configurations or symlinks
to the global runtime directory.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:00 +02:00
Jaroslav Kysela
2e4aee23b9 conf: add /var/lib/alsa/card<NUMBER>.conf.d directory lookups
It may be handy to put extra configurations or symlinks to
the global runtime directory. The configurations may be
created at boot / hotplug event by udev or other scripts.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:18:56 +02:00
Jaroslav Kysela
619cf45cb9 conf: extend hook load_for_all_cards
Pass also card integer number.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:25:23 +02:00
Jaroslav Kysela
c132509a86 include: add SND_LIB_VER() macro
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:25:15 +02:00
Jaroslav Kysela
42fe3e40ff conf: make ctl.default and sysdefault devices more universal
It may be handy to add hw specific configs.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:44 +02:00
Jaroslav Kysela
adce5f7b65 control: add empty plugin
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:20 +02:00
Jaroslav Kysela
493a41bcad control: remap plugin - add docs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:09 +02:00
Jaroslav Kysela
7371ac9aad control: doc - create controls plugin page
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:05 +02:00
Jaroslav Kysela
a64391a428 control: remap plugin - initial version
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:22:50 +02:00
Jaroslav Kysela
7db7e18bbb control: add _snd_ctl_open_child()
To support internal plugins, add internal _snd_ctl_open_child()
function like _snd_pcm_open_slave().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:22:45 +02:00
Jaroslav Kysela
bb646ecb47 pcm: empty plugin - fix the docs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:22:34 +02:00
Jaroslav Kysela
10e2490023 control: shm - add missing continue to _snd_ctl_shm_open()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-29 11:41:26 +02:00
Jaroslav Kysela
3cfbacdc34 ucm: add ctl-remove sequence command to delete controls from UCM
Syntax:

   ctl-remove "name='ABCD'"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-29 11:31:08 +02:00
Jaroslav Kysela
02423dc970 ucm: add cset-new sequence command to create new controls from UCM
This command create a new control using ID, description and value.

Syntax:

    cset-new "name='ABCD',index=2 type=boolean,count=2 on,on"
    cset-new "name='Enum' type=enum,labels='L1;L2;L3' 'L2'"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-29 11:00:25 +02:00
Jaroslav Kysela
b0b9e4b88d ucm: move __snd_ctl_ascii_elem_id_parse prototype to control_local.h
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-25 20:40:22 +01:00
Jaroslav Kysela
03cb988179 control: add __snd_ctl_add_elem_set() helper
It simplifies the add_elem_set functions and we need it for UCM.
It's an internal function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-25 20:36:39 +01:00
Jaroslav Kysela
83e4c1ab77 control: add snd_ctl_elem_id_compare_numid() function
Idea for the function prototype by Takashi Sakamoto.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:48:30 +01:00
Jaroslav Kysela
6f4b96ecc9 control: rename snd_ctl_elem_id_compare() to snd_ctl_elem_id_compare_set()
- add asserts to check if the unsigned integers are in the valid range
- replace tuple with set in the id description
- add const prefix for id1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:31:30 +01:00
Jaroslav Kysela
2f57b404b1 ucm: add Path condition type
Check for a file presence and mode.

Modes: exists, read, write, exec

Example:

	If.0 {
		Condition {
			Type Path
			Mode read
			Path "/etc/alsa/something"
			True {
				...
			}
		}
	}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:16:14 +01:00
Jaroslav Kysela
0afa61e8f0 ucm: rename sysset to sysw
Fixes: 1c6fb202 ("ucm: implement sysset sequence command")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 11:40:30 +01:00