From fb1480679e84094bc322164a241adc2364432552 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Sat, 18 Jun 2016 07:59:31 +0000 Subject: 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. --- sys/dev/audio.c | 14 +++++++++++++- sys/sys/audioio.h | 13 ++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'sys') 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 * @@ -1160,6 +1160,15 @@ audio_ioc_setpar(struct audio_softc *sc, struct audio_swpar *p) return 0; } +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) { @@ -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 $ */ /* @@ -58,6 +58,16 @@ struct audio_swpar { unsigned int _spare[6]; }; +/* + * argument to AUDIO_GETSTATUS + */ +struct audio_status { + int mode; + int pause; + int active; + int _spare[5]; +}; + /* * Audio device */ @@ -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 -- cgit v1.2.3