Module Name: src
Committed By: jmcneill
Date: Fri Sep 3 19:19:49 UTC 2010
Modified Files:
src/sys/dev/pad: pad.c
Log Message:
- return EIO if audio data is received and /dev/pad isn't open
- give a better description for AUDIO_GETDEV
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pad/pad.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.15 src/sys/dev/pad/pad.c:1.16
--- src/sys/dev/pad/pad.c:1.15 Mon Jun 28 17:45:08 2010
+++ src/sys/dev/pad/pad.c Fri Sep 3 19:19:48 2010
@@ -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 <[email protected]>
@@ -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;
}