summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2016-06-18 07:59:31 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2016-06-18 07:59:31 +0000
commitfb1480679e84094bc322164a241adc2364432552 (patch)
tree89688c178d82d9b37294f628179e385531649a2d /sys
parent315ac40e6f8475fe5a4fc35f0ca109409c7662b3 (diff)
Add a new AUDIO_GETSTATUS ioctl to get various audio driver variables.
It's intended for use with diagnostic tools (like audioctl) and is of no use to audio programs.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/audio.c14
-rw-r--r--sys/sys/audioio.h13
2 files changed, 25 insertions, 2 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 29419c5ae67..ade54dfb825 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.148 2016/06/01 09:48:20 mglocker Exp $ */
+/* $OpenBSD: audio.c,v 1.149 2016/06/18 07:59:30 ratchov Exp $ */
/*
* Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org>
*
@@ -1161,6 +1161,15 @@ audio_ioc_setpar(struct audio_softc *sc, struct audio_swpar *p)
}
int
+audio_ioc_getstatus(struct audio_softc *sc, struct audio_status *p)
+{
+ p->mode = sc->mode;
+ p->pause = sc->pause;
+ p->active = sc->active;
+ return 0;
+}
+
+int
audio_match(struct device *parent, void *match, void *aux)
{
struct audio_attach_args *sa = aux;
@@ -1743,6 +1752,9 @@ audio_ioctl(struct audio_softc *sc, unsigned long cmd, void *addr)
case AUDIO_GETPAR:
error = audio_ioc_getpar(sc, (struct audio_swpar *)addr);
break;
+ case AUDIO_GETSTATUS:
+ error = audio_ioc_getstatus(sc, (struct audio_status *)addr);
+ break;
case AUDIO_SETINFO:
error = audio_setinfo(sc, (struct audio_info *)addr);
break;
diff --git a/sys/sys/audioio.h b/sys/sys/audioio.h
index 0c5e850f073..e145904a2ec 100644
--- a/sys/sys/audioio.h
+++ b/sys/sys/audioio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: audioio.h,v 1.24 2016/03/16 06:46:39 ratchov Exp $ */
+/* $OpenBSD: audioio.h,v 1.25 2016/06/18 07:59:30 ratchov Exp $ */
/* $NetBSD: audioio.h,v 1.24 1998/08/13 06:28:41 mrg Exp $ */
/*
@@ -59,6 +59,16 @@ struct audio_swpar {
};
/*
+ * argument to AUDIO_GETSTATUS
+ */
+struct audio_status {
+ int mode;
+ int pause;
+ int active;
+ int _spare[5];
+};
+
+/*
* Audio device
*/
struct audio_prinfo {
@@ -173,6 +183,7 @@ typedef struct audio_encoding {
#define AUDIO_SETPAR _IOWR('A', 37, struct audio_swpar)
#define AUDIO_START _IO('A', 38)
#define AUDIO_STOP _IO('A', 39)
+#define AUDIO_GETSTATUS _IOR('A', 40, struct audio_status)
#define AUDIO_PROP_FULLDUPLEX 0x01
#define AUDIO_PROP_MMAP 0x02
#define AUDIO_PROP_INDEPENDENT 0x04