]> git.alsa-project.org Git - alsa-lib.git/log
alsa-lib.git
2 years agodoxygen: fix image path
borine [Sat, 29 Jul 2023 10:22:49 +0000 (11:22 +0100)]
doxygen: fix image path

From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agodoxygen: fix broken parameter name tags
borine [Sat, 29 Jul 2023 10:08:25 +0000 (11:08 +0100)]
doxygen: fix broken parameter name tags

From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agodoxygen: Fix missing group end markers
borine [Sat, 29 Jul 2023 09:49:18 +0000 (10:49 +0100)]
doxygen: Fix missing group end markers

From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoreshuffle included files to include config.h as first
Jaroslav Kysela [Wed, 30 Aug 2023 16:22:59 +0000 (18:22 +0200)]
reshuffle included files to include config.h as first

config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).

Related: https://github.com/alsa-project/alsa-lib/pull/333
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoconfigure: add AC_SYS_LARGEFILE
Jaroslav Kysela [Wed, 30 Aug 2023 15:03:24 +0000 (17:03 +0200)]
configure: add AC_SYS_LARGEFILE

The support for the large files may be disabled using
--disable-largefile configure parameter.

Related: https://github.com/alsa-project/alsa-lib/pull/333
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoseq: Fix wrong seq version update at snd_seq_hw_get_client_info()
Takashi Iwai [Sat, 26 Aug 2023 19:21:13 +0000 (21:21 +0200)]
seq: Fix wrong seq version update at snd_seq_hw_get_client_info()

snd_seq_hw_get_client_info() calls mistakenly update_midi_version()
that leads to the update of seq->version from another client info.
It may lead to the inconsistent packet size calculation and the
unaligned read, eventually a program may hit segfault.

Drop the incorrect call of update_midi_version() for fixing it.

Fixes: 2aefb5c41cc0 ("seq: Add UMP support")
Closes: https://github.com/alsa-project/alsa-utils/issues/232
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoseq: Add overflow check in snd_seq_ev_set_ump_data()
Takashi Iwai [Thu, 24 Aug 2023 17:24:03 +0000 (19:24 +0200)]
seq: Add overflow check in snd_seq_ev_set_ump_data()

It's better to add a sanity check than sorry for breaking.
Now the function return -EINVAL.

Closes: https://github.com/alsa-project/alsa-lib/issues/346
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agotest: oldapi - fix the clang-16 compilation error
Jaroslav Kysela [Tue, 22 Aug 2023 14:51:39 +0000 (16:51 +0200)]
test: oldapi - fix the clang-16 compilation error

Fixes: https://github.com/alsa-project/alsa-lib/issues/323
From: Fabio Scaccabarozzi
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agorawmidi: Suppress error messages for non-fatal errors
Takashi Iwai [Tue, 22 Aug 2023 12:29:03 +0000 (14:29 +0200)]
rawmidi: Suppress error messages for non-fatal errors

Align the behavior of rawmidi errors at open & co with PCM, i.e. use
SYSMSG() instead of SYSERR() for suppressing the error messages as
default.

Closes: https://github.com/alsa-project/alsa-lib/issues/344
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoseq: ump: Fix typo in function name containing "group"
Takashi Iwai [Fri, 28 Jul 2023 15:35:02 +0000 (17:35 +0200)]
seq: ump: Fix typo in function name containing "group"

In a couple places the function names were misspelled as "gruop"
instead of "group".  Fix them.

Reported-by: Jean-Michaël Celerier <jeanmichael.celerier@gmail.com>
Fixes: https://github.com/alsa-project/alsa-lib/pull/337
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agopcm: hw: fix minor bug in sw_params ioctl
Dan Cross [Wed, 14 Jun 2023 21:09:10 +0000 (21:09 +0000)]
pcm: hw: fix minor bug in sw_params ioctl

Commit 2115cdb added a new call to the `SNDRV_PCM_IOCTL_SW_PARAMS`
ioctl on line 675 of src/pcm/pcm_hw.c, but passed the `sw_params`
argument by value; this should be passed by pointer.

I ran across this in the context of the direwolf software modem
for amateur radio; debugging details are in
https://groups.io/g/direwolf/message/8286

Fixes: https://github.com/alsa-project/alsa-lib/pull/330
Signed-off-by: Dan Cross <cross@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoseq: Add UMP 1.1 features
Takashi Iwai [Mon, 27 Mar 2023 08:43:50 +0000 (10:43 +0200)]
seq: Add UMP 1.1 features

Add APIs for groupless message filtering.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoump: Add UMP 1.1 features
Takashi Iwai [Wed, 22 Mar 2023 13:04:35 +0000 (14:04 +0100)]
ump: Add UMP 1.1 features

