From fab6dfb0d1daeb35a867ec1ad9a9ee30da8cc278 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 31 Mar 2026 01:19:02 +0300 Subject: [PATCH] utils: sofprobeclient: add -D flag for parser debug messages Move the "We read N, DSP sent M" diagnostic behind a new -D (parser debug) flag so it does not clutter normal output. Closes: https://github.com/alsa-project/tinycompress/pull/35 Signed-off-by: Jyri Sarha Signed-off-by: Jaroslav Kysela --- src/utils/sofprobeclient.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/sofprobeclient.c b/src/utils/sofprobeclient.c index 6e10b44..60f4007 100644 --- a/src/utils/sofprobeclient.c +++ b/src/utils/sofprobeclient.c @@ -81,6 +81,7 @@ #include "probes_demux.h" static int verbose; +static int parser_debug; static FILE *finfo; static const unsigned int DEFAULT_CHANNELS = 4; @@ -98,6 +99,7 @@ static void usage(void) "-b\tbuffer size (default 8192)\n" "-f\tfragments (default 4)\n" "-v\tverbose mode\n" + "-D\tenable parser debug messages\n" "-l\tlength of record in seconds (0 = unlimited)\n" "-h\tPrints this help list\n\n" "-C\tSpecify the number of channels (default %u)\n" @@ -213,7 +215,7 @@ static void capture_and_parse(unsigned int card, unsigned int device, fprintf(stderr, "ERR: %s\n", compress_get_error(compress)); goto buf_exit; } - if ((unsigned int)read != size) { + if (parser_debug && (unsigned int)read != size) { fprintf(stderr, "We read %d, DSP sent %d\n", size, read); } @@ -309,7 +311,7 @@ int main(int argc, char **argv) verbose = 0; finfo = stderr; - while ((c = getopt(argc, argv, "hvl:R:C:F:b:f:c:d:")) != -1) { + while ((c = getopt(argc, argv, "hvDl:R:C:F:b:f:c:d:")) != -1) { switch (c) { case 'h': usage(); @@ -329,6 +331,9 @@ int main(int argc, char **argv) case 'v': verbose = 1; break; + case 'D': + parser_debug = 1; + break; case 'l': length = strtol(optarg, NULL, 10); break; -- 2.52.0