Handling of newly attached pcm devices (eg. via uaudio)

Aragon Gouveia aragon at phat.za.net
Thu Jan 31 04:26:55 PST 2008


Hi,

On my FreeBSD workstations I frequently use a USB sound device (headphone
amplifier).  I typically plug it in and out only when I need it, and expect
(or hope!) for my system to use it when it's plugged in, but use the onboard
sound when it is unplugged.

On FreeBSD 7 I used to set hw.snd.default_unit to 1 (from 0) after plugging
the device in and then set the mixer levels to how I want them.  I've
subsequently automated this ala devd and a shell script to do precisely the
same thing, except the shell script also calls /etc/rc.d/mixer to restore
the saved mixer settings in /var/db.

I would like to PR my work in the hope of someone committing it as I think
it might be useful to others.  What are people's opinions of this idea,
in particular setting hw.snd.default_unit to make a newly plugged sound
device the default?  Can anyone think of a better way to handle newly
attached sound hardware?


Thanks,
Aragon


More information about the freebsd-multimedia mailing list