Commit graph

1591 commits

Author SHA1 Message Date
Olivier Humbert
789a307cf9 aplay: Fix typo in error message
BugLink: https://github.com/alsa-project/alsa-utils/pull/44
From: Olivier Humbert <trebmuh@users.noreply.github.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:10:54 +02:00
Samanta Navarro
825d1d6359 treewide: fix typos in manual pages
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:07:29 +02:00
Jaroslav Kysela
b348abcbfe alsactl: add new -U argument text to man page
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:05:12 +02:00
Andrew Hlynskyi
d7bf45edc3 alsactl: init - add -U option to disable UCM based init
The reason is to use it with internal init extra commands like:
  alsactl -U -E CMD=info init

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:03:03 +02:00
Pierre-Louis Bossart
20f87c14d9 alsa-info: provide DMI system sku
The system sku is used in SOF machine drivers to set specific quirks,
expose it in alsa-info to help support users. Example on a SoundWire
enabled device:

cat /sys/class/dmi/id/product_sku
0A32
dmidecode -s system-sku-number
0A32

Add a variable and expose the results of both methods.

Note that the dmidecode support is very recent and might not yet be
available in all distros:

http://git.savannah.nongnu.org/cgit/dmidecode.git/commit/?id=d70d5e686148eabe90c89fbf4cdcf5258db5aa05

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:01:57 +02:00
Tobias Geerinckx-Rice
dea85a314b alsabat: fix typo
Halve the double negative ‘if no loopback mode is not available’.

Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:00:18 +02:00
Marcin Rajwa
9b02b42db4 aplay: capture: write only the amount of read frames
This patch changes the way aborted stream is being saved. Currently when
abort signal happens the write back of read samples is skipped but there
is no reason to not save them. Also, we need to know how much frames have
been read and write only those.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 12:58:20 +02:00
Marcin Rajwa
5e87e2e021 aplay: pcm_read(): return read samples instead of requested upon abort
This patch changes the logic of pcm_read() when abort signal has been
detected. During such condition we should return the amount of frames
actually read instead of the size requested by caller.

Currently functions pcm_read() and pcm_readv() when aborted (in_aborting
flag set) return the amount of requested frames instead of those actually
read prior to interrupt. The consequence of this is repetition of recent X
frames where X stands for amount of frames in one period. This problem is
barely visible or rather audible when the period is small like few
milliseconds because repetition of 1 [ms] of data is not-noticeable
however if we use buffer and period sizes in seconds then the problem
becomes apparent.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 12:58:20 +02:00
Marcin Rajwa
bc7a944c50 aplay: pcm_readv(): return read samples instead of requested upon abort
This patch changes the logic of pcm_readv() when abort signal has been
detected. During such condition we should return the amount of frames
actually read instead of the size requested by caller.

Currently functions pcm_read() and pcm_readv() when aborted (in_aborting
flag set) return the amount of requested frames instead of those actually
read prior to interrupt. The consequence of this is repetition of recent X
frames where X stands for amount of frames in one period. This problem is
barely visible or rather audible when the period is small like few
milliseconds because repetition of 1 [ms] of data is not-noticeable
however if we use buffer and period sizes in seconds then the problem
becomes apparent.

Example issue -> thesofproject/sof#3189

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 12:58:20 +02:00
Dragos Tarcatu
8572c0c427 alsaloop: Fix the silence generation in xrun_sync
The silence frames generation in xrun_sync() seems to be currently
a bit off as snd_pcm_format_set_silence() uses a wrong buffer address
and size for zero-ing out the data. Consequently instead of clearing
out the last frame(s), snd_pcm_format_set_silence() ends up silencing
samples somewhere else in the buffer. This is partilarly more obvious
for higher frame sizes (e.g. more than 2 channels).

This patch fixes this issue by correcting the parameters passed to
snd_pcm_format_set_silence().

BugLink: https://github.com/alsa-project/alsa-utils/pull/58
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-09-25 15:21:15 +02: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
7fbd2311e2 alsa-info.sh: command -v cleanups
Inspired in https://github.com/alsa-project/alsa-utils/pull/29 .

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:27:13 +02:00
Jaroslav Kysela
56f2064bb4 alsamixer: remove wrong free(buf) call in read_file()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:16:24 +02:00
braph
0657b2a559 alsamixer: small optimizations
textbox.c, mixer_display.c:
  - Replaced manual line drawing code `for (...) mvwaddch(...)` by the
    functions `mvwhline/mvwvline` provided by standard curses

