The branch main has been updated by christos:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d40189f8259e3565c69a40194f7b603d0ca648de

commit d40189f8259e3565c69a40194f7b603d0ca648de
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2026-03-03 11:32:32 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2026-03-03 11:32:32 +0000

    sound: Notify devd on hw.snd.default_unit change
    
    If we have virtual_oss running, this devd notification will make sure to
    automatically transfer sound to the new default unit, while also making
    sure that we switch to it only for the supported directions (recording
    and/or playback).
    
    For more information, please refer to 2ffaca551eaf ("snd_hda: Implement
    automatic redirection between associations").
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D55530
---
 sys/dev/sound/pcm/sound.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 8ce369bfce5e..abd92d93e02d 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -81,6 +81,7 @@ static int
 sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS)
 {
        struct snddev_info *d;
+       char buf[32];
        int error, unit;
 
        unit = snd_unit;
@@ -95,6 +96,12 @@ sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS)
                snd_unit = unit;
                snd_unit_auto = 0;
                bus_topo_unlock();
+
+               snprintf(buf, sizeof(buf), "cdev=dsp%d", snd_unit);
+               if (d->reccount > 0)
+                       devctl_notify("SND", "CONN", "IN", buf);
+               if (d->playcount > 0)
+                       devctl_notify("SND", "CONN", "OUT", buf);
        }
        return (error);
 }

Reply via email to