The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=428517a7712e44b58e0687fbee4037a8ebe5bf5a
commit 428517a7712e44b58e0687fbee4037a8ebe5bf5a Author: Christos Margiolis <[email protected]> AuthorDate: 2026-03-03 11:32:38 +0000 Commit: Christos Margiolis <[email protected]> CommitDate: 2026-03-03 11:32:38 +0000 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 --- sbin/devd/devd.conf.5 | 4 +++- sbin/devd/snd.conf | 10 ++++++++++ sys/dev/sound/pcm/sound.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) 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);