Add a few new features for UMP 1.1:
- New attributes in UMP Endpoint and Block info
- Static block bit flag for EP info

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agouapi: Update rawmidi API to 2.0.4
Takashi Iwai [Wed, 22 Mar 2023 13:02:15 +0000 (14:02 +0100)]
uapi: Update rawmidi API to 2.0.4

Sync with the kernel change of rawmidi API for supporting UMP 1.1
features.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoseq: Add UMP support
Takashi Iwai [Thu, 17 Nov 2022 14:49:44 +0000 (15:49 +0100)]
seq: Add UMP support

This patch adds the basic support of UMP on ALSA sequencer API.
An extended event type, snd_seq_ump_event_t, is defined.  It's
compatible with the existing type, snd_seq_event_t, but it has a
larger payload of 16 bytes instead of 12 bytes, for holding the full
128bit UMP packet.

The new snd_seq_ump_event_t must have the bit SND_SEQ_EVENT_UMP in the
event flags.

A few new API functions have been added such as
snd_seq_ump_event_output() and snd_seq_ump_event_input() for
reading/writing this new event object.

The support of UMP in the sequencer client is switched by the function
snd_seq_client_set_midi_version().  It can switch from the default
legacy MIDI to UMP MIDI 1.0 or 2.0 on the fly.

The automatic event conversion among UMP and legacy clients can be
suppressed via snd_seq_client_set_ump_conversion().

The inquiry of the associated UMP Endpoints and UMP Blocks can be done
via snd_seq_get_ump_endpoint_info() and snd_seq_get_ump_block_info().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agouapi: Update asequencer.h definitions for 1.0.3
Takashi Iwai [Wed, 16 Nov 2022 16:08:43 +0000 (17:08 +0100)]
uapi: Update asequencer.h definitions for 1.0.3

Updated from kernel for supporting UMP on sequencer API.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoump: Add helpers for handling SysEx data
Takashi Iwai [Tue, 29 Nov 2022 15:42:45 +0000 (16:42 +0100)]
ump: Add helpers for handling SysEx data

Yet a few more helpers for handling SysEx data with UMP packets.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoump: Add helpers to parse / set UMP packet data
Takashi Iwai [Tue, 29 Nov 2022 15:30:47 +0000 (16:30 +0100)]
ump: Add helpers to parse / set UMP packet data

This patch defines the structs / unions that can be used for encoding
and decoding UMP packets, as well as inline helper functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agocontrol: Add UMP Endpoint and Block info query support
Takashi Iwai [Mon, 22 May 2023 16:04:40 +0000 (18:04 +0200)]
control: Add UMP Endpoint and Block info query support

Add functions to query the UMP Endpoint and Block info via control
interface.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agocontrol: Add UMP device query support
Takashi Iwai [Sun, 25 Dec 2022 11:09:51 +0000 (12:09 +0100)]
control: Add UMP device query support

Add a function to query the next available UMP device via control
interface, just like the existing one for rawmidi.  As the UMP rawmidi
is compatible with the standard rawmidi, no extra helper for the
rawmidi_info is present.  Ditto for the preferred subdevice, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoump: Add initial support
Takashi Iwai [Tue, 29 Nov 2022 15:02:25 +0000 (16:02 +0100)]
ump: Add initial support

This patch adds the initial support for UMP rawmidi access.
It's merely the wrapper for the standard rawmidi to access to the UMP
rawmidi device.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agorawmidi: Add UMP ioctl support
Takashi Iwai [Tue, 29 Nov 2022 14:24:31 +0000 (15:24 +0100)]
rawmidi: Add UMP ioctl support

Just implement internal callbacks for two new ioctls for UMP
(ump_endpoint_info and ump_block_info).  No public API functions are
added yet here.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agouapi: Update control API to 2.0.9
Takashi Iwai [Mon, 22 May 2023 15:55:51 +0000 (17:55 +0200)]
uapi: Update control API to 2.0.9

Copied from the kernel uapi header for control API.
A few new ioctls have been added for the support of UMP next device
and inquiries of UMP Endpoint and Block info.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agouapi: Update rawmidi API to 2.0.3
Takashi Iwai [Wed, 16 Nov 2022 16:06:27 +0000 (17:06 +0100)]
uapi: Update rawmidi API to 2.0.3

