[PATCH] amixer: handle simple mixer event errors
Bojan Janjatović <[email protected]>
| Newsgroups | org.alsa-project.alsa-devel |
|---|---|
| Message-ID | <CAA-EO1cvs+qy=k7uEC2DQ+PURK5+9V8fL5jxE8jfEM4ShvXWcQ@mail.gmail.com> |
nd_mixer_handle_events() can return negative runtime errors while amixer sevents is monitoring simple mixer events. This was reproduced during early PipeWire startup, where the handler returned -ENOENT after snd_mixer_wait() reported a ready event. The raw control event monitor already reports analogous snd_hctl_handle_events() errors instead of aborting. Handle simple mixer event errors the same way so sevents reports the error and keeps listening instead of hitting an assertion failure. Fixes: https://github.com/alsa-project/alsa-utils/issues/327 Signed-off-by: Bojan Janjatović <[email protected]> --- amixer/amixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amixer/amixer.c b/amixer/amixer.c index 07e9819..cf3db8e 100644 --- a/amixer/amixer.c +++ b/amixer/amixer.c @@ -27,7 +27,6 @@ #include <ctype.h> #include <math.h> #include <errno.h> -#include <assert.h> #include <alsa/asoundlib.h> #include <poll.h> #include <stdint.h> @@ -1703,7 +1702,8 @@ static int sevents(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) if (res >= 0) { printf("Poll ok: %i\n", res); res = snd_mixer_handle_events(handle); - assert(res >= 0); + if (res < 0) + printf("ERR: %s (%d)\n", snd_strerror(res), res); } } snd_mixer_close(handle); -- 2.54.0