Date: Thu, 23 Apr 2026 08:41:20 +0000 From: Christos Margiolis <christos@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: f89909e462e8 - stable/15 - virtual_oss: Introduce virtual_oss_default_control_device rc variable Message-ID: <69e9db30.32503.53cf168e@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f89909e462e8707d8ac5993959b8899712e282c2 commit f89909e462e8707d8ac5993959b8899712e282c2 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2026-04-16 14:51:02 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2026-04-23 08:41:15 +0000 virtual_oss: Introduce virtual_oss_default_control_device rc variable The -t option gives the user the ability to create a control device for a given virtual_oss(8) instance, so that the instance's configuration can be manipulated during runtime with virtual_oss_cmd(8). As is expected, the control device's name is not known, since it is specified by the user. This patch introduces a virtual_oss_default_control_device rc variable, which defaults to "vdsp.ctl". The goal of this is that third-party programs and scripts can access the control device of the default virtual_oss(8) configuration without guessing. This is especially useful for sbin/devd/snd.conf which deals with hot-swapping sound devices using virtual_oss(8). Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D55670 (cherry picked from commit 70e27ecba51892cbe4cc94bbf785c6dd261dfd57) --- libexec/rc/rc.d/virtual_oss | 6 +++++- sbin/devd/snd.conf | 14 ++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libexec/rc/rc.d/virtual_oss b/libexec/rc/rc.d/virtual_oss index d55b51463442..a25abf256f55 100644 --- a/libexec/rc/rc.d/virtual_oss +++ b/libexec/rc/rc.d/virtual_oss @@ -25,6 +25,10 @@ required_modules="cuse" configs= pidpath="/var/run/${name}" default_unit=$(sysctl -n hw.snd.default_unit 2> /dev/null) + +# Default configuration's control device. +: "${virtual_oss_default_control_device:="vdsp.ctl"}" + virtual_oss_default_args="\ -S \ -C 2 \ @@ -35,7 +39,7 @@ virtual_oss_default_args="\ -i 8 \ -f /dev/dsp${default_unit} \ -d dsp \ - -t vdsp.ctl" + -t ${virtual_oss_default_control_device}" # Set to NO by default. Set it to "YES" to enable virtual_oss. : "${virtual_oss_enable:="NO"}" diff --git a/sbin/devd/snd.conf b/sbin/devd/snd.conf index 5ca0be86e246..e2dc6d94a299 100644 --- a/sbin/devd/snd.conf +++ b/sbin/devd/snd.conf @@ -7,12 +7,8 @@ notify 0 { # Other audio servers or device switching commands can be used here # instead of virtual_oss(8). - # - # FIXME: We are hardcoding /dev/vdsp.ctl here, simply because it is a - # common virtual_oss control device name. Until we find a proper way to - # define control devices here, /dev/vdsp.ctl can be changed to the - # control device of choice. - action "/usr/sbin/virtual_oss_cmd /dev/vdsp.ctl -R /dev/$cdev"; + action "/usr/sbin/virtual_oss_cmd \ + /dev/$(sysrc virtual_oss_default_control_device) -R /dev/$cdev"; }; notify 0 { @@ -22,7 +18,8 @@ notify 0 { match "cdev" "dsp[0-9]+"; # See comment above. - action "/usr/sbin/virtual_oss_cmd /dev/vdsp.ctl -P /dev/$cdev"; + action "/usr/sbin/virtual_oss_cmd \ + /dev/$(sysrc virtual_oss_default_control_device) -P /dev/$cdev"; }; notify 0 { @@ -32,5 +29,6 @@ notify 0 { # 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"; + action "/usr/sbin/virtual_oss_cmd \ + /dev/$(sysrc virtual_oss_default_control_device) -f /dev/null"; };home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e9db30.32503.53cf168e>
