summaryrefslogtreecommitdiff
path: root/sys/dev/pci/auixp.c
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2008-10-25 22:30:44 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2008-10-25 22:30:44 +0000
commitfe8114f730e5473eba5ee55c81c541e29edbeea8 (patch)
tree545de71dde8d0a2e03bc8556eeaa4beb581824dd /sys/dev/pci/auixp.c
parentd54880b2f6a9ada7238d4417b82adb8ce1f2ae77 (diff)
audio(9) says low level drivers are allowed to change the requested
values of the audio_params structure during AUDIO_SETINFO if the hardware cannot be set to exactly the requested mode. some drivers do this sometimes. others always return EINVAL if there isn't an exact match. be more consistent. only return EINVAL if an absurd parameter was requested, otherwise return a supported set of parameters, as close as possible to what was requested. with/ok ratchov@
Diffstat (limited to 'sys/dev/pci/auixp.c')
-rw-r--r--sys/dev/pci/auixp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/pci/auixp.c b/sys/dev/pci/auixp.c
index 9304863aca2..5fda4e24b1f 100644
--- a/sys/dev/pci/auixp.c
+++ b/sys/dev/pci/auixp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auixp.c,v 1.21 2008/09/24 19:09:05 chl Exp $ */
+/* $OpenBSD: auixp.c,v 1.22 2008/10/25 22:30:43 jakemsr Exp $ */
/* $NetBSD: auixp.c,v 1.9 2005/06/27 21:13:09 thorpej Exp $ */
/*
@@ -377,6 +377,10 @@ auixp_set_params(void *hdl, int setmode, int usemode,
if (setmode & AUMODE_PLAY) {
play->factor = 1;
play->sw_code = NULL;
+ if (play->channels > 2)
+ play->channels = 2;
+ if (play->precision > 16)
+ play->precision = 16;
switch(play->encoding) {
case AUDIO_ENCODING_ULAW:
switch (play->channels) {
@@ -561,9 +565,13 @@ auixp_set_params(void *hdl, int setmode, int usemode,
}
- if (setmode & AUMODE_RECORD) {
+ if (setmode & AUMODE_RECORD) {
rec->factor = 1;
rec->sw_code = 0;
+ if (rec->channels > 2)
+ rec->channels = 2;
+ if (rec->precision > 16)
+ rec->precision = 16;
switch(rec->encoding) {
case AUDIO_ENCODING_ULAW:
rec->sw_code = ulinear8_to_mulaw;