]> git.alsa-project.org Git - alsa-utils.git/log
alsa-utils.git
5 years agoalsamixer: small optimizations
braph [Thu, 3 Oct 2019 18:18:23 +0000 (20:18 +0200)]
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>
5 years agoalsamixer: added configuration file parser
braph [Thu, 3 Oct 2019 17:06:11 +0000 (19:06 +0200)]
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>
5 years agoalsamixer: Use a struct for storing color attributes
braph [Thu, 3 Oct 2019 15:36:52 +0000 (17:36 +0200)]
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>
5 years agoalsamixer: added mouse support
braph [Thu, 26 Sep 2019 23:25:56 +0000 (01:25 +0200)]
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>
5 years agoalsamixer: Replaced hardcoded keys by binding arrays
braph [Thu, 26 Sep 2019 20:27:25 +0000 (22:27 +0200)]
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>
5 years agoalsamixer: Fix window_size_changed()
braph [Thu, 26 Sep 2019 19:01:50 +0000 (21:01 +0200)]
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>
5 years agoalsactl: fix the syslog message - add : delimiter after function:line
Jaroslav Kysela [Sat, 20 Jun 2020 06:46:53 +0000 (08:46 +0200)]
alsactl: fix the syslog message - add : delimiter after function:line

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: check for the remove() error (coverity)
Jaroslav Kysela [Tue, 9 Jun 2020 08:31:50 +0000 (10:31 +0200)]
topology: check for the remove() error (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agotopology: fix the error path in load()
Jaroslav Kysela [Tue, 9 Jun 2020 08:29:30 +0000 (10:29 +0200)]
topology: fix the error path in load()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaplay: fix possible string overflow (coverity)
Jaroslav Kysela [Tue, 9 Jun 2020 08:27:40 +0000 (10:27 +0200)]
aplay: fix possible string overflow (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsa-info.sh: declare variables separately from the assign (coverity)
Jaroslav Kysela [Tue, 9 Jun 2020 08:24:38 +0000 (10:24 +0200)]
alsa-info.sh: declare variables separately from the assign (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoRelease v1.2.3 v1.2.3
Jaroslav Kysela [Sun, 7 Jun 2020 17:19:42 +0000 (19:19 +0200)]
Release v1.2.3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoamixer: retype to double in convert_prange1() like in convert_prange()
Jaroslav Kysela [Fri, 5 Jun 2020 15:59:31 +0000 (17:59 +0200)]
amixer: retype to double in convert_prange1() like in convert_prange()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoamixer: improve the raw percentual volume rounding
Jaroslav Kysela [Fri, 5 Jun 2020 11:34:37 +0000 (13:34 +0200)]
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>
5 years agoalsamixer: suppress _XOPEN_SOURCE compile warning
Jaroslav Kysela [Fri, 5 Jun 2020 06:26:30 +0000 (08:26 +0200)]
alsamixer: suppress _XOPEN_SOURCE compile warning

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agogithub actions: ubuntu - fix the non-interactive build
Jaroslav Kysela [Tue, 2 Jun 2020 11:05:06 +0000 (13:05 +0200)]
github actions: ubuntu - fix the non-interactive build

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: remove custom rules, alsactl is UCM aware now
Jaroslav Kysela [Thu, 28 May 2020 19:00:18 +0000 (21:00 +0200)]
alsaucm: remove custom rules, alsactl is UCM aware now

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: ucm - rename _once command to _boot command
Jaroslav Kysela [Mon, 25 May 2020 17:21:25 +0000 (19:21 +0200)]
alsactl: ucm - rename _once command to _boot command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: allow to compile alsactl without UCM support
Jaroslav Kysela [Thu, 14 May 2020 17:54:04 +0000 (19:54 +0200)]
alsactl: allow to compile alsactl without UCM support

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: use the right priority for syslog messages
Jaroslav Kysela [Thu, 14 May 2020 17:41:40 +0000 (19:41 +0200)]
alsactl: use the right priority for syslog messages

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: add -D argument to execute also the UCM defaults section
Jaroslav Kysela [Thu, 14 May 2020 17:34:18 +0000 (19:34 +0200)]
alsactl: add -D argument to execute also the UCM defaults section

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: redirect alsa-lib errors
Jaroslav Kysela [Thu, 14 May 2020 17:09:45 +0000 (19:09 +0200)]
alsactl: redirect alsa-lib errors

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: add initial support for UCM init
Jaroslav Kysela [Thu, 14 May 2020 15:12:08 +0000 (17:12 +0200)]
alsactl: add initial support for UCM init

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: init - iterate through all cards for the initial settings
Jaroslav Kysela [Thu, 14 May 2020 16:14:31 +0000 (18:14 +0200)]
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>
5 years agoalsactl: daemon.c - fix gcc warning in write_pid_file()
Jaroslav Kysela [Thu, 14 May 2020 14:48:57 +0000 (16:48 +0200)]
alsactl: daemon.c - fix gcc warning in write_pid_file()

5 years agoalsa-info.sh: increase version to 0.4.65
Jaroslav Kysela [Mon, 4 May 2020 08:05:41 +0000 (10:05 +0200)]
alsa-info.sh: increase version to 0.4.65

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsa-info: initial rpm/deb package info
Michael Shigorin [Fri, 1 May 2020 07:52:42 +0000 (10:52 +0300)]
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>
5 years agoalsa-info.sh: add ALT to DISTRO list
Michael Shigorin [Fri, 1 May 2020 07:28:59 +0000 (10:28 +0300)]
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>
5 years agoalsactl: fix error handling for sched_setscheduler() call
Oscar65 [Thu, 16 Apr 2020 10:35:21 +0000 (12:35 +0200)]
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>
5 years agoalsactl: avoid needless wakeups in monitor loop.
Zev Weiss [Tue, 15 Oct 2019 04:38:02 +0000 (23:38 -0500)]
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>
5 years agoalsactl: don't exit on EINTR from epoll_wait().
Zev Weiss [Tue, 15 Oct 2019 04:36:50 +0000 (23:36 -0500)]
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>
5 years agogithub workflow: fix tag fetch
Jaroslav Kysela [Wed, 11 Mar 2020 08:58:31 +0000 (09:58 +0100)]
github workflow: fix tag fetch

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaloop: reduce cumulative error caused by non-atomic samples calculation
Ruslan Bilovol [Mon, 9 Mar 2020 20:29:54 +0000 (22:29 +0200)]
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>
5 years agoRelease v1.2.2 v1.2.2
Jaroslav Kysela [Wed, 19 Feb 2020 12:02:10 +0000 (13:02 +0100)]
Release v1.2.2

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconfigure: fix the inverted libatopology check
Jaroslav Kysela [Wed, 19 Feb 2020 12:02:03 +0000 (13:02 +0100)]
configure: fix the inverted libatopology check

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agogithub workflow: try to fix the empty version
Jaroslav Kysela [Wed, 19 Feb 2020 10:01:40 +0000 (11:01 +0100)]
github workflow: try to fix the empty version

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agogithub build.yml: try to fix the tag fetch issue (private working dirs)
Jaroslav Kysela [Tue, 18 Feb 2020 19:40:48 +0000 (20:40 +0100)]
github build.yml: try to fix the tag fetch issue (private working dirs)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoREADME.md: add build status badge
Jaroslav Kysela [Tue, 18 Feb 2020 19:07:54 +0000 (20:07 +0100)]
README.md: add build status badge

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agogithub: create test workflow for fedora and ubuntu
Jaroslav Kysela [Tue, 18 Feb 2020 14:28:00 +0000 (15:28 +0100)]
github: create test workflow for fedora and ubuntu

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: add usecase.h to noinst_HEADERS for packaging
Jaroslav Kysela [Tue, 18 Feb 2020 18:58:13 +0000 (19:58 +0100)]
alsaucm: add usecase.h to noinst_HEADERS for packaging

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoAvoid empty initializer list
Michael Forney [Wed, 5 Feb 2020 08:12:21 +0000 (00:12 -0800)]
Avoid empty initializer list

To zero-initialize an object, use `{0}` instead.

Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoUse %lli for long long in printf
Michael Forney [Wed, 5 Feb 2020 08:12:20 +0000 (00:12 -0800)]
Use %lli for long long in printf

The `L` length modifier only applies to floating-point conversion
specifiers, and `ll` is used for `long long` integers.

Although glibc accepts %Li, musl does not and returns EINVAL.

Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoAvoid pointer arithmetic on `void *`
Michael Forney [Wed, 5 Feb 2020 08:12:19 +0000 (00:12 -0800)]
Avoid pointer arithmetic on `void *`

The pointer operand to the binary `+` operator must be to a complete
object type.

Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoUse __func__ instead of __FUNCTION__
Michael Forney [Wed, 5 Feb 2020 08:12:18 +0000 (00:12 -0800)]
Use __func__ instead of __FUNCTION__

They are equivalent, but __func__ is in C99. __FUNCTION__ exists only
for backwards compatibility with old gcc versions.

Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoconfigure: fix new libatopology check
Jaroslav Kysela [Fri, 3 Jan 2020 22:46:51 +0000 (23:46 +0100)]
configure: fix new libatopology check

5 years agoalsatplg: add documentation for -z,--dapm-nosort (-h)
Jaroslav Kysela [Wed, 1 Jan 2020 16:45:06 +0000 (17:45 +0100)]
alsatplg: add documentation for -z,--dapm-nosort (-h)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsatplg: add decode command
Jaroslav Kysela [Sun, 22 Dec 2019 14:44:56 +0000 (15:44 +0100)]
alsatplg: add decode command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsatplg: add -V,--version option
Jaroslav Kysela [Fri, 20 Dec 2019 14:23:27 +0000 (15:23 +0100)]
alsatplg: add -V,--version option

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsatplg: rewrite to use the new libatopology functions
Jaroslav Kysela [Thu, 19 Dec 2019 14:36:05 +0000 (15:36 +0100)]
alsatplg: rewrite to use the new libatopology functions

Add '-u,--dump' operation.
Add '-g,--group' and '-x,--nocheck' modifiers.
Add '-z,--dapm-nosort' modifier.
Allow to operate with stdin/stdout for the file input/output.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsa-info.sh: Warn after actual upload failure; do not ping server
David Ward [Sat, 21 Dec 2019 05:32:11 +0000 (00:32 -0500)]
alsa-info.sh: Warn after actual upload failure; do not ping server

Check the return value of wget to determine if the upload actually
failed. If so, display the message about upload failure, then exit.

Do not ping the web server; the result does not indicate whether a
file upload will succeed or not.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Perform test for wget earlier
David Ward [Sat, 21 Dec 2019 05:32:10 +0000 (00:32 -0500)]
alsa-info.sh: Perform test for wget earlier

If wget is not present, do not ask about uploading the information.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Condense nested commands for formatting upload result
David Ward [Sat, 21 Dec 2019 05:32:09 +0000 (00:32 -0500)]
alsa-info.sh: Condense nested commands for formatting upload result

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Condense nested commands for file upload
David Ward [Sat, 21 Dec 2019 05:32:08 +0000 (00:32 -0500)]
alsa-info.sh: Condense nested commands for file upload

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Remove progress spinner during upload without dialog
David Ward [Sat, 21 Dec 2019 05:32:07 +0000 (00:32 -0500)]
alsa-info.sh: Remove progress spinner during upload without dialog

The spinner did not actually provide information about the status
of the file upload, and caused other problems: it would repeatedly
spawn new pgrep processes (without a delay between them), and it
blocked the script if any wget process was running on the system.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Replace gauge with infobox for upload dialog
David Ward [Sat, 21 Dec 2019 05:32:06 +0000 (00:32 -0500)]
alsa-info.sh: Replace gauge with infobox for upload dialog

The gauge did not actually show the upload progress; in fact, the
dialog did not even appear until after the upload was completed.

Use an infobox instead, which will be displayed while wget runs.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Exit script after writing information to stdout
David Ward [Sat, 21 Dec 2019 05:32:05 +0000 (00:32 -0500)]
alsa-info.sh: Exit script after writing information to stdout

The '--stdout' option is mutually exclusive with uploading the file.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Use existing function to print ALSA configuration files
David Ward [Sat, 21 Dec 2019 05:32:04 +0000 (00:32 -0500)]
alsa-info.sh: Use existing function to print ALSA configuration files

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Simplify iteration over cards when calling amixer
David Ward [Sat, 21 Dec 2019 05:32:03 +0000 (00:32 -0500)]
alsa-info.sh: Simplify iteration over cards when calling amixer

Read card names directly from individual procfs files, and pass them
to amixer using the '-c' option.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Read from /proc/modules and sort the result
David Ward [Sat, 21 Dec 2019 05:32:02 +0000 (00:32 -0500)]
alsa-info.sh: Read from /proc/modules and sort the result

Sorting the list of loaded modules makes it much easier to compare
two alsa-info.txt files, even if they are both from the same system
(since the order actually changes after each reboot).

lsmod just formats the contents of /proc/modules. After this script
calls lsmod, it strips everything but module names from the output.
This same result can be obtained just as easily by reading directly
from /proc/modules; then there is no need to remove the header line
printed by lsmod before sorting the output.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsa-info.sh: Consolidate PCI device output
David Ward [Sat, 21 Dec 2019 05:32:01 +0000 (00:32 -0500)]
alsa-info.sh: Consolidate PCI device output

Include numeric IDs and subsystem info in the PCI device output,
without placing them in a separate section.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsatplg: fix another small leak in normalize_config()
Jaroslav Kysela [Fri, 13 Dec 2019 09:44:36 +0000 (10:44 +0100)]
alsatplg: fix another small leak in normalize_config()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsatplg: add -s,--sort and fix memory leaks
Jaroslav Kysela [Thu, 12 Dec 2019 18:18:28 +0000 (19:18 +0100)]
alsatplg: add -s,--sort and fix memory leaks

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsatplg: add -n,--normalize option
Jaroslav Kysela [Thu, 12 Dec 2019 18:00:42 +0000 (19:00 +0100)]
alsatplg: add -n,--normalize option

This function loads and parses the topology file and
saves back the structured output in the alsa-lib's format
without comments.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoconfigure: Fix linking of alsatplg with the older libs
Jaroslav Kysela [Tue, 3 Dec 2019 19:51:56 +0000 (20:51 +0100)]
configure: Fix linking of alsatplg with the older libs

BugLink: https://github.com/alsa-project/alsa-utils/issues/33
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: fix --sched-idle (set it really to SCHED_IDLE)
Jaroslav Kysela [Tue, 3 Dec 2019 12:53:25 +0000 (13:53 +0100)]
alsactl: fix --sched-idle (set it really to SCHED_IDLE)

Reported-by: tommy <tommy@kelsos.ptp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: dump - fix the prefixed "
Jaroslav Kysela [Sat, 30 Nov 2019 19:38:17 +0000 (20:38 +0100)]
alsaucm: dump - fix the prefixed "

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: add json dump command
Jaroslav Kysela [Sat, 30 Nov 2019 19:30:33 +0000 (20:30 +0100)]
alsaucm: add json dump command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: add text dump command
Jaroslav Kysela [Wed, 27 Nov 2019 07:51:29 +0000 (08:51 +0100)]
alsaucm: add text dump command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: use the first sound card (use case name 'hw:CARDNO') as default
Jaroslav Kysela [Mon, 25 Nov 2019 16:58:51 +0000 (17:58 +0100)]
alsaucm: use the first sound card (use case name 'hw:CARDNO') as default

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: sysfs - add /sys/kernel/uevent_seqnum check to init
Jaroslav Kysela [Wed, 20 Nov 2019 12:20:39 +0000 (13:20 +0100)]
alsactl: sysfs - add /sys/kernel/uevent_seqnum check to init

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaplay: Limit VUMeter progress bar to 100 for negative as well
Rosen Penev [Wed, 20 Nov 2019 19:13:55 +0000 (11:13 -0800)]
aplay: Limit VUMeter progress bar to 100 for negative as well

While the progress bar cannot be negative, GCC concludes that it can be
and assumes tmp can be written past the end. Fixes this GCC warning:

aplay.c:1747:18: warning: '%02d' directive writing between 2 and 11 bytes
 into a region of size 4 [-Wformat-overflow=]
 1747 |    sprintf(tmp, "%02d%%", maxperc[c]);

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaplay: Adjust buffer sizes to fix snprintf warnings
Rosen Penev [Wed, 20 Nov 2019 18:19:20 +0000 (10:19 -0800)]
aplay: Adjust buffer sizes to fix snprintf warnings

It also reduces compiled size slightly.

aplay.c: In function 'capture':
aplay.c:3055:34: error: '-01' directive output may be truncated writing 3
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]
 3055 |    snprintf(namebuf, namelen, "%s-01", buf);
      |                                  ^~~
aplay.c:3055:4: note: 'snprintf' output between 4 and 4100 bytes into a
destination of size 4097
 3055 |    snprintf(namebuf, namelen, "%s-01", buf);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3053:34: error: '-01.' directive output may be truncated writing 4
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]
 3053 |    snprintf(namebuf, namelen, "%s-01.%s", buf, s);
      |                                  ^~~~
aplay.c:3053:4: note: 'snprintf' output 5 or more bytes (assuming 4101)
into a destination of size 4097
 3053 |    snprintf(namebuf, namelen, "%s-01.%s", buf, s);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3065:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |                                  ^~~~
aplay.c:3065:30: note: directive argument in the range [1, 2147483647]
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |                              ^~~~~~~~~
aplay.c:3065:3: note: 'snprintf' output between 4 and 4108 bytes into a
destination of size 4097
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3063:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
      |                                  ^~~~
aplay.c:3063:30: note: directive argument in the range [1, 2147483647]
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
      |                              ^~~~~~~~~~~~
aplay.c:3063:3: note: 'snprintf' output 5 or more bytes (assuming 4109)
into a destination of size 4097
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotreewide: Fix printf formats
Rosen Penev [Wed, 20 Nov 2019 04:28:55 +0000 (20:28 -0800)]
treewide: Fix printf formats

Found with cppcheck

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotreewide: Fix wrong formats on 32-bit
Rosen Penev [Wed, 20 Nov 2019 04:28:54 +0000 (20:28 -0800)]
treewide: Fix wrong formats on 32-bit

uint64_t evaluates to unsigned long long on 32-bit, not unsigned long.
Use the proper formats.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotreewide: sys/poll to poll
Rosen Penev [Wed, 20 Nov 2019 04:28:53 +0000 (20:28 -0800)]
treewide: sys/poll to poll

Fixes warning on musl:

warning redirecting incorrect #include <sys/poll.h> to <poll.h>

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoRelease v1.2.1 v1.2.1
Jaroslav Kysela [Thu, 14 Nov 2019 17:02:29 +0000 (18:02 +0100)]
Release v1.2.1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: fix the implicit card open
Jaroslav Kysela [Thu, 14 Nov 2019 13:06:20 +0000 (14:06 +0100)]
alsaucm: fix the implicit card open

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm, topology: LDADD cleanups and add support for libatopology
Jaroslav Kysela [Tue, 12 Nov 2019 18:39:42 +0000 (19:39 +0100)]
alsaucm, topology: LDADD cleanups and add support for libatopology

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: do the implicit ucm open only when the command requires it
Jaroslav Kysela [Sat, 9 Nov 2019 21:20:00 +0000 (22:20 +0100)]
alsaucm: do the implicit ucm open only when the command requires it

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: call snd_config_update_free_global() to make valgrind more happy
Jaroslav Kysela [Mon, 4 Nov 2019 17:38:59 +0000 (18:38 +0100)]
alsaucm: call snd_config_update_free_global() to make valgrind more happy

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoamixer: do not double LF for container type
Jaroslav Kysela [Thu, 31 Oct 2019 16:33:00 +0000 (17:33 +0100)]
amixer: do not double LF for container type

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaxfer: handle -ETIMEDOUT before non-block I/O operation
Takashi Sakamoto [Tue, 29 Oct 2019 15:13:39 +0000 (00:13 +0900)]
axfer: handle -ETIMEDOUT before non-block I/O operation

When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.

This commit outputs report it for non-blocking operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaxfer: code refactoring for a helper function to wait for avail buffer space
Takashi Sakamoto [Wed, 30 Oct 2019 00:35:55 +0000 (09:35 +0900)]
axfer: code refactoring for a helper function to wait for avail buffer space

This commit applies code refactoring for waiting PCM event queued
per period of PCM buffer in copying operation for IRQ-based scheduling
model.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaxfer: handle -ETIMEDOUT before handle mmap I/O operation
Takashi Sakamoto [Tue, 29 Oct 2019 15:14:14 +0000 (00:14 +0900)]
axfer: handle -ETIMEDOUT before handle mmap I/O operation

When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.

This commit outputs report it for mmap operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaxfer: return ETIMEDOUT when no event occurs after waiter expiration
Takashi Sakamoto [Tue, 29 Oct 2019 15:12:11 +0000 (00:12 +0900)]
axfer: return ETIMEDOUT when no event occurs after waiter expiration

Although the waiter abstraction handles timeout as success, it should
report for callers to know timeout.

This commit takes the waiter to return -ETIMEDOUT when timeout expires.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaxfer: fix to return error code when a call of select(2) fails
Takashi Sakamoto [Wed, 30 Oct 2019 01:10:54 +0000 (10:10 +0900)]
axfer: fix to return error code when a call of select(2) fails

A call of select(2) returns negative code and report errors via errno
local variable, howver current waiter implementation for select(2)
returns the negative code instead of errno.

This commit fixes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaxfer: return the number of file descriptors for I/O events from select(2) waiter
Takashi Sakamoto [Tue, 29 Oct 2019 15:07:59 +0000 (00:07 +0900)]
axfer: return the number of file descriptors for I/O events from select(2) waiter

A call of select(2) returns error code at failure, the number of file
descriptors available I/O at success. Current implementation of
waiter abstraction for select(2) returns 0 at success and callers
can't get the number.

This commit fixes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaplay: fix memory leak when setup_chmap() fail
chunxu.li [Sun, 23 Jun 2019 15:54:29 +0000 (23:54 +0800)]
aplay: fix memory leak when setup_chmap() fail

setup_chmap() will return with error number if hw_map calloc fail or
channels doesn't match with hw_params, but memory free was ignored when
error occurs.

Signed-off-by: chunxu.li <chunxuxiao@gmail.com>
Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoalsamixer: Remove exp10 usage
Rosen Penev [Mon, 2 Sep 2019 01:22:29 +0000 (18:22 -0700)]
alsamixer: Remove exp10 usage

exp10 is a GNU extension and not available everywhere (eg. uClibc-ng).

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaxfer: test: fix invalid comparison of 64 bit storage in ILP32 data type
Takashi Sakamoto [Sun, 28 Jul 2019 04:48:50 +0000 (13:48 +0900)]
axfer: test: fix invalid comparison of 64 bit storage in ILP32 data type

In system V ABIs with ILP32 data model, bit shift for '1ul' can brings
undefined behaviour when the calculation result is over 32 bit width.

This commit fixes the bug.

Reported-by: Rolf Eike Beer <eike@sf-mail.de>
Reference: https://bugs.gentoo.org/681652
Reference: https://github.com/alsa-project/alsa-utils/issues/23
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaxfer: mapper: fix parameter check for demuxer
Takashi Sakamoto [Sun, 28 Jul 2019 04:43:34 +0000 (13:43 +0900)]
axfer: mapper: fix parameter check for demuxer

Each container should be configured to store one saple per frame in
demuxer case. This commit fixes the bug.

Fixes: 25c8e3bebb53 ('axfer: add support for a mapper for multiple target')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaxfer: remove unused variable warnings
Jaroslav Kysela [Mon, 27 May 2019 13:37:05 +0000 (15:37 +0200)]
axfer: remove unused variable warnings

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoRelease v1.1.9 v1.1.9
Jaroslav Kysela [Fri, 10 May 2019 06:57:22 +0000 (08:57 +0200)]
Release v1.1.9

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoaxfer/test: fix uninitialized warning
Takashi Sakamoto [Mon, 6 May 2019 20:48:47 +0000 (05:48 +0900)]
axfer/test: fix uninitialized warning

This commit fixes uninitialized return value from a call of test_mux() and
text_demux() to suppress warnings below:

$ make check
...
gcc -DHAVE_CONFIG_H -I. -I../../include     -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_mapper’:
mapper-test.c:241:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return err;
         ^~~
mapper-test.c:231:5: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (err < 0)
     ^

Fixes: 39d1ab8a0cb4: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoaxfer/test: fix uninitialized warning
Takashi Sakamoto [Mon, 6 May 2019 20:47:39 +0000 (05:47 +0900)]
axfer/test: fix uninitialized warning

This commit fixes uninitialized return value from a call of test_vector()
to suppress a warning below.

gcc -DHAVE_CONFIG_H -I. -I../../include     -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_vector’:
mapper-test.c:293:6: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int err;
      ^~~

Fixes: 39d1ab8a0cb4: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoaxfer: Declare global variables as 'extern' in header
Samuel Holland [Sun, 21 Apr 2019 00:13:20 +0000 (19:13 -0500)]
axfer: Declare global variables as 'extern' in header

This avoids multiple definitions of the same global variable (one in
each file that includes this header), and fixes a linking error when
compiled with -fno-common.

Fixes: 96110793b3e5 ("axfer: add support for a container of raw data")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoaxfer: Fix creation of v1.2 headers on big-endian systems
Samuel Holland [Sun, 21 Apr 2019 00:15:54 +0000 (19:15 -0500)]
axfer: Fix creation of v1.2 headers on big-endian systems

struct block_v120_format defines these members as uint8_t. On
little-endian systems, no swapping is done, and the generated block
header is fine. However, on big-endian machines, the value is swapped to
the high byte and then truncated by the assignment, causing both
bits_per_sample and samples_per_frame to be zero.

This fixes an assertion failure in container-test when later
parsing the header ["assert(*samples_per_frame > 0);" in
container_context_pre_process()].

Fixes: 4ab7510f3a18: ("axfer: add support for a container of Creative Tech. voice format")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoamixer: define _GNU_SOURCE to get exp10
Milton Vandersloot [Wed, 27 Mar 2019 16:36:54 +0000 (17:36 +0100)]
amixer: define _GNU_SOURCE to get exp10

Get rid of a warning about implicit declaration of exp10, which is
behind _GNU_SOURCE as a non-standard feature. The same problem was fixed
for alsamixer in commit 116488e5f2f1b897084bd151381ee254e1cc177d.

Signed-off-by: Milton Vandersloot <miltonvandersloot@fake-box.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoxfer: fix possible minor memory leak in xfer_options_parse_args() (coverity)
Jaroslav Kysela [Wed, 13 Mar 2019 16:21:16 +0000 (17:21 +0100)]
xfer: fix possible minor memory leak in xfer_options_parse_args() (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoaxfer: return back unsigned avail variable, do proper retype in xfer-libasound-irq...
Jaroslav Kysela [Wed, 13 Mar 2019 13:51:12 +0000 (14:51 +0100)]
axfer: return back unsigned avail variable, do proper retype in xfer-libasound-irq-mmap.c

Signed-off-by: Jaroslav Kysela <perex@perex.cz>