Page MenuHomeFreeBSD

D55670.id173201.diff
No OneTemporary

D55670.id173201.diff

diff --git a/libexec/rc/rc.d/virtual_oss b/libexec/rc/rc.d/virtual_oss
--- a/libexec/rc/rc.d/virtual_oss
+++ b/libexec/rc/rc.d/virtual_oss
@@ -34,8 +34,7 @@
-s 8ms \
-i 8 \
-f /dev/dsp${default_unit} \
- -d dsp \
- -t vdsp.ctl"
+ -d dsp"
# 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
--- a/sbin/devd/snd.conf
+++ b/sbin/devd/snd.conf
@@ -7,11 +7,6 @@
# 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";
};
diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c
--- a/usr.sbin/virtual_oss/virtual_oss/main.c
+++ b/usr.sbin/virtual_oss/virtual_oss/main.c
@@ -1630,6 +1630,7 @@
char voss_dsp_rx_device[VMAX_STRING];
char voss_dsp_tx_device[VMAX_STRING];
char voss_ctl_device[VMAX_STRING];
+static int have_default_ctldev = 0;
uint32_t voss_jitter_up;
uint32_t voss_jitter_down;
@@ -1914,6 +1915,16 @@
printf(SYSCTL_BASECLONE ": %d -> 0\n", voss_baseclone);
if (atexit(restore_baseclone) < 0)
return ("Could not set atexit callback");
+ /*
+ * Hardcode control device name when we replace
+ * /dev/dsp with our own. This is an easy way for other
+ * programs to know which is the control device when we
+ * have a virtual_oss-created /dev/dsp. For an example,
+ * see sbin/devd/snd.conf.
+ */
+ strlcpy(voss_ctl_device, "vdsp.ctl",
+ sizeof(voss_ctl_device));
+ have_default_ctldev = 1;
}
/* create DSP character device */
@@ -2303,6 +2314,11 @@
return ("-s option requires a non-zero positive value");
break;
case 't':
+ if (have_default_ctldev) {
+ return ("Creating /dev/dsp automatically "
+ "creates a /dev/vdsp.ctl control device "
+ "and cannot be overwritten");
+ }
if (voss_ctl_device[0])
return ("-t parameter may only be used once");

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 8, 5:17 PM (16 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36243527
Default Alt Text
D55670.id173201.diff (2 KB)

Event Timeline