Copied from the kernel uapi header for rawmidi API.
A few new structs and constants for UMP are defined in addition to a
few new ioctls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoremove extra trailing new line in SNDMSG and SNDERR calls
Jaroslav Kysela [Tue, 6 Jun 2023 11:46:53 +0000 (13:46 +0200)]
remove extra trailing new line in SNDMSG and SNDERR calls

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agousecase: add CaptureMicInfoFile field to documentation
Jaroslav Kysela [Tue, 16 May 2023 13:57:15 +0000 (15:57 +0200)]
usecase: add CaptureMicInfoFile field to documentation

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoinclude: fix SND_DLSYM_BUILD_VERSION() for static build
Jaroslav Kysela [Tue, 16 May 2023 07:14:46 +0000 (09:14 +0200)]
include: fix SND_DLSYM_BUILD_VERSION() for static build

Correct the dlsym_name string for nested macros. See Fixes:.

Fixes: https://github.com/alsa-project/alsa-lib/issues/316
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: hw - prevent divide by zero for broken apps
Jaroslav Kysela [Tue, 16 May 2023 06:57:31 +0000 (08:57 +0200)]
pcm: hw - prevent divide by zero for broken apps

Fixes: https://github.com/alsa-project/alsa-lib/issues/318
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoRelease v1.2.9 v1.2.9
Jaroslav Kysela [Thu, 4 May 2023 07:16:16 +0000 (09:16 +0200)]
Release v1.2.9

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: hw: fix the silence size setup in drain
Jaroslav Kysela [Wed, 3 May 2023 20:24:47 +0000 (22:24 +0200)]
pcm: hw: fix the silence size setup in drain

The silence size cannot exceed the silence threshold. Move the check
from the manual condition to the common code. This may happen for
small ring buffers (where the 1/10th second is too large).

Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoconf/emu10k1: remove compat with two decades old drivers
Oswald Buddenhagen [Wed, 3 May 2023 15:55:30 +0000 (17:55 +0200)]
conf/emu10k1: remove compat with two decades old drivers

There really isn't much of a point to clutter the files with this.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: remove duplicate SND_PCM_HW_PARAM_{FIRST,LAST}_* #defines
Oswald Buddenhagen [Wed, 3 May 2023 15:55:34 +0000 (17:55 +0200)]
pcm: remove duplicate SND_PCM_HW_PARAM_{FIRST,LAST}_* #defines

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: add SND_CTL_EINTR open mode
Jaroslav Kysela [Wed, 3 May 2023 09:48:35 +0000 (11:48 +0200)]
pcm: add SND_CTL_EINTR open mode

Add possibility to return -EINTR instead waiting for the event. The
applications may want to handle -EINTR condition themselves.

BugLink: https://github.com/alsa-project/alsa-lib/issues/228
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: add SND_PCM_EINTR open mode
Jaroslav Kysela [Wed, 3 May 2023 09:42:35 +0000 (11:42 +0200)]
pcm: add SND_PCM_EINTR open mode

Add possibility to return -EINTR instead waiting for the event. The
applications may want to handle -EINTR condition themselves.

BugLink: https://github.com/alsa-project/alsa-lib/issues/228
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: improve handling for snd_pcm_wait()
Jaroslav Kysela [Tue, 2 May 2023 14:56:49 +0000 (16:56 +0200)]
pcm: improve handling for snd_pcm_wait()

The snd_pcm_wait() function is called also internally from
the various plugins to wait for the drain with -1 and from i/o
routines in pcm.c.

Define two special negative timeout values to distinguish the
drain and i/o wait and calculate the maximal timeout according
the wait place.

Fixes: https://github.com/alsa-project/alsa-lib/issues/228
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: add new symbols to Versions.in
Jaroslav Kysela [Wed, 3 May 2023 11:43:17 +0000 (13:43 +0200)]
pcm: add new symbols to Versions.in

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: hw: introduce SNDRV_PCM_HW_PARAMS_DRAIN_SILENCE
Jaroslav Kysela [Tue, 2 May 2023 08:34:41 +0000 (10:34 +0200)]
pcm: hw: introduce SNDRV_PCM_HW_PARAMS_DRAIN_SILENCE

The application may not require to touch the playback
sample stream for the drain operation at all. In this case,
the application is responsible to setup a silencing mechanism
for the playback or another graceful stop (like using the
rewind operation).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: hw: introduce SNDRV_PCM_INFO_PERFECT_DRAIN
Jaroslav Kysela [Tue, 25 Apr 2023 12:36:19 +0000 (14:36 +0200)]
pcm: hw: introduce SNDRV_PCM_INFO_PERFECT_DRAIN

Handle the driver informing us that it is not necessary to set up
silencing upon playback draining. This will be the case for drivers
which are guaranteed to not read any samples beyond the application
pointer.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: hw: add drain_silence configuration keyword
Jaroslav Kysela [Tue, 25 Apr 2023 12:33:46 +0000 (14:33 +0200)]
pcm: hw: add drain_silence configuration keyword

  # Add silence in drain (-1 = auto /default/, 0 = off, > 0 milliseconds)
  [drain_silence INT]

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: hw: setup explicit silencing for snd_pcm_drain by default
Jaroslav Kysela [Fri, 21 Apr 2023 14:12:24 +0000 (16:12 +0200)]
pcm: hw: setup explicit silencing for snd_pcm_drain by default

