Commit graph

38 commits

Author SHA1 Message Date
Tianyi Liu
edff9652c0 misc: fix incorrect usages of strerror
`strerror` takes the `errno` directly as its argument,
negating it will result in an "Unknown error".

This fixes such usages across multiple modules.

Fixes: https://github.com/alsa-project/alsa-utils/pull/245
Signed-off-by: Tianyi Liu <i.pear@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-08 20:01:04 +01:00
Jaroslav Kysela
9e5e9a6d70 alsaucm: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: d7bbc26 ("alsaucm: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 16:59:01 +02:00
Jaroslav Kysela
d7bbc26d6e alsaucm: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 15:42:24 +02:00
Jay-716
17615de014 alsaucm: fix typo in docs (can can)
Fixes: https://github.com/alsa-project/alsa-utils/pull/191
Signed-off-by: Jay-716 <13422525511@163.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-02-27 13:08:50 +01:00
Jaroslav Kysela
58f92d6175 alsaucm: add also card index for '-c' argument
Make semantics for this argument in sync with other ALSA utilities.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-02-27 12:56:17 +01:00
Amadeusz Sławiński
4b959a447a aplay: Fix for arecord recording ghost data
When recording we should only write the amount of data read to output
file instead of copying whole buffer. This fixes glitches appearing at
the end of recorded file, when stopping recording.

Fixes: https://github.com/alsa-project/alsa-utils/pull/150
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 14:09:29 +02:00
Ranjani Sridharan
90f5967178 topology: pre-processor: Move the call to expand variables
Remove the call to snd_config_expand_custom() to expand the top-level
input config. And replace it with calls to snd_config_evaluate_string()
for each non-compound config while processing individual objects. This
will allow retreving variable definitions from object attribute values
and global definitions.

Add a new field "current_obj_cfg" to hold the current object config
being pre-processed.

This will facilitate adding simple math expressions for computing
attribute values for objects based on other attributes. For ex: we can
set the expression for buffer size as follows:

buffer_size "$[($in_channels * 48) * 4]"

The buffer_size attribute value will be computed with the attribute
value "in_channels" based on the expression above. So if $in_channels =
2, buffer_size will be evaluated to 384.

Additionally this change also permits computing attribute values based
on previously computed values. For example:

buffer_size "$[($in_channels * 48) * 4]"
dma_buffer_size "$[$buffer_size * 2]"

dma_buffer_size will be computed as 768. Note that the order of
definitions for buffer_size and dma_buffer_size matters because the
evaluation for dma_buffer_size depends on the evaluation of buffer_size.
In order to conform to this, the tplg_object_copy_and_add_param() is
modified to add attribute configs from class config to an object using
snd_config_before() instead of snd_config_add().

With this change, we no longer need to set the auto_attr_updater for
buffer type widget objects. So remove it.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-19 20:32:38 +01:00
Jaroslav Kysela
76b4af2616 alsaucm: add 'getval' and 'getival' commands
Print the value only without the variable name prefix

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 11:54:15 +02:00
Curtis Malainey
03e98d2806 ucm: fix typo in docs
Do you know the tstaus of this fix?

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-07 11:37:50 +01:00
Cheng Yueh
15539cd0e6 alsaucm: Fix ending with quotes commands
If we use 'alsaucm -n -b -' with 'get "CapturePCM/Internal Mic"' then
the alsaucm will report error and stop immediately. The reason is that
the parse_line in usecase.c appends an empty argument if a command ends
with quotes.

This change adds a patch to fix the parse_line function in usecase.c.

Signed-off-by: Cheng Yueh <cyueh@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-27 11:56:47 +02:00
Jaroslav Kysela
d3d01ee7cf alsaucm: remove custom rules, alsactl is UCM aware now
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-02 13:09:31 +02:00
Jaroslav Kysela
f8a2aad5bb alsactl: ucm - rename _once command to _boot command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:21:25 +02:00
Jaroslav Kysela
e4a9bf9720 alsaucm: add usecase.h to noinst_HEADERS for packaging
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-18 20:08:37 +01:00
Jaroslav Kysela
160b47e27c alsaucm: dump - fix the prefixed "
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 20:38:17 +01:00
Jaroslav Kysela
49716fa61e alsaucm: add json dump command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 20:32:15 +01:00
Jaroslav Kysela
860ffda825 alsaucm: add text dump command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 19:13:07 +01:00
Jaroslav Kysela
745c5df260 alsaucm: use the first sound card (use case name 'hw:CARDNO') as default
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 18:01:33 +01:00
Jaroslav Kysela
d207574ef7 alsaucm: fix the implicit card open
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 18:01:10 +01:00
Jaroslav Kysela
c8fdd38c74 alsaucm, topology: LDADD cleanups and add support for libatopology
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-12 19:39:42 +01:00
Jaroslav Kysela
d2b0b91edf alsaucm: do the implicit ucm open only when the command requires it
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-09 22:20:00 +01:00
Jaroslav Kysela
94401f7afe alsaucm: call snd_config_update_free_global() to make valgrind more happy
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-04 18:38:59 +01:00
Jaroslav Kysela
71558a41b0 alsatplg: add man file
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2018-10-09 10:53:32 +02:00
Jaroslav Kysela
25bea6baf7 alsaucm: add alsa-ucm udev rules for PAZ00 (Toshiba AC100/Dynabook AZ).
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2018-09-07 10:54:07 +02:00
Takashi Iwai
c6bdde171e alsaucm: Add alsaucm.rst to EXTRA_DIST
Otherwise it's missing in the tarball.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-12-28 15:58:51 +01:00
Antonio Ospite
20d3d03b7a alsaucm: add a man page, generated from reStructuredText
Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-12-09 17:23:33 +01:00
Antonio Ospite
c21b3a4b62 alsaucm: mention the "list1" command in the usage output
Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-12-09 17:21:47 +01:00
Takashi Iwai
ff9b070d9c alsaucm: Drop localbuild hacks
The include and library paths shouldn't be across the build tree.
The installed alsa-lib must have the UCM support for building the
stuff here in alsa-utils repo correctly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-04 18:26:40 +02:00
Jaroslav Kysela
0a6c9e80f7 Makefiles - use AM_CPPFLAGS instead INCLUDES
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-05-07 10:55:59 +02:00
Stephen Warren
f30fbe3901 alsaucm: Don't double-free empty lists
When snd_use_case_get_list (and hence also snd_use_case_card_list) returns
an empty list, alsaucm still attempts to free it. This ends up double-
freeing the returned list, or worse, freeing an invalid pointer, depending
on how snd_use_case_get_list gets implemented. Fix alsaucm to return early
on empty lists to avoid this.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-06-03 11:48:12 +02:00
Stephen Warren
16bdb41b87 alsaucm: Add list1 command for non-tuple lists
snd_use_case_get_list returns lists of strings that are either:
a) A sequence of single strings
b) A sequence of pairs of strings all flattened into a single list

