Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
This commit is contained in:
parent
ef083dd857
commit
eb41ccd5fe
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ioctl.h,v 1.4 1996/04/05 00:01:36 christos Exp $ */
|
||||
/* $NetBSD: linux_ioctl.h,v 1.5 1997/03/19 05:12:16 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -37,6 +37,8 @@
|
||||
struct linux_sys_ioctl_args;
|
||||
int linux_ioctl_audio __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_ioctl_mixer __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_machdepioctl __P((struct proc *, void *, register_t *));
|
||||
int linux_ioctl_termios __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ioctl.c,v 1.14 1996/04/05 00:01:28 christos Exp $ */
|
||||
/* $NetBSD: linux_ioctl.c,v 1.15 1997/03/19 05:12:15 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -68,6 +68,8 @@ linux_sys_ioctl(p, v, retval)
|
||||
} */ *uap = v;
|
||||
|
||||
switch (LINUX_IOCGROUP(SCARG(uap, com))) {
|
||||
case 'M':
|
||||
return linux_ioctl_mixer(p, uap, retval);
|
||||
case 'P':
|
||||
return linux_ioctl_audio(p, uap, retval);
|
||||
case 'T':
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ioctl.h,v 1.4 1996/04/05 00:01:36 christos Exp $ */
|
||||
/* $NetBSD: linux_ioctl.h,v 1.5 1997/03/19 05:12:16 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -37,6 +37,8 @@
|
||||
struct linux_sys_ioctl_args;
|
||||
int linux_ioctl_audio __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_ioctl_mixer __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_machdepioctl __P((struct proc *, void *, register_t *));
|
||||
int linux_ioctl_termios __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ioctl.h,v 1.4 1996/04/05 00:01:36 christos Exp $ */
|
||||
/* $NetBSD: linux_ioctl.h,v 1.5 1997/03/19 05:12:16 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -37,6 +37,8 @@
|
||||
struct linux_sys_ioctl_args;
|
||||
int linux_ioctl_audio __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_ioctl_mixer __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_machdepioctl __P((struct proc *, void *, register_t *));
|
||||
int linux_ioctl_termios __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ioctl.h,v 1.4 1996/04/05 00:01:36 christos Exp $ */
|
||||
/* $NetBSD: linux_ioctl.h,v 1.5 1997/03/19 05:12:16 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -37,6 +37,8 @@
|
||||
struct linux_sys_ioctl_args;
|
||||
int linux_ioctl_audio __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_ioctl_mixer __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_machdepioctl __P((struct proc *, void *, register_t *));
|
||||
int linux_ioctl_termios __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_audio.c,v 1.2 1996/10/17 19:46:39 fvdl Exp $ */
|
||||
/* $NetBSD: linux_audio.c,v 1.3 1997/03/19 05:12:13 mycroft Exp $ */
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
@ -88,6 +88,22 @@ linux_ioctl_audio(p, uap, retval)
|
||||
if (error)
|
||||
return error;
|
||||
break;
|
||||
case LINUX_SOUND_PCM_WRITE_CHANNELS:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
return error;
|
||||
tmpinfo.play.channels =
|
||||
tmpinfo.record.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_GETBLKSIZE:
|
||||
error = (*fp->f_ops->fo_ioctl)(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
if (error)
|
||||
@ -166,3 +182,39 @@ linux_ioctl_audio(p, uap, retval)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
linux_ioctl_mixer(p, uap, retval)
|
||||
register struct proc *p;
|
||||
register struct linux_sys_ioctl_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(u_long) com;
|
||||
syscallarg(caddr_t) data;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
register struct filedesc *fdp;
|
||||
u_long com;
|
||||
#if 0
|
||||
struct audio_info tmpinfo;
|
||||
int idat;
|
||||
int error;
|
||||
#endif
|
||||
|
||||
fdp = p->p_fd;
|
||||
if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
|
||||
if ((fp->f_flag & (FREAD | FWRITE)) == 0)
|
||||
return (EBADF);
|
||||
|
||||
com = SCARG(uap, com);
|
||||
retval[0] = 0;
|
||||
|
||||
switch (com) {
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,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_SOUND_PCM_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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ioctl.c,v 1.14 1996/04/05 00:01:28 christos Exp $ */
|
||||
/* $NetBSD: linux_ioctl.c,v 1.15 1997/03/19 05:12:15 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -68,6 +68,8 @@ linux_sys_ioctl(p, v, retval)
|
||||
} */ *uap = v;
|
||||
|
||||
switch (LINUX_IOCGROUP(SCARG(uap, com))) {
|
||||
case 'M':
|
||||
return linux_ioctl_mixer(p, uap, retval);
|
||||
case 'P':
|
||||
return linux_ioctl_audio(p, uap, retval);
|
||||
case 'T':
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ioctl.h,v 1.4 1996/04/05 00:01:36 christos Exp $ */
|
||||
/* $NetBSD: linux_ioctl.h,v 1.5 1997/03/19 05:12:16 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -37,6 +37,8 @@
|
||||
struct linux_sys_ioctl_args;
|
||||
int linux_ioctl_audio __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_ioctl_mixer __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
int linux_machdepioctl __P((struct proc *, void *, register_t *));
|
||||
int linux_ioctl_termios __P((struct proc *, struct linux_sys_ioctl_args *,
|
||||
register_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ossaudio.c,v 1.2 1996/10/17 19:46:39 fvdl Exp $ */
|
||||
/* $NetBSD: ossaudio.c,v 1.3 1997/03/19 05:12:13 mycroft Exp $ */
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
@ -88,6 +88,22 @@ linux_ioctl_audio(p, uap, retval)
|
||||
if (error)
|
||||
return error;
|
||||
break;
|
||||
case LINUX_SOUND_PCM_WRITE_CHANNELS:
|
||||
AUDIO_INITINFO(&tmpinfo);
|
||||
error = copyin(SCARG(uap, data), &idat, sizeof idat);
|
||||
if (error)
|
||||
return error;
|
||||
tmpinfo.play.channels =
|
||||
tmpinfo.record.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_GETBLKSIZE:
|
||||
error = (*fp->f_ops->fo_ioctl)(fp, AUDIO_GETINFO, (caddr_t)&tmpinfo, p);
|
||||
if (error)
|
||||
@ -166,3 +182,39 @@ linux_ioctl_audio(p, uap, retval)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
linux_ioctl_mixer(p, uap, retval)
|
||||
register struct proc *p;
|
||||
register struct linux_sys_ioctl_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(u_long) com;
|
||||
syscallarg(caddr_t) data;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
register struct filedesc *fdp;
|
||||
u_long com;
|
||||
#if 0
|
||||
struct audio_info tmpinfo;
|
||||
int idat;
|
||||
int error;
|
||||
#endif
|
||||
|
||||
fdp = p->p_fd;
|
||||
if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
|
||||
if ((fp->f_flag & (FREAD | FWRITE)) == 0)
|
||||
return (EBADF);
|
||||
|
||||
com = SCARG(uap, com);
|
||||
retval[0] = 0;
|
||||
|
||||
switch (com) {
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,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_SOUND_PCM_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)
|
||||
|
Loading…
Reference in New Issue
Block a user