Some applications may not alignt transfers to the period size
and also the driver developers may not follow the consequeces of the
access beyond valid samples in the playback DMA buffer.

To avoid clicks, fill a little silence at the end of the playback
ring buffer when snd_pcm_drain() is called.

Related: https://lore.kernel.org/alsa-devel/20230420113324.877164-2-oswald.buddenhagen@gmx.de/
Related: https://lore.kernel.org/alsa-devel/20230405201219.2197789-2-oswald.buddenhagen@gmx.de/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agocompilation: fix ANDROID -> __ANDROID__ define detection
Maxython [Fri, 10 Feb 2023 20:00:51 +0000 (23:00 +0300)]
compilation: fix ANDROID -> __ANDROID__ define detection

Fixes: https://github.com/alsa-project/alsa-lib/pull/301/
Signed-off-by: Maxython <mixython@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: avoid endless loop in snd_pcm_sw_params_default()
Jaroslav Kysela [Sat, 25 Feb 2023 17:03:37 +0000 (18:03 +0100)]
pcm: avoid endless loop in snd_pcm_sw_params_default()

BugLink: https://lore.kernel.org/alsa-devel/167734349294.22.1388671545195719262@mailman-web.alsa-project.org/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotest: BSD-like fixes
SASANO Takayoshi [Thu, 2 Feb 2023 07:00:45 +0000 (16:00 +0900)]
test: BSD-like fixes

- rename devname -> pcmdev, it conflicts *BSD <stdlib.h> function
- replace <values.h> -> <limits.h> and fix K&R style related warning
- use config.h to determine include <malloc.h>
- add OpenBSD support and fix printf() warning
- fix warning

Fixes: https://github.com/alsa-project/alsa-lib/pull/298
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotype_compat.h: use ESPIPE instead of EPIPE when ESTRPIPE not defined
SASANO Takayoshi [Thu, 2 Feb 2023 06:58:47 +0000 (15:58 +0900)]
type_compat.h: use ESPIPE instead of EPIPE when ESTRPIPE not defined

Fixes: https://github.com/alsa-project/alsa-lib/pull/298
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoconfigure: avoid libdl detecion on *BSD
SASANO Takayoshi [Tue, 3 Jan 2023 02:13:19 +0000 (11:13 +0900)]
configure: avoid libdl detecion on *BSD

NetBSD and OpenBSD has no libdl
FreeBSD and DragonFlyBSD has libdl but dummy

These OSes are no need to use -ldl to use dlopen()

Fixes: https://github.com/alsa-project/alsa-lib/pull/290
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: hw - fix return code checking in snd_pcm_hw_hw_refine
Gunnar Dibbern [Thu, 19 Jan 2023 15:32:42 +0000 (16:32 +0100)]
pcm: hw - fix return code checking in snd_pcm_hw_hw_refine

The isse was introduced in commit 7f2d6c3

Fixes: 7f2d6c3a ("pcm: hw: change rate range syntax")
Fixes: https://github.com/alsa-project/alsa-lib/issues/271
Fixes: https://github.com/alsa-project/alsa-lib/pull/293
Signed-off-by: Gunnar Dibbern <gunnar.dibbern@lht.dlh.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: Parse ignore_suspend property for dapm widget
Amadeusz Sławiński [Tue, 25 May 2021 15:09:21 +0000 (17:09 +0200)]
topology: Parse ignore_suspend property for dapm widget

snd_soc_tplg_dapm_widget has ignore_suspend field, but there is no way
to set value for it, because we don't parse topology field for it.
Fix this by adding parsing code.

Fixes: https://github.com/alsa-project/alsa-lib/pull/230
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: Add decompilation support for ignore_suspend
Amadeusz Sławiński [Thu, 27 May 2021 12:24:49 +0000 (14:24 +0200)]
topology: Add decompilation support for ignore_suspend

Previous patch added build support for ignore_suspend, however it should
be also possible to decompile binary back to human readable form and not
lose data.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: Parse ignore_suspend flag
Cezary Rojewski [Wed, 27 Mar 2019 14:45:04 +0000 (15:45 +0100)]
topology: Parse ignore_suspend flag

XXX_VOICE_WAKEUP also known as 'ignore_suspend' is already processed by
kernel in soc-topology, but there is no way of setting it via topology
file like it's the case for other flags. Fix this by adding it to pcm,
dai and link parsing mechanism.

