Tue Oct 20 08:57:45 2020 UTC ()
ossaudio(3): Add SNDCTL_AUDIOINFO_EX as an alias of SNDCTL_AUDIOINFO


(nia)
diff -r1.53 -r1.54 src/lib/libossaudio/ossaudio.c
diff -r1.29 -r1.30 src/lib/libossaudio/soundcard.h

cvs diff -r1.53 -r1.54 src/lib/libossaudio/Attic/ossaudio.c (expand / switch to unified diff)

--- src/lib/libossaudio/Attic/ossaudio.c 2020/10/20 06:53:37 1.53
+++ src/lib/libossaudio/Attic/ossaudio.c 2020/10/20 08:57:45 1.54
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ossaudio.c,v 1.53 2020/10/20 06:53:37 nia Exp $ */ 1/* $NetBSD: ossaudio.c,v 1.54 2020/10/20 08:57:45 nia Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc. 4 * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__RCSID("$NetBSD: ossaudio.c,v 1.53 2020/10/20 06:53:37 nia Exp $"); 30__RCSID("$NetBSD: ossaudio.c,v 1.54 2020/10/20 08:57:45 nia Exp $");
31 31
32/* 32/*
33 * This is an Open Sound System compatibility layer, which provides 33 * This is an Open Sound System compatibility layer, which provides
34 * fairly complete ioctl emulation for OSSv3 and some of OSSv4. 34 * fairly complete ioctl emulation for OSSv3 and some of OSSv4.
35 * 35 *
36 * The canonical OSS specification is available at 36 * The canonical OSS specification is available at
37 * http://manuals.opensound.com/developer/ 37 * http://manuals.opensound.com/developer/
38 *  38 *
39 * This file is similar to sys/compat/ossaudio.c with additional OSSv4 39 * This file is similar to sys/compat/ossaudio.c with additional OSSv4
40 * compatibility. 40 * compatibility.
41 */ 41 */
42 42
43#include <string.h> 43#include <string.h>
@@ -1035,26 +1035,33 @@ mixer_oss4_ioctl(int fd, unsigned long c @@ -1035,26 +1035,33 @@ mixer_oss4_ioctl(int fd, unsigned long c
1035 int retval; 1035 int retval;
1036 int props, caps; 1036 int props, caps;
1037 1037
1038 /* 1038 /*
1039 * Note: it is difficult to translate the NetBSD concept of a "set" 1039 * Note: it is difficult to translate the NetBSD concept of a "set"
1040 * mixer control type to the OSSv4 API, as far as I can tell. 1040 * mixer control type to the OSSv4 API, as far as I can tell.
1041 * 1041 *
1042 * This means they are treated like enums, i.e. only one entry in the 1042 * This means they are treated like enums, i.e. only one entry in the
1043 * set can be selected at a time. 1043 * set can be selected at a time.
1044 */ 1044 */
1045 1045
1046 switch (com) { 1046 switch (com) {
1047 case SNDCTL_AUDIOINFO: 1047 case SNDCTL_AUDIOINFO:
 1048 /*
 1049 * SNDCTL_AUDIOINFO_EX is intended for underlying hardware devices
 1050 * that are to be opened in "exclusive mode" (bypassing the normal
 1051 * kernel mixer for exclusive control). NetBSD does not support
 1052 * bypassing the kernel mixer, so it's an alias of SNDCTL_AUDIOINFO.
 1053 */
 1054 case SNDCTL_AUDIOINFO_EX:
1048 case SNDCTL_ENGINEINFO: 1055 case SNDCTL_ENGINEINFO:
1049 devno = 0; 1056 devno = 0;
1050 tmpai = (struct oss_audioinfo*)argp; 1057 tmpai = (struct oss_audioinfo*)argp;
1051 if (tmpai == NULL) { 1058 if (tmpai == NULL) {
1052 errno = EINVAL; 1059 errno = EINVAL;
1053 return -1; 1060 return -1;
1054 } 1061 }
1055 1062
1056 /* 1063 /*
1057 * If the input device is -1, guess the device related to 1064 * If the input device is -1, guess the device related to
1058 * the open mixer device. 1065 * the open mixer device.
1059 */ 1066 */
1060 if (tmpai->dev < 0) { 1067 if (tmpai->dev < 0) {

cvs diff -r1.29 -r1.30 src/lib/libossaudio/soundcard.h (expand / switch to unified diff)

--- src/lib/libossaudio/soundcard.h 2020/10/20 06:33:52 1.29
+++ src/lib/libossaudio/soundcard.h 2020/10/20 08:57:45 1.30
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: soundcard.h,v 1.29 2020/10/20 06:33:52 nia Exp $ */ 1/* $NetBSD: soundcard.h,v 1.30 2020/10/20 08:57:45 nia Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc. 4 * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson and Nia Alarie. 8 * by Lennart Augustsson and Nia Alarie.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -408,26 +408,27 @@ typedef struct oss_audioinfo { @@ -408,26 +408,27 @@ typedef struct oss_audioinfo {
408} oss_audioinfo; 408} oss_audioinfo;
409 409
410#define SNDCTL_SYSINFO _IOR ('X', 1, oss_sysinfo) 410#define SNDCTL_SYSINFO _IOR ('X', 1, oss_sysinfo)
411#define OSS_SYSINFO SNDCTL_SYSINFO /* Old name */ 411#define OSS_SYSINFO SNDCTL_SYSINFO /* Old name */
412#define SNDCTL_MIX_NRMIX _IOR ('X',2, int) 412#define SNDCTL_MIX_NRMIX _IOR ('X',2, int)
413#define SNDCTL_MIX_NREXT _IOWR ('X',3, int) 413#define SNDCTL_MIX_NREXT _IOWR ('X',3, int)
414#define SNDCTL_MIX_EXTINFO _IOWR ('X',4, oss_mixext) 414#define SNDCTL_MIX_EXTINFO _IOWR ('X',4, oss_mixext)
415#define SNDCTL_MIX_READ _IOWR ('X',5, oss_mixer_value) 415#define SNDCTL_MIX_READ _IOWR ('X',5, oss_mixer_value)
416#define SNDCTL_MIX_WRITE _IOWR ('X',6, oss_mixer_value) 416#define SNDCTL_MIX_WRITE _IOWR ('X',6, oss_mixer_value)
417#define SNDCTL_AUDIOINFO _IOWR ('X',7, oss_audioinfo) 417#define SNDCTL_AUDIOINFO _IOWR ('X',7, oss_audioinfo)
418#define SNDCTL_MIX_ENUMINFO _IOWR ('X',8, oss_mixer_enuminfo) 418#define SNDCTL_MIX_ENUMINFO _IOWR ('X',8, oss_mixer_enuminfo)
419#define SNDCTL_MIXERINFO _IOWR ('X',10, oss_mixerinfo) 419#define SNDCTL_MIXERINFO _IOWR ('X',10, oss_mixerinfo)
420#define SNDCTL_ENGINEINFO _IOWR ('X',12, oss_audioinfo) 420#define SNDCTL_ENGINEINFO _IOWR ('X',12, oss_audioinfo)
 421#define SNDCTL_AUDIOINFO_EX _IOWR ('X',13, oss_audioinfo)
421#define SNDCTL_MIX_DESCRIPTION _IOWR ('X',14, oss_mixer_enuminfo) 422#define SNDCTL_MIX_DESCRIPTION _IOWR ('X',14, oss_mixer_enuminfo)
422 423
423#define MIXT_DEVROOT 0 /* Used for default classes */ 424#define MIXT_DEVROOT 0 /* Used for default classes */
424#define MIXT_GROUP 1 /* Used for classes */ 425#define MIXT_GROUP 1 /* Used for classes */
425#define MIXT_ONOFF 2 /* Used for mute controls */ 426#define MIXT_ONOFF 2 /* Used for mute controls */
426#define MIXT_ENUM 3 /* Used for enum controls */ 427#define MIXT_ENUM 3 /* Used for enum controls */
427#define MIXT_MONOSLIDER 4 /* Used for mono and surround controls */ 428#define MIXT_MONOSLIDER 4 /* Used for mono and surround controls */
428#define MIXT_STEREOSLIDER 5 /* Used for stereo controls */ 429#define MIXT_STEREOSLIDER 5 /* Used for stereo controls */
429#define MIXT_MESSAGE 6 /* OSS compat, unused on NetBSD */ 430#define MIXT_MESSAGE 6 /* OSS compat, unused on NetBSD */
430#define MIXT_MONOVU 7 /* OSS compat, unused on NetBSD */ 431#define MIXT_MONOVU 7 /* OSS compat, unused on NetBSD */
431#define MIXT_STEREOVU 8 /* OSS compat, unused on NetBSD */ 432#define MIXT_STEREOVU 8 /* OSS compat, unused on NetBSD */
432#define MIXT_MONOPEAK 9 /* OSS compat, unused on NetBSD */ 433#define MIXT_MONOPEAK 9 /* OSS compat, unused on NetBSD */
433#define MIXT_STEREOPEAK 10 /* OSS compat, unused on NetBSD */ 434#define MIXT_STEREOPEAK 10 /* OSS compat, unused on NetBSD */