From nobody Tue Mar 03 11:33:00 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fQDF864HJz6T0CN for ; Tue, 03 Mar 2026 11:33:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fQDF84B9Bz3W6Q for ; Tue, 03 Mar 2026 11:33:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772537580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BFFD4UnHFG03L4QTbt9i/MwUgLUgg+bS/E/W/hrJz4k=; b=iJHJFn+54tP83Igqh8220zn9UI3StoItZTeptI4PBXTOuhRz4OdIRkr6wImtmZJ6u1SuFr ji83SVi/ZUJ7oIqEyylJTcZ+IpE2+SKyAUk9qcQDTvd0Y7wrd1Iy6R+vvtm5aZNQdgwPVw VAF44tQ8xLOW5+8fMu+MdbUCoC2mussUVxS7p99ScUgX44MnT4+AqoWnSBDWgS50bOSs4y kZ6KyJDS/ju6PQr4PKpd00fCAZKeIQcebAbhK5dS8pWeTTz8Uk8Cg68agIEmWOPq34kd5c yx5a3eL4gG3EICZGihI8i4gmFK+2MP2XSOxYbTVUxeYui7CmkhBNgksip1xAlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772537580; a=rsa-sha256; cv=none; b=sMP+RNk4Y5zJ+mgb8sAiuetoOInQLR6WrsAHD6BMzt7aGMmpuIiPFmTZWszLbFJXiOvYVs 3qD3uZoDw+SrAGw8LtnxJg0SwZy5uqQoKMyVYUCv7zzBeNfdsKvp0gkSlB1DpatCR3wEpO GE18HuigldcqDj6sfZjWCLhuku/MKcg5DIZ/vDn5ATB0UoXOshJrEshu+C3tVeg+y0khZa apohk4iIz2JjE2ulZCcWTB2BKlKwFGbM35JdlQg/erfYPi2mPZO4bV3z+Qo53edDwxrR+n A6v6ARa0ZTc61zkwOeJaA1WCt+mw21L/MnZk9hzUDJlkd2xnwrnGBQOlHl6GfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772537580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BFFD4UnHFG03L4QTbt9i/MwUgLUgg+bS/E/W/hrJz4k=; b=wUNXi7QuzmzN4SovnNThLxItMJBLGeYgcgoUecui1+If1iYjkz+dxIJVatwmfwj/KBRue9 WkpdSLDelBQjLKv6CrLJRIsrHg0zpU1fyHmcsZNBfwHa8HZqISHUpaAnVcMmFUQ3CYvitH HSU4ESBkydLYXSm/CZZO+lXA7lWiZHQuFkPPQmlobjhHJGkm16gsXpbZNLOu3l7KD4vUU3 H83YHrvct49wH/AmDF4+GESor8UqNh927LH99v+X8EAk+yuO644ZdfLJlkDXv8tIGUWqLj ugKI79KNSvQLITcSYaIVMafJ9vIrLy5LpaFMoCrwz9KGpv3qtw1+WEyr5FP33Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fQDF82VhXz1JFt for ; Tue, 03 Mar 2026 11:33:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 42a82 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 03 Mar 2026 11:33:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: d00b32c2d70c - main - Revert "mixer(8): Implement hot-swapping" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d00b32c2d70ce79fddb94dd990d2b162c8fc3a85 Auto-Submitted: auto-generated Date: Tue, 03 Mar 2026 11:33:00 +0000 Message-Id: <69a6c6ec.42a82.20d515f1@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=d00b32c2d70ce79fddb94dd990d2b162c8fc3a85 commit d00b32c2d70ce79fddb94dd990d2b162c8fc3a85 Author: Christos Margiolis AuthorDate: 2026-03-03 11:32:42 +0000 Commit: Christos Margiolis CommitDate: 2026-03-03 11:32:42 +0000 Revert "mixer(8): Implement hot-swapping" We now have devd rules in snd.conf that achieve this in a much cleaner way. This reverts commit 9aac27599acaffa21ff69c5be8a2d71d29cc3d6b. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55532 --- usr.sbin/mixer/mixer.8 | 75 +++------------------------------------------- usr.sbin/mixer/mixer.c | 81 +++++--------------------------------------------- 2 files changed, 11 insertions(+), 145 deletions(-) diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8 index d7de675bceee..bdff0dbedc11 100644 --- a/usr.sbin/mixer/mixer.8 +++ b/usr.sbin/mixer/mixer.8 @@ -19,7 +19,7 @@ .\" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN .\" THE SOFTWARE. .\" -.Dd October 31, 2025 +.Dd February 26, 2026 .Dt MIXER 8 .Os .Sh NAME @@ -28,7 +28,7 @@ .Sh SYNOPSIS .Nm .Op Fl f Ar device -.Op Fl d Ar pcmX | X Op Fl V Ar voss_device:mode +.Op Fl d Ar pcmX | X .Op Fl os .Op Ar dev Ns Op Cm \&. Ns Ar control Ns Op Cm \&= Ns Ar value .Ar ... @@ -43,7 +43,7 @@ The utility is used to set and display soundcard mixer device controls. .Pp The options are as follows: -.Bl -tag -width "-V voss_device:mode" +.Bl -tag -width "-d pcmN | N" .It Fl a Print the values for all mixer devices available in the system .Pq see Sx FILES . @@ -54,30 +54,6 @@ where X is the device's unit number (e.g for pcm0, the unit number is 0). See .Sx EXAMPLES on how to list all available audio devices in the system. -.Pp -There is also the possibility of hot-swapping to the new default device if -.Xr virtual_oss 8 -exists in the system and is running, in which case the -.Fl V -option needs to be specified as well. -.Pp -Hot-swapping generally cannot happen with plain -.Xr sound 4 , -so the user has to restart the track in order to get sound coming out of the -new default device. -This is because applications usually open a device at the start of the track -and do not check for default device changes, in order to open the new device -mid-track. -.Xr virtual_oss 8 , -on the other hand, can do hot-swapping, because it creates a virtual device for -applications to open, and then does all the necessary routing and conversions -to the appropriate device(s). -.Pp -Note that hot-swapping will work only for applications that are using -.Xr virtual_oss 8 -devices, and not plain -.Xr sound 4 -ones. .It Fl f Ar device Open .Ar device @@ -90,33 +66,6 @@ Print mixer values in a format suitable for use inside scripts. The mixer's header (name, audio card name, ...) will not be printed. .It Fl s Print only the recording source(s) of the mixer device. -.It Fl V Ar voss_device:mode -Specify a -.Xr virtual_oss 8 -control device, as well as a mode (see below), in order to hot-swap devices. -This option is meant to only be used in combination with the -.Fl d -option. -.Pp -The available modes are as follows: -.Bl -column play -.It Sy Mode Ta Sy Action -.It all Ta Playback and recording -.It play Ta Playback -.It rec Ta Recording -.El -.Pp -The -.Pa mode -part is needed, so that -.Nm -will not accidentally hot-swap both the recording and playback device in -.Xr virtual_oss 8 , -if only one direction is to be hot-swapped. -.Pp -See -.Sx EXAMPLES -on how to use this option. .El .Pp The list of mixer devices that may be modified are: @@ -316,26 +265,10 @@ $ mixer -f /dev/mixer0 -o > info \&... $ mixer -f /dev/mixer0 `cat info` .Ed -.Pp -Suppose -.Xr virtual_oss 8 -is running with -.Pa /dev/vdsp.ctl -as its control device, and -.Pa pcm0 -as the playback device. -Change the default device to -.Pa pcm1 , -and hot-swap to it for both recording and playback in -.Xr virtual_oss 8 : -.Bd -literal -offset indent -$ mixer -d pcm1 -V /dev/vdsp.ctl:all -.Ed .Sh SEE ALSO .Xr mixer 3 , .Xr sound 4 , -.Xr sysctl 8 , -.Xr virtual_oss 8 +.Xr sysctl 8 .Sh HISTORY The .Nm diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 15e0eae69952..a0fc9705a301 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -20,9 +20,6 @@ * THE SOFTWARE. */ -#include -#include - #include #include #include @@ -43,7 +40,7 @@ static void printall(struct mixer *, int); static void printminfo(struct mixer *, int); static void printdev(struct mixer *, int); static void printrecsrc(struct mixer *, int); /* XXX: change name */ -static int set_dunit(struct mixer *, int, char *); +static int set_dunit(struct mixer *, int); /* Control handlers */ static int mod_volume(struct mix_dev *, void *); static int mod_mute(struct mix_dev *, void *); @@ -57,13 +54,13 @@ main(int argc, char *argv[]) { struct mixer *m; mix_ctl_t *cp; - char *name = NULL, buf[NAME_MAX], *vctl = NULL; + char *name = NULL, buf[NAME_MAX]; char *p, *q, *devstr, *ctlstr, *valstr = NULL; int dunit, i, n, pall = 1, shorthand; int aflag = 0, dflag = 0, oflag = 0, sflag = 0; int ch; - while ((ch = getopt(argc, argv, "ad:f:hosV:")) != -1) { + while ((ch = getopt(argc, argv, "ad:f:hos")) != -1) { switch (ch) { case 'a': aflag = 1; @@ -86,9 +83,6 @@ main(int argc, char *argv[]) case 's': sflag = 1; break; - case 'V': - vctl = optarg; - break; case 'h': /* FALLTHROUGH */ case '?': default: @@ -125,7 +119,7 @@ main(int argc, char *argv[]) initctls(m); if (dflag) { - if (set_dunit(m, dunit, vctl) < 0) + if (set_dunit(m, dunit) < 0) goto parse; else { /* @@ -217,8 +211,7 @@ next: static void __dead2 usage(void) { - fprintf(stderr, "usage: %1$s [-f device] [-d pcmN | N " - "[-V voss_device:mode]] [-os] [dev[.control[=value]]] ...\n" + fprintf(stderr, "usage: %1$s [-f device] [-d pcmN | N] [-os] [dev[.control[=value]]] ...\n" " %1$s [-os] -a\n" " %1$s -h\n", getprogname()); exit(1); @@ -331,32 +324,9 @@ printrecsrc(struct mixer *m, int oflag) } static int -set_dunit(struct mixer *m, int dunit, char *vctl) +set_dunit(struct mixer *m, int dunit) { - const char *opt; - char *dev, *mode; - char buf[32]; - size_t size; - int n, rc; - - /* - * Issue warning in case of hw.snd.basename_clone being unset. Omit the - * check and warning if the -V flag is used, since the user is most - * likely to be aware of this, and the warning might be confusing. - */ - if (vctl == NULL) { - size = sizeof(int); - if (sysctlbyname("hw.snd.basename_clone", &n, &size, - NULL, 0) < 0) { - warn("hw.snd.basename_clone failed"); - return (-1); - } - if (n == 0) { - warnx("warning: hw.snd.basename_clone not set. " - "/dev/dsp is managed externally and does not " - "change with the default unit change here."); - } - } + int n; if ((n = mixer_get_dunit()) < 0) { warn("cannot get default unit"); @@ -368,43 +338,6 @@ set_dunit(struct mixer *m, int dunit, char *vctl) } printf("default_unit: %d -> %d\n", n, dunit); - /* Hot-swap in case virtual_oss exists and is running. */ - if (vctl != NULL) { - dev = strsep(&vctl, ":"); - mode = vctl; - if (dev == NULL || mode == NULL) { - warnx("voss_device:mode tuple incomplete"); - return (-1); - } - if (strcmp(mode, "all") == 0) - opt = "-f"; - else if (strcmp(mode, "play") == 0) - opt = "-P"; - else if (strcmp(mode, "rec") == 0) - opt = "-R"; - else { - warnx("please use one of the following modes: " - "all, play, rec"); - return (-1); - } - snprintf(buf, sizeof(buf), "/dev/dsp%d", dunit); - switch (fork()) { - case -1: - warn("fork"); - break; - case 0: - rc = execl("/usr/sbin/virtual_oss_cmd", - "virtual_oss_cmd", dev, opt, buf, NULL); - if (rc < 0) - warn("virtual_oss_cmd"); - _exit(0); - default: - if (wait(NULL) < 0) - warn("wait"); - break; - } - } - return (0); }