Signed-off-by: Piotr Maziarz <piotrx.maziarz@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoutils/alsa.m4: include <stdlib.h> for exit()
Sam James [Sun, 30 Oct 2022 18:06:37 +0000 (18:06 +0000)]
utils/alsa.m4: include <stdlib.h> for exit()

Clang 16 makes -Wimplicit-function-declaration an error by default
and it's easier to just explicitly include <stdlib.h> rather
than hope the ALSA headers always have it.

Fixes: https://github.com/alsa-project/alsa-lib/pull/278
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: fix geti() macro - return zero on success
Jaroslav Kysela [Sun, 15 Jan 2023 17:57:56 +0000 (18:57 +0100)]
ucm: fix geti() macro - return zero on success

Fixes: c083417b ("ucm: simplify and fix the previous patch (geti)")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: simplify and fix the previous patch (geti)
Jaroslav Kysela [Sun, 15 Jan 2023 17:32:20 +0000 (18:32 +0100)]
ucm: simplify and fix the previous patch (geti)

Use macro to maintain only one code. The status may be 0 or 1 - handle
both values correctly.

Also, fix the possible memory leak in snd_use_case_geti() - string
str should be freed even when the error is returned.

Fixes: 436cd5b6 ("ucm: add existence checks to geti calls")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: add existence checks to geti calls
Curtis Malainey [Fri, 13 Jan 2023 21:21:55 +0000 (13:21 -0800)]
ucm: add existence checks to geti calls

Right now in snd_use_case_geti you cannot tell if the item being queried
exists or not when being checked. This also means the only way to check
for the existence of something in the client of the library is to
iterate over the list of mods/devs even if we know exactly the name we
are looking for. We have functions that do exactly this internally so
lets return this information in a logical fashion through geti.

Also clean up some trailing white space nearby.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: fix possible memory leak in execute_sysw()
Jaroslav Kysela [Thu, 5 Jan 2023 14:42:31 +0000 (15:42 +0100)]
ucm: fix possible memory leak in execute_sysw()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: rate: fix last_commit_ptr boundary wrapping
Alan Young [Fri, 30 Dec 2022 16:48:14 +0000 (16:48 +0000)]
pcm: rate: fix last_commit_ptr boundary wrapping

Wrap last_commit_ptr using boundary. Was just wrapped to 0, which is
correct only if the buffer size, and hence the boundary, is an integer
multiple of the period size.

Fixes: 467d69c5bc1 ("Fix CPU hog with combination of rate plugin")
Fixes: 29041c52207 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Link: https://lore.kernel.org/alsa-devel/20221230164814.901457-1-consult.awy@gmail.com/
Signed-off-by: Alan Young <consult.awy@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: route/softvol use snd_config_get_ireal vs get_real to handle also integers
Jaroslav Kysela [Tue, 13 Dec 2022 09:31:32 +0000 (10:31 +0100)]
pcm: route/softvol use snd_config_get_ireal vs get_real to handle also integers

Link: https://lore.kernel.org/alsa-devel/f9a7ad6a256d4ad7a31642dcf875d436@axis.com/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoalsa-lib: conf - fix possible use-after-free in get_char_skip_comments
Jaroslav Kysela [Wed, 7 Dec 2022 13:54:30 +0000 (14:54 +0100)]
alsa-lib: conf - fix possible use-after-free in get_char_skip_comments

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: execute_sysw - fix possible use-after-free
Jaroslav Kysela [Wed, 7 Dec 2022 13:49:48 +0000 (14:49 +0100)]
ucm: execute_sysw - fix possible use-after-free

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: ctl - remove the wrong (debug) code
Jaroslav Kysela [Tue, 29 Nov 2022 18:42:13 +0000 (19:42 +0100)]
topology: ctl - remove the wrong (debug) code

This code was commited by mistake. It was used for testing
of ALSA_PCM_OLD_HW/SW_PARAMS_API.

BugLink: https://github.com/thesofproject/sof/issues/6667
Related-to: 78b20e3c ("test: latency - use snd_pcm_format_physical_width()")
Reported-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotest: latency - --policy option - allow using SCHED_OTHER
Jaroslav Kysela [Thu, 24 Nov 2022 09:55:32 +0000 (10:55 +0100)]
test: latency - --policy option - allow using SCHED_OTHER

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotest: latency - add --policy option to allow using SCHED_FIFO
Jaroslav Kysela [Thu, 24 Nov 2022 07:33:47 +0000 (08:33 +0100)]
test: latency - add --policy option to allow using SCHED_FIFO

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotest: latency - usleep should not be used in the block mode
Jaroslav Kysela [Wed, 23 Nov 2022 18:45:15 +0000 (19:45 +0100)]
test: latency - usleep should not be used in the block mode

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotest: latency - add -y option (I/O usleep)
Jaroslav Kysela [Wed, 23 Nov 2022 16:56:20 +0000 (17:56 +0100)]
test: latency - add -y option (I/O usleep)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: handle empty string also for ${env:} substitution
Jaroslav Kysela [Tue, 22 Nov 2022 08:59:04 +0000 (09:59 +0100)]
ucm: handle empty string also for ${env:} substitution

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: clarify set_defaults calls
Jaroslav Kysela [Tue, 15 Nov 2022 16:25:59 +0000 (17:25 +0100)]
ucm: clarify set_defaults calls

