Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pad - return EIO if audio data is received and /dev/...



details:   https://anonhg.NetBSD.org/src/rev/87704e4673d4
branches:  trunk
changeset: 757541:87704e4673d4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Sep 03 19:19:48 2010 +0000

description:
- return EIO if audio data is received and /dev/pad isn't open
- give a better description for AUDIO_GETDEV

diffstat:

 sys/dev/pad/pad.c |  18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diffs (53 lines):

diff -r d43e57e6c117 -r 87704e4673d4 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Fri Sep 03 17:22:51 2010 +0000
+++ b/sys/dev/pad/pad.c Fri Sep 03 19:19:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.15 2010/06/28 17:45:08 pooka Exp $ */
+/* $NetBSD: pad.c,v 1.16 2010/09/03 19:19:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.15 2010/06/28 17:45:08 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.16 2010/09/03 19:19:48 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -54,12 +54,6 @@
 
 extern struct cfdriver pad_cd;
 
-static struct audio_device pad_device = {
-       "Pseudo Audio",
-       "1.0",
-       "pad",
-};
-
 typedef struct pad_block {
        uint8_t         *pb_ptr;
        int             pb_len;
@@ -181,6 +175,9 @@
 {
        int l;
 
+       if (sc->sc_open == 0)
+               return EIO;
+
        if (sc->sc_buflen + blksize > PAD_BUFSIZE)
                return ENOBUFS;
 
@@ -476,8 +473,9 @@
 static int
 pad_getdev(void *opaque, struct audio_device *ret)
 {
-
-       *ret = pad_device;
+       strlcpy(ret->name, "Virtual Audio", sizeof(ret->name));
+       strlcpy(ret->version, osrelease, sizeof(ret->version));
+       strlcpy(ret->config, "pad", sizeof(ret->config));
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index