aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2026-03-03 11:32:32 +0000
committerChristos Margiolis <christos@FreeBSD.org>2026-03-03 11:32:32 +0000
commitd40189f8259e3565c69a40194f7b603d0ca648de (patch)
tree83f924e3c26bc29dbb8e60d682307c293970dd10
parent912864912b71951f9a636190b1dba80528f588eb (diff)
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
-rw-r--r--sys/dev/sound/pcm/sound.c7
1 files changed, 7 insertions, 0 deletions
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);
}