- return EIO if audio data is received and /dev/pad isn't open

- give a better description for AUDIO_GETDEV
This commit is contained in:
jmcneill 2010-09-03 19:19:48 +00:00
parent 015f9bbf7a
commit 3298ac716e

View File

@ -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>
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.15 2010/06/28 17:45:08 pooka Exp $");
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 @@ pad_add_block(pad_softc_t *sc, uint8_t *blk, int blksize)
{
int l;
if (sc->sc_open == 0)
return EIO;
if (sc->sc_buflen + blksize > PAD_BUFSIZE)
return ENOBUFS;
@ -476,8 +473,9 @@ pad_halt_input(void *opaque)
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;
}