mirror of
https://github.com/opnsense/src.git
synced 2026-04-15 14:29:58 -04:00
sound(4): Implement playback and recording mode sysctl(8).
The dev.pcm.<N>.mode sysctl(8) gives information if a sound device supports hardware mixing, playback or recording. Submitted by: Christos Margiolis <christos@freebsd.org> Differential Revision: https://reviews.freebsd.org/D31320 MFC after: 1 week Sponsored by: NVIDIA Networking
This commit is contained in:
parent
132fca6335
commit
ed2196e5df
2 changed files with 27 additions and 0 deletions
|
|
@ -1015,10 +1015,28 @@ SYSCTL_PROC(_hw_snd, OID_AUTO, clone_gc,
|
|||
"global clone garbage collector");
|
||||
#endif
|
||||
|
||||
static u_int8_t
|
||||
pcm_mode_init(struct snddev_info *d)
|
||||
{
|
||||
u_int8_t mode = 0;
|
||||
|
||||
if (d->playcount > 0)
|
||||
mode |= PCM_MODE_PLAY;
|
||||
if (d->reccount > 0)
|
||||
mode |= PCM_MODE_REC;
|
||||
if (d->mixer_dev != NULL)
|
||||
mode |= PCM_MODE_MIXER;
|
||||
|
||||
return (mode);
|
||||
}
|
||||
|
||||
static void
|
||||
pcm_sysinit(device_t dev)
|
||||
{
|
||||
struct snddev_info *d = device_get_softc(dev);
|
||||
u_int8_t mode;
|
||||
|
||||
mode = pcm_mode_init(d);
|
||||
|
||||
/* XXX: a user should be able to set this with a control tool, the
|
||||
sysadmin then needs min+max sysctls for this */
|
||||
|
|
@ -1030,6 +1048,11 @@ pcm_sysinit(device_t dev)
|
|||
"bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, d,
|
||||
sizeof(d), sysctl_dev_pcm_bitperfect, "I",
|
||||
"bit-perfect playback/recording (0=disable, 1=enable)");
|
||||
SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
|
||||
OID_AUTO, "mode", CTLFLAG_RD, NULL, mode,
|
||||
"mode (1=mixer, 2=play, 4=rec. The values are OR'ed if more than one"
|
||||
"mode is supported)");
|
||||
#ifdef SND_DEBUG
|
||||
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
|
||||
|
|
|
|||
|
|
@ -412,6 +412,10 @@ struct snddev_info {
|
|||
void sound_oss_sysinfo(oss_sysinfo *);
|
||||
int sound_oss_card_info(oss_card_info *);
|
||||
|
||||
#define PCM_MODE_MIXER 0x01
|
||||
#define PCM_MODE_PLAY 0x02
|
||||
#define PCM_MODE_REC 0x04
|
||||
|
||||
#define PCM_LOCKOWNED(d) mtx_owned((d)->lock)
|
||||
#define PCM_LOCK(d) mtx_lock((d)->lock)
|
||||
#define PCM_UNLOCK(d) mtx_unlock((d)->lock)
|
||||
|
|
|
|||
Loading…
Reference in a new issue