From bcbdf24e014ec7bf17d2dd6a987fb206c6f2241e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 6 Aug 2025 10:28:15 +0200 Subject: [PATCH] amixer: always use line buffering for (s)events Line buffering is the obviously correct mode for (s)events, but block buffering would typically be used when piping its output to another program. Closes: https://github.com/alsa-project/alsa-utils/pull/306 Signed-off-by: Anton Khirnov Signed-off-by: Jaroslav Kysela --- amixer/amixer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/amixer/amixer.c b/amixer/amixer.c index 5ca81ff..cc71fbe 100644 --- a/amixer/amixer.c +++ b/amixer/amixer.c @@ -1596,6 +1596,8 @@ static int events(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) snd_hctl_elem_t *helem; int err; + setlinebuf(stdout); + if ((err = snd_hctl_open(&handle, card, 0)) < 0) { error("Control %s open error: %s\n", card, snd_strerror(err)); return err; @@ -1675,6 +1677,8 @@ static int sevents(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) snd_mixer_t *handle; int err; + setlinebuf(stdout); + if ((err = snd_mixer_open(&handle, 0)) < 0) { error("Mixer %s open error: %s", card, snd_strerror(err)); return err; -- 2.52.0