- do full reset in snd_use_case_mgr_reload

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agolatency: add timestamps to the POS lines
Jaroslav Kysela [Mon, 14 Nov 2022 20:26:39 +0000 (21:26 +0100)]
latency: add timestamps to the POS lines

- remove first capture pos line
- measure the snd_pcm_start() call, too

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotest: latency - add more realtime tests
Jaroslav Kysela [Mon, 14 Nov 2022 19:42:10 +0000 (20:42 +0100)]
test: latency - add more realtime tests

Add '-x' and '-X' tests and '-U' - I/O update mode based
on the system timing.

It may be required to check the position updates for the specific hardware.
Print the real time / stream time differences.

Also include code to make valgrind happy (including the wrong memory
llocation for the stream buffer).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: fix the fast_ops pcm argument for fast_ops
Jaroslav Kysela [Mon, 14 Nov 2022 13:34:46 +0000 (14:34 +0100)]
pcm: fix the fast_ops pcm argument for fast_ops

The fast_ops callback invocation must always pass the fast_op_arg
as the pcm argument. Plugins expect that.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotest: latency - use snd_pcm_format_physical_width()
Jaroslav Kysela [Mon, 14 Nov 2022 11:36:04 +0000 (12:36 +0100)]
test: latency - use snd_pcm_format_physical_width()

We need to allocate frames using the physical size not
the sample bit size.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoinclude: alsa-symbols.h - use newer gcc symver function attribute
Jaroslav Kysela [Wed, 9 Nov 2022 14:04:06 +0000 (15:04 +0100)]
include: alsa-symbols.h - use newer gcc symver function attribute

Use the symver function attribute for newer gccs (version 11+).
The symver function attribute was introduced probably earlier
(gcc-10). We can fix that on demand later.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoinclude: pcm_old.h - use a macro for the symbol versioning
Jaroslav Kysela [Wed, 9 Nov 2022 13:37:45 +0000 (14:37 +0100)]
include: pcm_old.h - use a macro for the symbol versioning

Make the header file more readable and error prone.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: rate - correct the previous fix for snd_pcm_rate_may_wait_for_avail_min()
Jaroslav Kysela [Wed, 9 Nov 2022 08:31:34 +0000 (09:31 +0100)]
pcm: rate - correct the previous fix for snd_pcm_rate_may_wait_for_avail_min()

The previous fix in aa4f56c3 was not correct. The root of the cause is
implementation in snd_pcm_may_wait_for_avail_min() inline function
where the improper pcm argument is passed to the fast_ops function.

Fixes: aa4f56c3 ("pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()")
Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()
Jaroslav Kysela [Wed, 9 Nov 2022 07:11:42 +0000 (08:11 +0100)]
pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()

The pcm argument passed to the conversion function in
snd_pcm_plugin_may_wait_for_avail_min_conv() should be
pcm->fast_op_arg.

Test command: arecord -Dplughw:x -r12000 -c2 -fS16_LE -M temp.wav

Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin")
BugLink: https://lore.kernel.org/alsa-devel/1667793912-18957-1-git-send-email-shengjiu.wang@nxp.com/
Fixes: https://github.com/alsa-project/alsa-lib/issues/282
Reported-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: fix enhanced ID parsing in snd_use_case_parse_ctl_elem_id()
Jaroslav Kysela [Wed, 2 Nov 2022 14:01:56 +0000 (15:01 +0100)]
ucm: fix enhanced ID parsing in snd_use_case_parse_ctl_elem_id()

Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoRelease v1.2.8 v1.2.8
Jaroslav Kysela [Mon, 24 Oct 2022 08:17:27 +0000 (10:17 +0200)]
Release v1.2.8

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agocontrol: namehint - do not support 'card' devices
Jaroslav Kysela [Mon, 24 Oct 2022 08:02:51 +0000 (10:02 +0200)]
control: namehint - do not support 'card' devices

The card: devices do not exist. Do not return -ENOENT,
but -EINVAL in this case.

