On Sat, Jan 25, 2020 at 08:43:29AM +0100, Alexandre Ratchov wrote: > On Fri, Jan 24, 2020 at 04:04:40PM +0100, Thomas de Grivel wrote: > > I have a USB M-Audio card which is very well supported by OpenBSD 6.6 amd64 > > > > My question is : how do I setup an USB audio card as the default audio > > device whenever it is plugged in ? > > > > Also I did not manage to get audio output with environment variables > > only, I had to swap /dev/audio0 and /dev/audio1 and then it worked. > > Could it have something to do with sndiod not running for /dev/audio1 > > ? > > > > In all cases I really like sndio, it is really easy to work with. > > There's no way to detect when the usb device is connected > again. sndiod will start using it the next time it needs to open a > device. As programs tend to keep the device open, you could force > sndiod to reopen the devices (and thus switch to the usb one) by > sending it a HUP signal.
To do certain things after a usb device appears you can use hotplugd(8). > On 6.6 you have to "pkill -1 -x sndiod", on -current the rcctl script > does it for you: > > rcctl reload sndiod