Bug 120406 - [devd] [patch] Handle newly attached pcm devices (eg. via uaudio)
Summary: [devd] [patch] Handle newly attached pcm devices (eg. via uaudio)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2008-02-08 10:10 UTC by Aragon Gouveia
Modified: 2017-12-31 22:29 UTC (History)
0 users

See Also:

file.txt (410 bytes, text/plain)
2008-02-08 10:10 UTC, Aragon Gouveia
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aragon Gouveia 2008-02-08 10:10:00 UTC
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.

I've included a devd.conf addition and an rc script for inclusion to
/etc/rc.d.  The rc script only works if pcm_defaulthot is set to YES
in /etc/rc.conf, and I would say it should be set to NO by default.

Fix: devd.conf entry:

attach 100 {
	device-name "pcm[0-9]+";
	action "/etc/rc.d/pcm start $device-name";

Patch attached with submission follows:
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-02-08 16:08:44 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 Aragon Gouveia 2008-05-11 18:04:11 UTC

I noticed today that there is a sysctl variable, hw.snd.default_auto, that
performs half the functionality of my script - great!  Still no mixer
restoral though so I think it might be worth considering my script minus the
sysctl line.

Has anyone taken a look at this?

Comment 3 Chris Rees freebsd_committer 2012-10-31 18:35:43 UTC
Responsible Changed
From-To: freebsd-rc->freebsd-usb

I definitely think that rc is the wrong place for this.  It's a good 
idea, but it needs integrating into devd; I don't see that is will ever 
need executing on boot.
Comment 4 patfbsd 2012-11-03 23:07:04 UTC

In my opinion this kind of behavior should be handle by the user, using
hand made devd entry, unless there is a benefit for most of users.

For example I use a guitar effects processor which is seen as uaudio(4)
device. When I plug in, I really don't want it to auto-magically change
the default sound unit (I use it on input). 

(my 2 cents)

Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:54 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped