Commit graph

3873 commits

Author SHA1 Message Date
Jaroslav Kysela
b2a4272ecb snd_dlopen: do not use absolute plugin path for snd_dlopen() calls
In commit b906db19ef, the snd_dlopen()
implements the automatic lookup to the ALSA_PLUGIN_DIR directory.
It is not necessary to add the absolute paths in callers now.

The plugin names are also searched in ld.so.conf paths as the fallback now,
but it should not be a big problem.

BugLink: https://github.com/alsa-project/alsa-lib/issues/34
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-04 19:09:50 +02:00
Jaroslav Kysela
577df365f6 conf: add support for XDG_CONFIG_HOME search path
Include $XDG_CONFIG_HOME/alsa/asoundrc _or_ ~/.config/alsa/asoundrc as
the last user-defined configuration.

BugLink: https://github.com/alsa-project/alsa-lib/issues/49
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-04 17:34:24 +02:00
Jaroslav Kysela
1fa7d670f8 conf: load function (hook) - add OR support
While I was trying to work on XDG_CONFIG_HOME support, I though
that it may be nice to support OR for the file specification.

But then I found that we can already do this via the refer hook.

I commit this change anyway, because the snd_config_hook_load()
function is more clean now.

The OR is implemented with three | characters like:

  "~/.asoundrc|||~/.asoundrc2|||/opt/some/other/path"

(first file found wins)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-04 17:32:47 +02:00
Jaroslav Kysela
4882da2c3e conf: USB-Audio.conf - add another card name for Asus Xonar 5
BugLink: https://github.com/alsa-project/alsa-lib/issues/48
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-04 11:42:38 +02:00
Jaroslav Kysela
0b7f1441bb pcm: return immediately when the state is SETUP in snd_pcm_drain()
We are already in the target state. Do not call the plugin callback.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-03 18:42:36 +02:00
sylvain.bertrand@gmail.com
1b9104b5ff pcm: fix snd_pcm_drain() excluding SETUP state from valid states
once draining is done, the pcm enters the SETUP state, which ought to
be valid for snd_pcm_drain()

