How to set default pcm device?

Christian Weisgerber naddy at
Sat Feb 3 20:45:07 UTC 2018

After boot, my /dev/sndstat looks like this:

Installed devices:
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <Realtek ALC280 (Analog 2.0+HP/2.0)> (play/rec) default
pcm2: <Realtek ALC280 (Rear Analog)> (play/rec)
pcm3: <USB audio> (play)
No devices installed from userspace.

However, I would like the USB audio device, pcm3, to be the default
sound unit.  How do I set this persistently across reboots?

The traditional solution was to set hw.snd.default_unit=3 in
/boot/loader.conf.  That worked for FreeBSD 10.x, but with 11.x the
USB devices are attached very late and the boot loader setting
(which I still have) is effectively ignored.  Loading the uaudio
module early with snd_uaudio_load=YES doesn't change this.  Setting
hw.snd.default_unit in /etc/sysctl.conf is unlikely to work either;
certainly it's a race.

Do I need to define a devd(8) action for when uaudio attaches or
is there a better way?

Christian "naddy" Weisgerber                          naddy at

More information about the freebsd-questions mailing list