devd/snd.conf: Handle absent control device properly

If virtual_oss is not enabled when these rules run on startup, dmesg
will show the following messages:

Starting devd.
virtual_oss_cmd: Could not open control device: /dev/vdsp.ctl: No such file or directory
virtual_oss_cmd: Could not open control device: /dev/vdsp.ctl: No such file or directory

Reported by:	olce, Mark Millard <marklmi@yahoo.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Christos Margiolis
2026-06-09 17:10:58 +02:00
parent 8011f6b0d8
commit 439b219fed
+9 -6
View File
@@ -7,8 +7,9 @@ notify 0 {
# Other audio servers or device switching commands can be used here
# instead of virtual_oss(8).
action "/usr/sbin/virtual_oss_cmd \
/dev/$(sysrc -n virtual_oss_default_control_device) -R /dev/$cdev";
action "\
vd=/dev/$(sysrc -n virtual_oss_default_control_device); \
test -e ${vd} && /usr/sbin/virtual_oss_cmd ${vd} -R /dev/$cdev";
};
notify 0 {
@@ -18,8 +19,9 @@ notify 0 {
match "cdev" "dsp[0-9]+";
# See comment above.
action "/usr/sbin/virtual_oss_cmd \
/dev/$(sysrc -n virtual_oss_default_control_device) -P /dev/$cdev";
action "\
vd=/dev/$(sysrc -n virtual_oss_default_control_device); \
test -e ${vd} && /usr/sbin/virtual_oss_cmd ${vd} -P /dev/$cdev";
};
notify 0 {
@@ -29,6 +31,7 @@ notify 0 {
# No connected devices. Disable both recording and playback to avoid
# repeated virtual_oss error messages.
action "/usr/sbin/virtual_oss_cmd \
/dev/$(sysrc -n virtual_oss_default_control_device) -f /dev/null";
action "\
vd=/dev/$(sysrc -n virtual_oss_default_control_device); \
test -e ${vd} && /usr/sbin/virtual_oss_cmd ${vd} -f /dev/null";
};