Fixes: https://github.com/alsa-project/alsa-lib/issues/277
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoucm: do not handle multiple Syntax field updates
Jaroslav Kysela [Thu, 20 Oct 2022 17:37:32 +0000 (19:37 +0200)]
ucm: do not handle multiple Syntax field updates

It is useful to include a toplevel configuration file from another
toplevel configuration file. Ignore the further Syntax updates
(assuming the that the parent knows what to do).

Also, parse the Syntax field in own function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agocontrol: eld - skip trailing spaces
Jaroslav Kysela [Tue, 18 Oct 2022 13:53:40 +0000 (15:53 +0200)]
control: eld - skip trailing spaces

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agopcm: rate: fix the crash for the partial period copy
Jaroslav Kysela [Mon, 17 Oct 2022 11:52:51 +0000 (13:52 +0200)]
pcm: rate: fix the crash for the partial period copy

The size argument in snd_pcm_rate_commit_area can be smaller
than cont in drain. Return the original code. It should
not make things worse. Perhaps, we can fill the rest of
the period with silence in this case.

Fixes: https://github.com/alsa-project/alsa-lib/issues/274
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoRemove non existent SPDIF output on ThinkPad USB-C Dock Gen2
Swapnil Devesh [Sat, 27 Aug 2022 08:03:53 +0000 (13:33 +0530)]
Remove non existent SPDIF output on ThinkPad USB-C Dock Gen2

Fixes: https://github.com/alsa-project/alsa-lib/pull/268
Signed-off-by: Swapnil Devesh <sid.swapnildevesh@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoadd DragonFlyBSD build support (except test/)
SASANO Takayoshi [Wed, 13 Jul 2022 12:36:59 +0000 (21:36 +0900)]
add DragonFlyBSD build support (except test/)

due to undefined reference to 'environ' error, ucm_exec.c uses workaround.

Fixes: https://github.com/alsa-project/alsa-lib/pull/250
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoadd FreeBSD build support (except test/)
SASANO Takayoshi [Tue, 12 Jul 2022 11:37:44 +0000 (20:37 +0900)]
add FreeBSD build support (except test/)

Note: NetBSD and OpenBSD has both <endian.h> and <sys/endian.h>

Fixes: https://github.com/alsa-project/alsa-lib/pull/250
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoadd NetBSD/OpenBSD build support (except test/)
SASANO Takayoshi [Sun, 10 Jul 2022 02:03:00 +0000 (11:03 +0900)]
add NetBSD/OpenBSD build support (except test/)

Fixes: https://github.com/alsa-project/alsa-lib/pull/250
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agodoc: ucm - more volume notes
Jaroslav Kysela [Fri, 16 Sep 2022 17:24:27 +0000 (19:24 +0200)]
doc: ucm - more volume notes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agodoc: ucm - add sequence graphs
Jaroslav Kysela [Fri, 16 Sep 2022 17:02:16 +0000 (19:02 +0200)]
doc: ucm - add sequence graphs

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: hw_params - copy periods and buffer_time to the local variable
Jaroslav Kysela [Thu, 18 Aug 2022 09:23:42 +0000 (11:23 +0200)]
pcm: hw_params - copy periods and buffer_time to the local variable

It is expected to return the correct numbers for get_periods and
get_buffer_time requests. Copy the appropriate fields in the
hw_params call.

Fixes: https://github.com/alsa-project/alsa-lib/issues/258
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: fix the dshare delay reporting
Jaroslav Kysela [Tue, 16 Aug 2022 15:21:12 +0000 (17:21 +0200)]
pcm: fix the dshare delay reporting

Pulseaudio uses full ring buffer when the incorrect delay is reported.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/198
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: add NULL check for card_name in open
Jaroslav Kysela [Fri, 8 Jul 2022 20:00:34 +0000 (22:00 +0200)]
ucm: add NULL check for card_name in open

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: fix few memory-leaks in the error paths
Jaroslav Kysela [Fri, 8 Jul 2022 19:56:57 +0000 (21:56 +0200)]
ucm: fix few memory-leaks in the error paths

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: direct plugins: make three more symbols private to library
Jaroslav Kysela [Fri, 8 Jul 2022 19:44:44 +0000 (21:44 +0200)]
pcm: direct plugins: make three more symbols private to library

Those symbols should not be exported:
snd_pcm_direct_poll_descriptors
snd_pcm_direct_check_xrun
snd_pcm_direct_slave_recover

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoRelease v1.2.7.2 v1.2.7.2
Jaroslav Kysela [Fri, 8 Jul 2022 15:34:30 +0000 (17:34 +0200)]
Release v1.2.7.2

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoinclude/sound/type_compat.h: fix include guard
SASANO Takayoshi [Fri, 1 Jul 2022 20:55:11 +0000 (05:55 +0900)]
include/sound/type_compat.h: fix include guard