signed-off-by: Sylvain BERTRAND <sylvain.bertrand@legeek.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-03 18:41:50 +02:00
Jaroslav Kysela
eee879d381 ucm: implement CardIdByName substitution
The syntax is ${CardIdByName:CARDNAME[#INDEX]}.

The CARDNAME is the ALSA's soundcard name (short form).
The INDEX is the instance (0 = first, 1 = second etc.).

Example: ${CardIdByName:HDA Intel PCH}
(which is identical to ${CardIdByName:HDA Intel PCH#0})

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-03 17:17:11 +02:00
Jaroslav Kysela
f60e0d5fdc ucm: shuffle code in compound_merge()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-02 19:11:22 +02:00
Jaroslav Kysela
becb402165 github actions: ubuntu - fix the non-interactive build
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-02 13:16:55 +02:00
Jaroslav Kysela
3feea064dd ucm: substitute arguments in sequences only for syntax 3+
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 15:20:03 +02:00
Jaroslav Kysela
82d86df37f ucm: substitute RenameDevice and DeleteDevice lists
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 15:13:55 +02:00
Jaroslav Kysela
8d26f25ad3 ucm: substitute Comment in Transition and Device
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 15:04:31 +02:00
Jaroslav Kysela
8d90c4746b ucm: substitute verb name and file field
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:47:08 +02:00
Jaroslav Kysela
df498d89c7 ucm: substitute component sequence string
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:12:12 +02:00
Jaroslav Kysela
991990cdf2 ucm: substitute device strings in the device lists
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:04:13 +02:00
Jaroslav Kysela
529154fe7f ucm: substitute device / modifier names, too
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 13:53:10 +02:00
Jaroslav Kysela
1b0e77909d ucm: implement the toplevel ucm configuration file parser
There is a big issue to validate all possible configuration paths.
Let create ucm2/ucm.conf file which describe the lookups. It may
be also customized later to follow the kernel-side development.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 12:24:46 +02:00
Jaroslav Kysela
61986c02b0 ucm: substitute ${CardNumber}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 11:12:19 +02:00
Jaroslav Kysela
72b35bff02 ucm: substitute ${OpenName}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
690cdab6b4 ucm: Define/DefineRegex is supported in Syntax 3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
a53a104f79 ucm: String condition - implement Empty
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
f688817e2c ucm: handle strict: prefix correctly for the UCM card name
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:32 +02:00
Jaroslav Kysela
efe2469ac3 ucm: substitute also value strings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 15:14:15 +02:00
Jaroslav Kysela
bf83baa8fc ucm: allow to specify the toplevel directory using '/' as first character in File path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
f33e596fa6 ucm: config - change the in-place include evaluation order
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
9c88ead1bb ucm: allow syntax version 3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
04c77aa7f4 ucm: substitute arguments in sequences
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
63c4b49cff ucm: configuration - add DefineRegex
Syntax:

  DefineRegex.VariableName {
    String "something to match"
    Regex "(me)thi(ng)"
  }

Result:

- configuration variable "VariableName" is equal to "mething"
- configuration variable "VariableName1" is equal to "me"
- configuration variable "VariableName2" is equal to "ng"

Notes:

The "Flags" string in the DefineRegex compound may specify
the compilation flags (e = extended, i = ignore case,
s = no substitutes, n = newline). See 'man 3 regex' for
more details.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
ed4567d1c9 ucm: configuration - allow to define the configuration variables
It may be useful for the library files to use the runtime configuration
variables.

Example:

 Define.Var1 "hw:${CardId},2"
 Value.PlaybackPCM "${var:Var1}"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
6cc6024ac5 ucm: config - substitute File string to allow variables in include
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
8a36b43e03 ucm: configuration - substitute ${ConfDir} and ${ConfTopDir}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
3edfebc522 ucm: configuration - implement in-place Include
An example:

	Include {
		File "Inc.conf"
		Before.SectionDevice "Mic"
	}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
14636be4a8 ucm: rename _once command to _boot command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:18 +02:00
Jaroslav Kysela
d05bd80593 ucm: rename SectionOnce to BootSequence
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:07:12 +02:00
Jaroslav Kysela
2d6eff3927 ucm: fix compilation error in set_defaults_user()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-19 10:55:35 +02:00
Jaroslav Kysela
3cab9018cf ucm: fix SectionOnce comment
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-19 08:31:39 +02:00
root
449bf7e191 ucm: initialize mgr->once_list
BugLink: https://github.com/alsa-project/alsa-lib/pull/50

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-16 15:48:35 +02:00
Jaroslav Kysela
0c3776a354 ucm: handle 'set _defaults' command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:32:05 +02:00
Jaroslav Kysela
a570634a22 ucm: handle 'set _once' command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:25:58 +02:00
Jaroslav Kysela
afb5a9cf61 ucm: execute SectionDefaults lately (when the first verb is set)
We need a way to set the SectionOnce at first before SectionDefaults.
It also does not make sense to run SectionDefaults when the API is
used only to query for values or so.

Execute the SectionDefaults commands only when the first verb
is set (before the verb specific commands).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:24:39 +02:00
Jaroslav Kysela
e0da1d2a2a ucm: parse SectionOnce section in the master UCM configuration file
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 16:04:38 +02:00
Takashi Iwai
750a3d9fd8 topology: Add missing ATTRIBUTE_UNUSED
... to shut up the compiler warnings.

Fixes: b6c9afb4f5 ("topology: implement snd_tplg_decode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-11 16:38:27 +02:00
Takashi Iwai
fa2f20b71e pcm: rate: Fix uninitialized variable warning
The recent gcc warning indicates the uninitialized variable commit_err:
  pcm_rate.c:1104:6: warning: ‘commit_err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (commit_err < 0)
         ^

Add a proper initialization to commit_err.

Fixes: 29041c5220 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-11 16:34:05 +02:00
Takashi Iwai
c04d7bbd6c pcm: rate: Fix compile warning wrt bit ops and comparison
We've got a gcc warning:
  pcm_rate.c: In function ‘snd_pcm_rate_drain’:
  pcm_rate.c:1090:19: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
     if (pcm->mode & SND_PCM_NONBLOCK != 0) {
                   ^

Drop the zero comparison for fixing the warning and for simplicity.

Fixes: 29041c5220 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-11 16:33:46 +02:00
Jaroslav Kysela
76c098bf6e ucm: merge the array items from the condition blocks
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-09 21:51:55 +02:00
Jaroslav Kysela
822f0c443b topology: use snd_config_is_array() function
... instead the own array test.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 12:04:41 +02:00
Jaroslav Kysela
0c99c073d3 conf: add snd_config_is_array() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 12:00:42 +02:00
Jaroslav Kysela
05a6effd8d conf: use bool type for the join member in the config structure
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 11:23:38 +02:00
Jaroslav Kysela
ee29d2a0b6 conf: change namehint for pcm.front
It seems that we have regressions for pcm.front (some
applications are using this device also for the default
raw input). Change the description and allow both
directions.

Fixes: https://github.com/alsa-project/alsa-lib/issues/39

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-07 16:39:57 +02:00
Takashi Iwai
bb43546c7a header: Fix build error with old kernel headers
Old development environment doesn't necessarily contain the headers
defining __kernel_long_t that is recently used for y2038 timespec
conditional.  Define it explicitly in such a case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 22:40:16 +02:00