| @@ -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) { |