Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev for AUDIO_SETINFO, silently enforce same mode as the...



details:   https://anonhg.NetBSD.org/src/rev/04716950ec8f
branches:  trunk
changeset: 538283:04716950ec8f
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed Oct 16 21:07:08 2002 +0000

description:
for AUDIO_SETINFO, silently enforce same mode as the currently used one;
this value is supposed to be read-only for this ioctl

diffstat:

 sys/dev/audio.c |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 71d2c8b0bad1 -r 04716950ec8f sys/dev/audio.c
--- a/sys/dev/audio.c   Wed Oct 16 21:01:22 2002 +0000
+++ b/sys/dev/audio.c   Wed Oct 16 21:07:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.165 2002/10/02 16:33:28 thorpej Exp $      */
+/*     $NetBSD: audio.c,v 1.166 2002/10/16 21:07:08 jdolecek Exp $     */
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.165 2002/10/02 16:33:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.166 2002/10/16 21:07:08 jdolecek Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -1824,9 +1824,20 @@
                break;
 
        case AUDIO_SETINFO:
+           {
+               struct audio_info *info = (struct audio_info *)addr;
+
                DPRINTF(("AUDIO_SETINFO mode=0x%x\n", sc->sc_mode));
-               error = audiosetinfo(sc, (struct audio_info *)addr);
+
+               /* Ensure PLAY/RECORD mode is set correctly */
+               if (info->mode != ~0) {
+                       info->mode &= ~(AUMODE_PLAY|AUMODE_RECORD);
+                       info->mode |= sc->sc_mode;
+               }
+
+               error = audiosetinfo(sc, info);
                break;
+           }
 
        case AUDIO_GETINFO:
                DPRINTF(("AUDIO_GETINFO\n"));



Home | Main Index | Thread Index | Old Index