# hw.snd.default_unit invalid argument



## Kalero (May 14, 2016)

Hi,

I'm trying to set my default sound device in FreeBSD 10.3 and, according to the handbook, the variable hw.snd.default_unit needs to be set pointing to the correct pcm (in my case, and according to /dev/sndstat, it's pcm6). So, I add 
	
	



```
hw.snd.default_unit=6
```
 in /etc/sysctl.conf but, when system boots, I see a line saying: 
	
	



```
hw.snd.default_unit=6 invalid argument
```
, even though the sound device at pcm6 seems to be set up correctly and my sound is working fine. Anybody has idea why I'm seeing that line saying "hw.snd.default_unit=6 invalid argument"? I have an Edirol UA-25, working with snd_uaudio(4) driver. Many thanks


----------



## cpm@ (May 19, 2016)

Can you show the following output?

`cat /dev/sndstat`


----------



## wblock@ (May 19, 2016)

Probably the value is set before the USB device appears.  I see the same thing with my motherboard audio.


----------



## wblock@ (May 19, 2016)

Hmm.  Well, I have seen it, but it's not in the logs of either the desktop or notebook right now.


----------



## cpm@ (May 19, 2016)

Probably, this knob will be useful here.

```
% sysctl -d hw.snd.default_auto
hw.snd.default_auto: assign default unit to a newly attached device
```
This means that enabling the hw.snd.default_auto knob will automatically assign hw.snd.default_unit to newly-attached devices.


----------



## Kalero (May 19, 2016)

Well, it's solved. Although snd_uaudio(4) driver was loaded when the system had completely booted up and sound was working fine, it seems the reason of that message was because `sysctl` attempted to set the default sound device before its driver was loaded and, consequently, before the device was recognised. To solve the issue, I just needed to load the driver at boot time adding 
	
	



```
snd_uaudio_load="YES"
```
 in loader.conf(5). Many thanks.


----------

