git: 63dcf7fda2b0 - main - mixer(8): Fix mixer status line for /dev/dspX.vpY mixer devices.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 15 Oct 2021 09:14:43 UTC
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=63dcf7fda2b0ec1a2f74406dd26a659914a0c17c commit 63dcf7fda2b0ec1a2f74406dd26a659914a0c17c Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2021-10-15 09:11:44 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2021-10-15 09:13:29 +0000 mixer(8): Fix mixer status line for /dev/dspX.vpY mixer devices. In some cases when passing /dev/dspX.vpY as mixer devices, m->ci.longname and m->ci.hw_info will be empty. Don't print any brackets and parentheses in this case. Differential Revision: https://reviews.freebsd.org/D32500 Submitted by: christos@ Sponsored by: NVIDIA Networking --- usr.sbin/mixer/mixer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index c32b87fdb7f0..f0e0c2d3b22b 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -219,15 +219,23 @@ printminfo(struct mixer *m, int oflag) if (oflag) return; - printf("%s: <%s> %s", m->mi.name, m->ci.longname, m->ci.hw_info); - printf(" ("); + printf("%s:", m->mi.name); + if (*m->ci.longname != '\0') + printf(" <%s>", m->ci.longname); + if (*m->ci.hw_info != '\0') + printf(" %s", m->ci.hw_info); + + if (m->mode != 0) + printf(" ("); if (m->mode & MIX_MODE_PLAY) printf("play"); if ((m->mode & playrec) == playrec) printf("/"); if (m->mode & MIX_MODE_REC) printf("rec"); - printf(")"); + if (m->mode != 0) + printf(")"); + if (m->f_default) printf(" (default)"); printf("\n");