include/sound/type_compat.h uses #define __TYPE_COMPAT_H but it conflicts
same include guard of include/type_compat.h

now, include/sound/type_compat.h uses #define __SOUND_TYPE_COMPAT_H

this is already done in NetBSD's pkgsrc patch.

(thanks to tsutsui@netbsd.org)

Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoucm: fix st_mode check for symbolic links
Stephan Gerhold [Fri, 8 Jul 2022 12:50:54 +0000 (14:50 +0200)]
ucm: fix st_mode check for symbolic links

The file type in the st_mode field is not encoded as unique bits but as
an enumerator. Checking if some bits of S_IFLNK are set does not work
correctly because it happens to evaluate to true for regular files as
well.

The POSIX man page suggests using the following approach to check
the file type:

    if ((sb.st_mode & S_IFMT) == S_IFLNK)

Alternatively, there is a S_ISLNK() macro to check this more easily.

Make use of the latter so that readlink() is only called on actual
symbolic links and not regular files. This makes audio work again
with slightly older alsa-ucm-conf versions or alternative top-level
ucm.conf configurations that do not make use of symlinks.

Fixes: d6adde0e ("ucm: top-level path - set directory from symlink")
Fixes: https://github.com/alsa-project/alsa-lib/pull/249
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agomixer: add documentation about postcondition of removal event processing
Takashi Sakamoto [Mon, 27 Jun 2022 00:24:29 +0000 (09:24 +0900)]
mixer: add documentation about postcondition of removal event processing

PulseAudio and PipeWire seems to appear including careless code to
process events of mixer element in implementation of mixer class.

 * https://lore.kernel.org/alsa-devel/YrbxZ2b+3rIdi7Ut@workstation/

They register own implementation of mixer class. At addition event,
they attach own mixer element into hcontrol element. However at removal
event, they never detach the mixer element from hcontrol element. They
hit assertion in mixer API internal due to unsatisfied postcondition.

This commit adds documentation about postcondition of removal event
processing so that developer for implementation of mixer class easily
realize the way to satisfy the postcondition.

Fixes: https://github.com/alsa-project/alsa-lib/pull/244
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: share plugin: handle -EINTR
Jaroslav Kysela [Mon, 27 Jun 2022 11:36:12 +0000 (13:36 +0200)]
pcm: share plugin: handle -EINTR

Fixes: https://github.com/alsa-project/alsa-lib/pull/242
Fixes: b97047b4 ("pcm: share plugin: return error if socket read or write call fails")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: share plugin: return error if socket read or write call fails
Tomohiro IKEDA [Sat, 18 Jun 2022 22:05:17 +0000 (07:05 +0900)]
pcm: share plugin: return error if socket read or write call fails

Fixes: https://github.com/alsa-project/alsa-lib/pull/242
Signed-off-by: Tomohiro IKEDA <rilakkuma.san.xjapan@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agorawmidi: fix the params_mode check condition in snd_rawmidi_tread()
Jaroslav Kysela [Sun, 26 Jun 2022 14:07:56 +0000 (16:07 +0200)]
rawmidi: fix the params_mode check condition in snd_rawmidi_tread()

The condition should be obviously reversed.

Reported-by: Mark ZurSchmiede <zursch@gmail.com>
Fixes: 5ac61983 ("rawmidi: allow timestamp reads only for the appropriate read mode")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoRelease v1.2.7.1 v1.2.7.1
Jaroslav Kysela [Fri, 17 Jun 2022 09:42:05 +0000 (11:42 +0200)]
Release v1.2.7.1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agooutput: include stdarg.h
Bernd Kuhls [Sat, 11 Jun 2022 17:12:19 +0000 (19:12 +0200)]
output: include stdarg.h

Fixes a build error with alsa-utils when build with a uClibc toolchain:

alsa-utils/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/alsa/output.h:75:66:
 error: unknown type name ‘va_list’
   75 | int snd_output_vprintf(snd_output_t *output, const char *format, va_list args);
      |                                                                  ^~~~~~~
alsa-utils/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/alsa/output.h:1:1:
 note: ‘va_list’ is defined in header ‘<stdarg.h>’; did you forget to ‘#include <stdarg.h>’?

Fixes: https://github.com/alsa-project/alsa-lib/pull/237
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agopcm: dmix - Add error handler for `fgets`
Tomohiro IKEDA [Tue, 14 Jun 2022 23:45:19 +0000 (08:45 +0900)]
pcm: dmix - Add error handler for `fgets`

Fixes: https://github.com/alsa-project/alsa-lib/pull/238
Signed-off-by: Tomohiro IKEDA <rilakkuma.san.xjapan@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>