summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_audio.c38
-rw-r--r--sys/compat/linux/linux_audio.h3
2 files changed, 38 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_audio.c b/sys/compat/linux/linux_audio.c
index 8e2bc234e4f..8b13d4c4bdd 100644
--- a/sys/compat/linux/linux_audio.c
+++ b/sys/compat/linux/linux_audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_audio.c,v 1.2 1996/04/18 21:21:38 niklas Exp $ */
+/* $OpenBSD: linux_audio.c,v 1.3 1996/09/16 15:34:27 mickey Exp $ */
#include <sys/param.h>
#include <sys/proc.h>
@@ -73,6 +73,21 @@ linux_ioctl_audio(p, uap, retval)
if (error)
return error;
break;
+ case LINUX_SNDCTL_DSP_WRITE_CHANNELS:
+ AUDIO_INITINFO(&tmpinfo);
+ error = copyin(SCARG(uap, data), &idat, sizeof idat);
+ if (error)
+ return error;
+ tmpinfo.play.channels = idat;
+ (void) (*fp->f_ops->fo_ioctl)(fp, AUDIO_SETINFO, (caddr_t)&tmpinfo, p);
+ error = (*fp->f_ops->fo_ioctl)(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
+ if (error)
+ return error;
+ idat = tmpinfo.play.channels;
+ error = copyout(&idat, SCARG(uap, data), sizeof idat);
+ if (error)
+ return error;
+ break;
case LINUX_SNDCTL_DSP_STEREO:
AUDIO_INITINFO(&tmpinfo);
error = copyin(SCARG(uap, data), &idat, sizeof idat);
@@ -135,7 +150,26 @@ linux_ioctl_audio(p, uap, retval)
error = (*fp->f_ops->fo_ioctl)(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
if (error)
return error;
- /*XXXX*/
+ switch(tmpinfo.play.encoding) {
+ case AUDIO_ENCODING_LINEAR:
+ if (tmpinfo.play.precision == 8)
+ idat = LINUX_AFMT_U8;
+ else if (tmpinfo.play.precision == 16)
+ idat = LINUX_AFMT_S16_LE;
+ else return EINVAL;
+ break;
+ case AUDIO_ENCODING_ULAW:
+ idat = LINUX_AFMT_MU_LAW;
+ break;
+ case AUDIO_ENCODING_ALAW:
+ idat = LINUX_AFMT_A_LAW;
+ break;
+ default:
+ return EINVAL;
+ }
+ error = copyout(&idat, SCARG(uap, data), sizeof idat);
+ if (error)
+ return error;
break;
case LINUX_SNDCTL_DSP_SETFRAGMENT:
AUDIO_INITINFO(&tmpinfo);
diff --git a/sys/compat/linux/linux_audio.h b/sys/compat/linux/linux_audio.h
index 5edc22269ec..fc91ec3ed68 100644
--- a/sys/compat/linux/linux_audio.h
+++ b/sys/compat/linux/linux_audio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_audio.h,v 1.2 1996/04/18 21:21:38 niklas Exp $ */
+/* $OpenBSD: linux_audio.h,v 1.3 1996/09/16 15:34:28 mickey Exp $ */
#define LINUX_IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
#define LINUX_IOC_VOID 0x00000000 /* no parameters */
@@ -19,6 +19,7 @@
#define LINUX_SNDCTL_DSP_STEREO _LINUX_IOWR('P', 3, int)
#define LINUX_SNDCTL_DSP_GETBLKSIZE _LINUX_IOWR('P', 4, int)
#define LINUX_SNDCTL_DSP_SETFMT _LINUX_IOWR('P', 5, int)
+#define LINUX_SNDCTL_DSP_WRITE_CHANNELS _LINUX_IOWR('P', 6, int)
#define LINUX_SNDCTL_DSP_POST _LINUX_IO('P', 8)
#define LINUX_SNDCTL_DSP_SETFRAGMENT _LINUX_IOWR('P', 10, int)
#define LINUX_SNDCTL_DSP_GETFMTS _LINUX_IOR('P', 11, int)