Commit graph

4081 commits

Author SHA1 Message Date
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
Takashi Iwai
7bf1dd543b conf: Fix invalid free at parse_args()
The previous fix for memory leaks introduced a few regression.
The major one is the assert hit in the error path reaching with NULL
or uninitialized sub object.  Also, in other code paths, it's possible
that an already released sub object gets freed again.

Fix those bugs by initializing the sub object properly and add a NULL
check before calling snd_config_delete().

Fixes: ad5f255b47 ("conf: fix memory leak on the error path in parse_args()")
Reported-and-tested-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-18 17:43:58 +01:00
Jaroslav Kysela
74422643ee control: fix the subdevice fields comparison in snd_ctl_elem_id_compare() 2021-03-18 12:33:16 +01:00
Jaroslav Kysela
ad5f255b47 conf: fix memory leak on the error path in parse_args()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
56c11293e3 ucm: warn about unknown sequence commands
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
1c6fb20232 ucm: implement sysset sequence command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
2b418648cf ucm: ucm_main.c - cosmetic tab cleanups
This file is problematic for the git's tab checker.
The unexpand tool is used to convert initial spaces
to tabs.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
9c194a0ba7 ucm: add _fboot / FixedBootSequence
Actually, the BootSequence is executed only when the driver controls
(identifiers or value types) are changed. It may be handy to have
also a sequence which is executed at _each_ boot without any condition.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:25:52 +01:00
Jaroslav Kysela
266618088a control: better docs for snd_ctl_elem_id_compare()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-08 15:24:31 +01:00
Jaroslav Kysela
8bd9e7897d conf: snd_config_save() - print arrays as [] not the internal representation
The internal represention of an array is:

{
	0 value1
	1 value2
	2 value2
	...
}

which is identicatal to shorter:

[
	value1
	value2
	value3
]

Always print the short format. It's more optimized and readable.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 21:02:20 +01:00
Jaroslav Kysela
5766e54fbe conf: improve the tabulator level prints
Do not use per char loop, but compose a string.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 20:57:28 +01:00
Jaroslav Kysela
829fbf5065 mixer: simple - use for loop in base_len()
... reduce the code a bit

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 20:28:03 +01:00
Hans de Goede
86b9c67774 mixer: simple - Unify simple_none: base_len() exception handling
Unify simple_none: base_len() exception handling:

1. In the "Input Source" and "3D Control" cases the base-name is the same
   as the full-name and base_len() simply returns strlen(name).
   Instead of returning 0 when the type is unknown, set the type to
   CTL_SINGLE and return strlen(name). This allows removing the special
   case for base_len() returning 0 in simple_event_add().

2. Move the special handling for "Capture Volume" and "Capture Switch"
   from simple_event_add() to base_len(), so that we handle all exceptions
   inside base_len(). Instead of handling some special cases in base_len()
   and other special cases in simple_event_add().

[jk - moved the "Capture Volume" and "Capture Switch" to "Input Source"
exceptions]

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:11:19 +01:00