From nobody Mon Feb 26 23:22:44 2024 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 4TkGqn3dGvz5Btpt; Mon, 26 Feb 2024 23:22:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TkGqn11q0z4Tp5; Mon, 26 Feb 2024 23:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708989765; 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=Nz684uNhirWEoy5ho8nTAQpLxKJtJrd5qW9kMYap/vI=; b=EQj9521ne6xwJA8LImgYlKVb0cG/TuMZSRm5y+eePU1R1J7pc8chq4vP9kxw9NOPSC8fKg rgfPhYvt8QApEx+XO5mfX/7YcXMA4559xeojSemtLs9g2TrswTl74w54MfXokMZXh2FA6H Y8Tc00CMhpYjPlBknVmVM2LRRR68i4BNC0QKu/nJfVC+GYDrCGJy0rpLQMpHuddHqDb82h mhwJzP9IBvHFEPUfbfhWd6BPma/7WrrPoAnx0/CaFYRZEx3qGnr6r0mT2w4CXPqn6vthJN buiqhVQoUDZJQwYixM2msiD/uT32GT7iEUCUu44ZmrLergSm3wi18+0ukfIBmQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708989765; a=rsa-sha256; cv=none; b=pGusoXoLubPYmGR+v93TxSSpn0lHbLHOsSBQQNNGe9056oN4QPsq9QvjyZN3SMCHaM08Eb q03tTfmeu2PXAOS870U530kMGhFADf+QPxhfVW/IWALNHKXfN5rQjpVhqnTX1WIMIZA4aR +rWYqZRH2LkRm3SwSZ9w0R1bgXxpxmpSVJBYuy1LLccqIn6pNH0CX8t1rORwBoY9kR/DTQ hT5d2slHY/k6RgVL0J21iAk5mzybkpQQJNyRW2BkfMIiPdSQvzyl0n0xzXyqXFrmdg1U/J iqCijf/aFA6wbYEFffgocbRVctk6EoTrdMpGRIk13JKtwcmfeaypeEHt8Z/mOw== 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=1708989765; 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=Nz684uNhirWEoy5ho8nTAQpLxKJtJrd5qW9kMYap/vI=; b=t/5bBPkoFNlJcPc7zgsYpVAp8LYb3psCLcUpbhEdA2jNyMtO64K/J5Ymeqw8lWFe0hyNEo YJeIWq4i6/ilLuKB9sSS7doA1E4fh/7O+cimhBCNK+O2LYR+apqlqfSxA6zrZ5NfhhcB9G ElytD7YgCc1B0v3yQ3p6zW8Gee24/9SlPe/gv4IELpgdye6WZOlVPIJHse4N+t0w7wGRf4 699r29NIOdormLmDFNzQiIbWReemknQgaXlU3Z8FAOmbaq7j6AAfyWNakSQT8M53G6pZNj 2rlGYQ0qJ30yro2gVYJC9G7iYvIMHaczsX1apDsKCc0bQ9tkuNKh3gXSw+/EEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TkGqn07QXznnF; Mon, 26 Feb 2024 23:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41QNMitj028367; Mon, 26 Feb 2024 23:22:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41QNMimO028364; Mon, 26 Feb 2024 23:22:44 GMT (envelope-from git) Date: Mon, 26 Feb 2024 23:22:44 GMT Message-Id: <202402262322.41QNMimO028364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 7ff8cd094b73 - stable/14 - mixer(8): Allow full PCM device names as input for the -d option 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 7ff8cd094b7342d0071d7afb40ea2cdcd3359b0a Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=7ff8cd094b7342d0071d7afb40ea2cdcd3359b0a commit 7ff8cd094b7342d0071d7afb40ea2cdcd3359b0a Author: Christos Margiolis AuthorDate: 2024-02-12 10:59:02 +0000 Commit: Christos Margiolis CommitDate: 2024-02-26 23:22:30 +0000 mixer(8): Allow full PCM device names as input for the -d option The -d option is a wrapper around hw.snd.default_unit. Currently mixer(8) expects the option argument to be just the unit's number (e.g pcm0 -> 0). To avoid confusion, allow full device names of the form "pcmN" as well. While here, improve the -d option's description in the man page. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: dev_submerge.ch, imp Differential Revision: https://reviews.freebsd.org/D43794 (cherry picked from commit 75be886e58dc237b633104fc9cf8d7d1285e4003) --- usr.sbin/mixer/mixer.8 | 23 ++++++++++++++--------- usr.sbin/mixer/mixer.c | 6 ++++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8 index 10a461d91693..5750b81c98c5 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 January 12, 2024 +.Dd February 8, 2024 .Dt MIXER 8 .Os .Sh NAME @@ -28,12 +28,11 @@ .Sh SYNOPSIS .Nm .Op Fl f Ar device -.Op Fl d Ar unit +.Op Fl d Ar pcmN | N .Op Fl os .Op Ar dev Ns Op Cm \&. Ns Ar control Ns Op Cm \&= Ns Ar value .Ar ... .Nm -.Op Fl d Ar unit .Op Fl os .Fl a .Nm @@ -44,16 +43,17 @@ The utility is used to set and display soundcard mixer device controls. .Pp The options are as follows: -.Bl -tag -width "-f device" +.Bl -tag -width "-d pcmN | N" .It Fl a Print the values for all mixer devices available in the system .Pq see Sx FILES . -.It Fl d Ar unit +.It Fl d Ar pcmN | N Change the default audio card to -.Ar unit . -The unit has to be an integer value. -To see what unit values are available, look at the number each mixer device has by running -.Nm . +.Ar pcmN , +where N is the 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. .It Fl f Ar device Open .Ar device @@ -218,6 +218,11 @@ opens when the option has not been specified. .El .Sh EXAMPLES +List all available audio devices in the system: +.Bd -literal -offset indent +$ mixer -a | grep ^pcm +.Ed +.Pp Increase the volume for the .Cm vol device of the first mixer found by 5%: diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 043c8c412857..0c0c37ccb2bc 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -66,6 +66,8 @@ main(int argc, char *argv[]) aflag = 1; break; case 'd': + if (strncmp(optarg, "pcm", 3) == 0) + optarg += 3; errno = 0; dunit = strtol(optarg, NULL, 10); if (errno == EINVAL || errno == ERANGE) @@ -194,8 +196,8 @@ next: static void __dead2 usage(void) { - fprintf(stderr, "usage: %1$s [-f device] [-d unit] [-os] [dev[.control[=value]]] ...\n" - " %1$s [-d unit] [-os] -a\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); }