card_select.c, proc_files.c:
  - Moved duplicate code in the create() functions to menu_widget_create()
    in menu_widget.c

card_select.c:
  - Removed redundant calls to sprintf()

device_name.c:
  - Combined multiple calls to form_opts_off()
  - Recognize ASCII DEL (127) as backspace

widget.c:
  - Uncommented code for setting a dummy key handler (all existing
    widgets do provide a key handling function)

Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:10:35 +02:00
braph
89e746368c alsamixer: added configuration file parser
Added configparser.c and curskey.c:
  - Lines starting with arbitrary whitespace + '#' are comments
  - Words in a command name don't have a fixed order (toggle_mute is the
      same as mute_toggle)

Moved read_file() from textbox.c to utils.c, so configparser.c can make
use of it.

Added command line options:
  -f/-F to specify/disable configuration file
  -m/-M to enable/disable mouse

Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:10:35 +02:00
braph
32dc22c2bf alsamixer: Use a struct for storing color attributes
This commit is a preparation for the configuration file parser.

The `int attr_*` variables have been moved into a separate struct.
Members of that struct are alphabetically ordered, so an attribute can
later be accessed by its name.

Added `int get_color_pair(short fg, short bg)` for returning or
creating a color pair number.

Added call to `use_default_colors()` for enabling access to the
terminal's default color (-1).

Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:10:35 +02:00
braph
ba1c5357a1 alsamixer: added mouse support
Mouse support has been added for mixer_widget.c, card_select.c and
proc_files.c.

In the mixer widget the mouse is handled as follows:
- After an element has been printed in mixer_display.c, a call to
  clickable_set() will store the coordinates of the drawn area plus the
  command enum that should be executed on click. An optional argument
  holds an index which points to the selected mixer control.
- on_mouse_click() searches for a matching rectangle, focuses the mixer
  control and returns the command enum.

In the menu widgets, the menu_driver() function handles mouse input.

Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:10:35 +02:00
braph
6e9e84ba60 alsamixer: Replaced hardcoded keys by binding arrays
This commit is a preparation for making keybindings configurable.

The hardcoded keys in the switch statements of mixer_widget.c,
textbox.c, proc_files.c and card_select.c have been replaced by
command enums. The command that shall be executed is looked up in
the arrays `mixer_bindings` and `textbox_bindings`.

