diff options
author | ariff <ariff@FreeBSD.org> | 2007-06-17 16:15:56 +0000 |
---|---|---|
committer | ariff <ariff@FreeBSD.org> | 2007-06-17 16:15:56 +0000 |
commit | fe845d62539b6ce2413cec49e660b11a8ea6acbd (patch) | |
tree | 738721a97c09e924bfd17e1cf9bc6bdd4c31b930 /sys/dev/sound/pcm | |
parent | c1aa49bb800377d13f536b9808df37e774e64c71 (diff) | |
download | FreeBSD-src-fe845d62539b6ce2413cec49e660b11a8ea6acbd.zip FreeBSD-src-fe845d62539b6ce2413cec49e660b11a8ea6acbd.tar.gz |
Add sysctl/tunable "hw.snd.default_auto", which is useful (especially
for non-root users) to automatically assign default unit to a newly
attach device like USB audio.
Diffstat (limited to 'sys/dev/sound/pcm')
-rw-r--r-- | sys/dev/sound/pcm/sound.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 1b6b32f..6e4e093 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -46,6 +46,11 @@ int snd_unit = -1; TUNABLE_INT("hw.snd.default_unit", &snd_unit); #endif +static int snd_unit_auto = 0; +TUNABLE_INT("hw.snd.default_auto", &snd_unit_auto); +SYSCTL_INT(_hw_snd, OID_AUTO, default_auto, CTLFLAG_RW, + &snd_unit_auto, 0, "assign default unit to a newly attach device"); + int snd_maxautovchans = 16; /* XXX: a tunable implies that we may need more than one sound channel before the system can change a sysctl (/etc/sysctl.conf), do we really need @@ -801,7 +806,7 @@ pcm_setstatus(device_t dev, char *str) pcm_unlock(d); - if (snd_unit < 0) + if (snd_unit < 0 || snd_unit_auto != 0) snd_unit = device_get_unit(dev); return (0); |