The current list command assumes layout (b) above, and hence prints
nothing when printing a single-entry list that's actually in layout (a).
Add a new command "list1" to dump lists in layout (a).

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-06-03 11:47:36 +02:00
Jaroslav Kysela
e7d86f1c9c alsaucm: do not bail out in the interactive mode upon error
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-01-31 14:30:20 +01:00
Jaroslav Kysela
629fdf6445 alsaucm: fix interactive mode, add batch mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-01-31 14:15:07 +01:00
Pierre-Louis Bossart
371d58b88f alsaucm: fix list command and output
add one argument to list to avoid error message, do not list
comments as verbs

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-01-29 11:03:54 +01:00
Jaroslav Kysela
ce282e63c7 alsaucm: fix command line arguments parsing
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-10-21 20:24:37 +02:00
Jaroslav Kysela
47563fb2eb ucm: added listcards command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-10-13 11:47:23 +02:00
Jaroslav Kysela
a9af4348df alsaucm: initial rewrite to use update API
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-10-12 13:16:54 +02:00
Mark Brown
048f87bfc9 alsaucm: Report failure to set a device due to missing verb setup
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-10-09 10:23:12 +02:00
Stefan Schmidt
a9d91614bb alsaucm: Add Use Case Manager utility
alsaucm is a command line tool that can be used to generate and debug UCM
configuration files. The alsaucm utility can fully use the UCM functionality
to query and configure all the UCM functionality in alsa-lib.

This work was sponsored by Slimlogic Ltd, Texas Instruments Inc and Wolfson
Microelectronics PLC.

CC: Ian Molton <ian@mnementh.co.uk>
CC: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Justin Xu <justinx@slimlogic.co.uk>
Signed-off-by: Stefan Schmidt <stefan@slimlogic.co.uk>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-22 22:04:00 +01:00