diff options
| author | Christos Margiolis <christos@FreeBSD.org> | 2026-03-03 11:32:38 +0000 |
|---|---|---|
| committer | Christos Margiolis <christos@FreeBSD.org> | 2026-03-03 11:32:38 +0000 |
| commit | 428517a7712e44b58e0687fbee4037a8ebe5bf5a (patch) | |
| tree | 7afae9b0deb46b0936fe837a2cb98ca675196dfa | |
| parent | d40189f8259e3565c69a40194f7b603d0ca648de (diff) | |
sound: Notify devd when no devices are connected
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D55531
| -rw-r--r-- | sbin/devd/devd.conf.5 | 4 | ||||
| -rw-r--r-- | sbin/devd/snd.conf | 10 | ||||
| -rw-r--r-- | sys/dev/sound/pcm/sound.c | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5 index b1fca89991ed..a1d6a9051389 100644 --- a/sbin/devd/devd.conf.5 +++ b/sbin/devd/devd.conf.5 @@ -38,7 +38,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd July 9, 2025 +.Dd February 26, 2026 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -666,6 +666,8 @@ variable. Connected output device specified in .Pa cdev variable. +.It Li SND Ta Li CONN Ta Li NODEV Ta +No connected devices. .El .Pp .\" diff --git a/sbin/devd/snd.conf b/sbin/devd/snd.conf index a45f427f6c79..5ca0be86e246 100644 --- a/sbin/devd/snd.conf +++ b/sbin/devd/snd.conf @@ -24,3 +24,13 @@ notify 0 { # See comment above. action "/usr/sbin/virtual_oss_cmd /dev/vdsp.ctl -P /dev/$cdev"; }; + +notify 0 { + match "system" "SND"; + match "subsystem" "CONN"; + match "type" "NODEV"; + + # No connected devices. Disable both recording and playback to avoid + # repeated virtual_oss error messages. + action "/usr/sbin/virtual_oss_cmd /dev/vdsp.ctl -f /dev/null"; +}; diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index abd92d93e02d..305d663cd6ad 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -483,6 +483,8 @@ pcm_unregister(device_t dev) snd_unit = pcm_best_unit(-1); if (snd_unit_auto == 0) snd_unit_auto = 1; + if (snd_unit < 0) + devctl_notify("SND", "CONN", "NODEV", NULL); } return (0); |
