Commit graph

1805 commits

Author SHA1 Message Date
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
Jaroslav Kysela
17612386e0 README.md: add build status badge
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-18 20:08:37 +01:00
Jaroslav Kysela
f14a2cbced github: create test workflow for fedora and ubuntu
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-18 20:08:37 +01: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
Michael Forney
cb47f6dcf4 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>
2020-02-10 12:39:43 +01:00
Michael Forney
646b3b1c0b 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>
2020-02-10 12:39:17 +01:00
Michael Forney
62a765087e 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>
2020-02-10 12:38:52 +01:00
Michael Forney
f80a290153 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>
2020-02-10 12:38:28 +01:00
Jaroslav Kysela
996a638e04 configure: fix new libatopology check 2020-02-09 20:52:30 +01:00
Jaroslav Kysela
56e1b879d4 alsatplg: add documentation for -z,--dapm-nosort (-h)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-09 20:52:30 +01:00
Jaroslav Kysela
786c3ee814 alsatplg: add decode command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-09 20:52:30 +01:00
Jaroslav Kysela
32e7016fd7 alsatplg: add -V,--version option
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-02-09 20:52:30 +01:00
Jaroslav Kysela
cbabe7a3f0 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>
2020-02-09 20:52:30 +01:00
David Ward
27b5c6c19c 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>
2020-01-07 14:04:41 +01:00
David Ward
fe322c46e6 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>
2020-01-07 14:04:41 +01:00
David Ward
f93d491a08 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>
2020-01-07 14:04:41 +01:00
David Ward
ad49ee756b 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>
2020-01-07 14:04:41 +01:00
David Ward
1ebe877b8d 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>
2020-01-07 14:04:40 +01:00
David Ward
d928f7667c 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>
2020-01-07 14:04:40 +01:00
David Ward
e9e3c3a27d 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>
2020-01-07 14:04:40 +01:00
David Ward
de5ce14163 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>
2020-01-07 14:04:40 +01:00
David Ward
068dd55717 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>
2020-01-07 14:04:40 +01:00
David Ward
86b1f80e24 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>
2020-01-07 14:04:39 +01:00
David Ward
11e083d81c 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>
2020-01-07 14:04:39 +01:00
Jaroslav Kysela
10db898d9b alsatplg: fix another small leak in normalize_config()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-13 10:44:36 +01:00
Jaroslav Kysela
2656d4bec8 alsatplg: add -s,--sort and fix memory leaks
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-12 19:18:28 +01:00
Jaroslav Kysela
08d2341a17 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>
2019-12-12 19:01:58 +01:00
Jaroslav Kysela
f77a269370 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>
2019-12-03 20:52:42 +01:00
Jaroslav Kysela
34e373d0b1 alsactl: fix --sched-idle (set it really to SCHED_IDLE)
Reported-by: tommy <tommy@kelsos.ptp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-03 13:53:25 +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
3c740d9049 alsactl: sysfs - add /sys/kernel/uevent_seqnum check to init
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 18:01:32 +01:00
Rosen Penev
c9dc401264 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>
2019-11-20 22:01:26 +01:00
Rosen Penev
ac82b65167 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>
2019-11-20 19:46:55 +01:00
Rosen Penev
80fd81f4a8 treewide: Fix printf formats
Found with cppcheck

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:46:17 +01:00