mirror of
https://git.FreeBSD.org/src.git
synced 2026-06-02 11:24:32 +00:00
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
This commit is contained in:
@@ -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"}"
|
||||
|
||||
+6
-8
@@ -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";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user