Date: Mon, 04 May 2026 12:10:44 +0000 From: Christos Margiolis <christos@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 1b149c2a9735 - stable/15 - mixer(8): Deprecate some unintuitive control values Message-ID: <69f88cc4.39306.3f92b042@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=1b149c2a973526df6ba63f8521c4591aa7250d50 commit 1b149c2a973526df6ba63f8521c4591aa7250d50 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2026-04-23 12:06:15 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2026-05-04 12:10:25 +0000 mixer(8): Deprecate some unintuitive control values This is a follow-up to cc7479d7dc9b ("mixer(8): Improve mute and recsrc controls"). These deprecated values will be completely removed on 2026-06-15. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: 0mp Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/21 (cherry picked from commit a28bb575c89c8de62684419ece1ff5e070e4ce24) (cherry picked from commit 54922e4ec8909829a7ca8d2158c2a514a06df094) --- usr.sbin/mixer/mixer.8 | 20 +++++++--------- usr.sbin/mixer/mixer.c | 48 ++++++++++++++++++++++++-------------- usr.sbin/mixer/tests/mixer_test.sh | 18 +------------- 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8 index bdff0dbedc11..2d12e6057797 100644 --- a/usr.sbin/mixer/mixer.8 +++ b/usr.sbin/mixer/mixer.8 @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org> +.\" Copyright (c) 2021-2026 Christos Margiolis <christos@FreeBSD.org> .\" .\" Permission is hereby granted, free of charge, to any person obtaining a copy .\" of this software and associated documentation files (the "Software"), to deal @@ -19,7 +19,7 @@ .\" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN .\" THE SOFTWARE. .\" -.Dd February 26, 2026 +.Dd April 4, 2026 .Dt MIXER 8 .Os .Sh NAME @@ -113,9 +113,7 @@ with one of the available devices): .Oo Cm \&+ | Cm \&- Oc Ar lvol Oo % Oc .Oo Cm \&: Oo Cm \&+ | Cm \&- Oc Ar rvol Oo % Oc Oc .Xc -.It Ar dev Cm .mute Ta Cm 0 | 1 | ^ .It Ar dev Cm .mute Ta Cm off | on | toggle -.It Ar dev Cm .recsrc Ta Cm ^ | + | - | = .It Ar dev Cm .recsrc Ta Cm toggle | add | remove | set .El .Sm on @@ -153,13 +151,13 @@ The control (un)mutes a device. The following values are available: .Bl -tag -width "xxxxxxxxxx" -offset indent -.It Cm 0 | off +.It Cm off unmutes .Ar dev -.It Cm 1 | on +.It Cm on mutes .Ar dev -.It Cm ^ | toggle +.It Cm toggle toggles the mute of .Ar dev .El @@ -177,19 +175,19 @@ on a .Sy rec device: .Bl -tag -width "xxxxxxxxxx" -offset indent -.It Cm ^ | toggle +.It Cm toggle toggles .Ar dev of possible recording devices -.It Cm + | add +.It Cm add adds .Ar dev to possible recording devices -.It Cm - | remove +.It Cm remove removes .Ar dev from possible recording devices -.It Cm = | set +.It Cm set makes .Ar dev the only recording device. diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index a0fc9705a301..c9efacc666eb 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org> + * Copyright (c) 2021-2026 Christos Margiolis <christos@FreeBSD.org> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -428,16 +428,22 @@ mod_mute(struct mix_dev *d, void *p) m = d->parent_mixer; cp = mixer_get_ctl(m->dev, C_MUT); val = p; - if (strncmp(val, "off", strlen(val)) == 0 || - strncmp(val, "0", strlen(val)) == 0) + if (strncmp(val, "off", strlen(val)) == 0) { opt = MIX_UNMUTE; - else if (strncmp(val, "on", strlen(val)) == 0 || - strncmp(val, "1", strlen(val)) == 0) + } else if (strncmp(val, "0", strlen(val)) == 0) { + warnx("%s: deprecated: use \"off\" instead", val); + opt = MIX_UNMUTE; + } else if (strncmp(val, "on", strlen(val)) == 0) { + opt = MIX_MUTE; + } else if (strncmp(val, "1", strlen(val)) == 0) { + warnx("%s: deprecated: use \"on\" instead", val); opt = MIX_MUTE; - else if (strncmp(val, "toggle", strlen(val)) == 0 || - strncmp(val, "^", strlen(val)) == 0) + } else if (strncmp(val, "toggle", strlen(val)) == 0) { + opt = MIX_TOGGLEMUTE; + } else if (strncmp(val, "^", strlen(val)) == 0) { + warnx("%s: deprecated: use \"toggle\" instead", val); opt = MIX_TOGGLEMUTE; - else { + } else { warnx("%s: no such modifier", val); return (-1); } @@ -464,19 +470,27 @@ mod_recsrc(struct mix_dev *d, void *p) m = d->parent_mixer; cp = mixer_get_ctl(m->dev, C_SRC); val = p; - if (strncmp(val, "add", strlen(val)) == 0 || - strncmp(val, "+", strlen(val)) == 0) + if (strncmp(val, "add", strlen(val)) == 0) { + opt = MIX_ADDRECSRC; + } else if (strncmp(val, "+", strlen(val)) == 0) { + warnx("%s: deprecated: use \"add\" instead", val); opt = MIX_ADDRECSRC; - else if (strncmp(val, "remove", strlen(val)) == 0 || - strncmp(val, "-", strlen(val)) == 0) + } else if (strncmp(val, "remove", strlen(val)) == 0) { opt = MIX_REMOVERECSRC; - else if (strncmp(val, "set", strlen(val)) == 0 || - strncmp(val, "=", strlen(val)) == 0) + } else if (strncmp(val, "-", strlen(val)) == 0) { + warnx("%s: deprecated: use \"remove\" instead", val); + opt = MIX_REMOVERECSRC; + } else if (strncmp(val, "set", strlen(val)) == 0) { + opt = MIX_SETRECSRC; + } else if (strncmp(val, "=", strlen(val)) == 0) { + warnx("%s: deprecated: use \"set\" instead", val); opt = MIX_SETRECSRC; - else if (strncmp(val, "toggle", strlen(val)) == 0 || - strncmp(val, "^", strlen(val)) == 0) + } else if (strncmp(val, "toggle", strlen(val)) == 0) { opt = MIX_TOGGLERECSRC; - else { + } else if (strncmp(val, "^", strlen(val)) == 0) { + warnx("%s: deprecated: use \"toggle\" instead", val); + opt = MIX_TOGGLERECSRC; + } else { warnx("%s: no such modifier", val); return (-1); } diff --git a/usr.sbin/mixer/tests/mixer_test.sh b/usr.sbin/mixer/tests/mixer_test.sh index c48512db5ec7..da5f4d7566bc 100755 --- a/usr.sbin/mixer/tests/mixer_test.sh +++ b/usr.sbin/mixer/tests/mixer_test.sh @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2024 The FreeBSD Foundation +# Copyright (c) 2024-2026 The FreeBSD Foundation # # This software was developed by Christos Margiolis <christos@FreeBSD.org> # under sponsorship from the FreeBSD Foundation. @@ -210,16 +210,6 @@ mute_body() atf_check -o ignore -e empty mixer vol.mute=toggle atf_check -o match:"=off" mixer vol.mute - # Test deprecated interface - atf_check -o ignore -e empty mixer vol.mute=0 - atf_check -o match:"=off" mixer vol.mute - - atf_check -o ignore -e empty mixer vol.mute=1 - atf_check -o match:"=on" mixer vol.mute - - atf_check -o ignore -e empty mixer vol.mute=^ - atf_check -o match:"=off" mixer vol.mute - # Test wrong values atf_check -o ignore -e not-empty mixer vol.mute=foobar atf_check -o ignore -e not-empty mixer vol.mute=10 @@ -248,12 +238,6 @@ recsrc_body() atf_check -o ignore -e empty mixer ${recsrc}.recsrc=set atf_check -o ignore -e empty mixer ${recsrc}.recsrc=toggle - # Test deprecated interface - atf_check -o ignore -e empty mixer ${recsrc}.recsrc=+ - atf_check -o ignore -e empty mixer ${recsrc}.recsrc=- - atf_check -o ignore -e empty mixer ${recsrc}.recsrc== - atf_check -o ignore -e empty mixer ${recsrc}.recsrc=^ - # Test wrong values atf_check -o ignore -e not-empty mixer ${recsrc}.recsrc=foobar atf_check -o ignore -e not-empty mixer ${recsrc}.recsrc=10home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f88cc4.39306.3f92b042>
