From 017c116c97607eb5e0dd7cfe6eeab7ace52d5334 Mon Sep 17 00:00:00 2001 From: isaki Date: Wed, 8 May 2019 14:44:42 +0000 Subject: [PATCH] Remove -p option. AUDIO_SETCHAN is insecure and is obsoleted. --- usr.bin/audio/ctl/audioctl.1 | 16 ++++------------ usr.bin/audio/ctl/ctl.c | 25 ++++++------------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/usr.bin/audio/ctl/audioctl.1 b/usr.bin/audio/ctl/audioctl.1 index 45581037128d..546f3b975569 100644 --- a/usr.bin/audio/ctl/audioctl.1 +++ b/usr.bin/audio/ctl/audioctl.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: audioctl.1,v 1.21 2017/02/10 19:31:42 nat Exp $ +.\" $NetBSD: audioctl.1,v 1.22 2019/05/08 14:44:42 isaki Exp $ .\" .\" Copyright (c) 1997, 1999 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,17 +35,14 @@ .Sh SYNOPSIS .Nm .Op Fl d Ar device -.Op Fl p Ar channel .Op Fl n .Fl a .Nm .Op Fl d Ar device -.Op Fl p Ar channel .Op Fl n .Ar name ... .Nm .Op Fl d Ar device -.Op Fl p Ar channel .Op Fl n .Fl w .Ar name=value ... @@ -71,11 +68,6 @@ flag can be used to give an alternative audio control device, the default is .Pa /dev/audioctl0 . .Pp The -.Fl p -flag can be used to give a virtual channel to control, the default is a new -channel. -.Pp -The .Fl n flag suppresses printing of the variable name. .Sh ENVIRONMENT @@ -93,10 +85,10 @@ audio control device audio I/O device (does not reset on open) .El .Sh EXAMPLES -To set the playing sampling rate to 11025, for the channel 3 you can use -.Dl audioctl -p 3 -w play.sample_rate=11025 +To set the playing sampling rate to 11025, you can use +.Dl audioctl -w play.sample_rate=11025 To set all of the play parameters for CD-quality audio, you can use -.Dl audioctl -p 3 -w play=44100,2,16,slinear_le +.Dl audioctl -w play=44100,2,16,slinear_le Note that many of the variables that can be inspected and changed with .Nm are reset when diff --git a/usr.bin/audio/ctl/ctl.c b/usr.bin/audio/ctl/ctl.c index 3094f083cfd9..226788ebefdc 100644 --- a/usr.bin/audio/ctl/ctl.c +++ b/usr.bin/audio/ctl/ctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ctl.c,v 1.43 2017/03/21 07:04:29 nat Exp $ */ +/* $NetBSD: ctl.c,v 1.44 2019/05/08 14:44:42 isaki Exp $ */ /* * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ctl.c,v 1.43 2017/03/21 07:04:29 nat Exp $"); +__RCSID("$NetBSD: ctl.c,v 1.44 2019/05/08 14:44:42 isaki Exp $"); #endif @@ -66,7 +66,6 @@ static char encbuf[1000]; static int properties, fullduplex, rerror; -int channel; int verbose; static struct field { @@ -291,9 +290,6 @@ getinfo(int fd) { int pos, i; - if (channel >= 0 && ioctl(fd, AUDIO_SETCHAN, &channel) < 0) - err(1, "AUDIO_SETCHAN"); - if (ioctl(fd, AUDIO_GETDEV, &adev) < 0) err(1, "AUDIO_GETDEV"); for (pos = 0, i = 0; ; i++) { @@ -326,11 +322,9 @@ usage(void) { const char *prog = getprogname(); - fprintf(stderr, "Usage: %s [-d file] [-p] channel " - "[-n] name ...\n", prog); - fprintf(stderr, "Usage: %s [-d file] [-p] channel [-n] " - "-w name=value ...\n", prog); - fprintf(stderr, "Usage: %s [-d file] [-p] channel [-n] -a\n", prog); + fprintf(stderr, "Usage: %s [-d file] [-n] name ...\n", prog); + fprintf(stderr, "Usage: %s [-d file] [-n] -w name=value ...\n", prog); + fprintf(stderr, "Usage: %s [-d file] [-n] -a\n", prog); exit(1); } @@ -343,12 +337,11 @@ main(int argc, char *argv[]) const char *file; const char *sep = "="; - channel = -1; file = getenv("AUDIOCTLDEVICE"); if (file == NULL) file = deffile; - while ((ch = getopt(argc, argv, "ad:f:np:w")) != -1) { + while ((ch = getopt(argc, argv, "ad:f:nw")) != -1) { switch(ch) { case 'a': aflag++; @@ -359,9 +352,6 @@ main(int argc, char *argv[]) case 'n': sep = 0; break; - case 'p': - channel = atoi(optarg); - break; case 'f': /* compatibility */ case 'd': file = optarg; @@ -440,9 +430,6 @@ audioctl_write(int fd, int argc, char *argv[]) { struct field *p; - if (channel >= 0 && ioctl(fd, AUDIO_SETCHAN, &channel) < 0) - err(1, "AUDIO_SETCHAN"); - AUDIO_INITINFO(&info); while (argc--) { char *q;