The channel_mask enum has been made public, since LEFT and RIGHT are
used as command arguments in bindings.c.

Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:10:35 +02:00
braph
706a64c7a0 alsamixer: Fix window_size_changed()
Obtaining the new window size using TIOCGWINSZ and setting it using
resize_term(), so getmaxyx() reports the actual terminal size.

Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-07-01 16:10:35 +02:00
Jaroslav Kysela
225a9afbc3 alsactl: fix the syslog message - add : delimiter after function:line
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-20 08:47:01 +02:00
Jaroslav Kysela
1dd37fddd8 topology: check for the remove() error (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-09 10:31:50 +02:00
Jaroslav Kysela
9ffc427802 topology: fix the error path in load()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-09 10:29:30 +02:00
Jaroslav Kysela
651ca88a99 aplay: fix possible string overflow (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-09 10:27:40 +02:00
Jaroslav Kysela
3d35bce271 alsa-info.sh: declare variables separately from the assign (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-09 10:24:41 +02:00
Jaroslav Kysela
247d9e336d Release v1.2.3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-07 19:19:42 +02:00
Jaroslav Kysela
640d01319b amixer: retype to double in convert_prange1() like in convert_prange()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-05 17:59:31 +02:00
Jaroslav Kysela
361734165e amixer: improve the raw percentual volume rounding
In commit "ae9ddeb63443cc2c46e0f0b915466cca0f800372" the rint() was
changed to ceil(). Revert it back. The rint() rounding is more precise
for most cases.

Also, handle the special case where the percentual value is greather
then zero. Set the min + 1 value in this case.

At last, fix the return value in convert_prange() when range is zero.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-05 17:01:04 +02:00
Jaroslav Kysela
4aadfe334f alsamixer: suppress _XOPEN_SOURCE compile warning
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-05 08:26:30 +02:00
Jaroslav Kysela
b6aafc40a6 github actions: ubuntu - fix the non-interactive build
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-02 13:09:34 +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
570ea6c455 alsactl: allow to compile alsactl without UCM support
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:54:04 +02:00
Jaroslav Kysela
0adca4cac7 alsactl: use the right priority for syslog messages
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:41:40 +02:00
Jaroslav Kysela
b68e854d28 alsactl: add -D argument to execute also the UCM defaults section
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:34:18 +02:00
Jaroslav Kysela
8fb4016a17 alsactl: redirect alsa-lib errors
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:09:53 +02:00
Jaroslav Kysela
4bea8fe3a7 alsactl: add initial support for UCM init
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:19:20 +02:00
Jaroslav Kysela
598488c4af alsactl: init - iterate through all cards for the initial settings
The generic initialization code returns error code 99 (-99). Take
all those codes equal or above (bellow) this value as non-fatal.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:18:22 +02:00
Jaroslav Kysela
f9abf36d34 alsactl: daemon.c - fix gcc warning in write_pid_file() 2020-05-14 16:49:06 +02:00
Jaroslav Kysela
2cfeffb6e8 alsa-info.sh: increase version to 0.4.65
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-04 10:05:41 +02:00
Michael Shigorin
8e59029c9c alsa-info: initial rpm/deb package info
This might become a Pandora's box given
the amount of obscure package managers
on the planet but these two account for
most *nix-like systems with ALSA it seems.

Added support for querying ALSA packages
installed through rpm and dpkg; tested
on ALT (rpm) and OS Elbrus (dpkg).

Suggested-by: Anton Farygin <rider@altlinux.org>
See-also: http://bugzilla.altlinux.org/38416
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-01 10:57:16 +02:00
Michael Shigorin
217fef4a0b alsa-info.sh: add ALT to DISTRO list
Suggested-by: Anton Farygin <rider@altlinux.org>
See-also: http://bugzilla.altlinux.org/38416
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-01 10:57:07 +02:00
Oscar65
d2bf87608a alsactl: fix error handling for sched_setscheduler() call
As man page says: "If successful, the sched_setparam() function shall return zero."

Without update I got this output in the syslog (journalctl):
abr 16 09:25:30 mypc alsactl[1652]: alsactl 1.2.2 daemon started
abr 16 09:25:30 mypc alsactl[1652]: /usr/bin/alsactl: do_nice:165sched_setparam failed: No such file or directory

If sched_setscheduler() returns 0, so it means that the call was successful.

Signed-off-by: Oscar Megía <megia.oscar@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-17 09:29:24 +02:00
Zev Weiss
5fe6b86659 alsactl: avoid needless wakeups in monitor loop.
The timeout wasn't really being used for anything; disabling it should
reduce idle energy consumption slightly.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-14 15:34:00 +02:00
Zev Weiss
5830fc726a alsactl: don't exit on EINTR from epoll_wait().
Previously, things like attaching strace to a running 'alsactl monitor'
process would cause it to exit.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-14 15:33:58 +02:00
Jaroslav Kysela
10e5cef85a github workflow: fix tag fetch
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-03-11 10:08:35 +01:00
Ruslan Bilovol
ec8717d588 alsaloop: reduce cumulative error caused by non-atomic samples calculation
When doing loopback between two audio card with
same sampling frequency, I noticed slow increase
of pitch_diff.

When I changed order of get_queued_playback_samples()
vs get_queued_capture_samples(), I noticed same drift
of pitch_diff but if was decreasing this time.

This seems to be caused by non-atomic consecutive
snd_pcm_delay() invocation for playback then for
capture. snd_pcm_delay() measures delay between
read/write call and actual ADC/DAC operation.

So while we get this value for playback path in
get_queued_playback_samples(), next call to
get_queued_capture_samples() will happen a little
bit later so snd_pcm_delay() may return incorrect
value.

Be interleaving get_queued_{playback,capture}_samples()
order, we divide this small error between playback
and capture paths. I do not see any issues anymore
with one-way drift of pitch_diff.

Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-03-11 09:45:10 +01:00
Jaroslav Kysela
f31f5df42a Release v1.2.2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-19 13:02:10 +01:00
Jaroslav Kysela
1d12bd369e configure: fix the inverted libatopology check
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-19 13:02:03 +01:00
Jaroslav Kysela
3ca6cd71ae github workflow: try to fix the empty version
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-19 11:01:40 +01:00
Jaroslav Kysela
bcacde5109 github build.yml: try to fix the tag fetch issue (private working dirs)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-18 20:57:47 +01:00