"Default sound unit" functionality is needed.

Francois Tigeot ftigeot at wolfpond.org
Mon Jul 21 02:35:54 PDT 2014


Hi,

On Thu, Jul 03, 2014 at 07:56:27PM +0400, Vasily Postnicov wrote:
> 
> I need functionality similar to FreeBSD hw.snd.default_unit sysctl. It
> defines which audio devices (/dev/dspN, /dev/mixerN) will be opened if
> someone opens /dev/dsp or /dev/mixer.
> 
> I don't have a good idea how this can be done. I've made a quick patch for
> dsp devices, it is attached.
> The problem is that now the "default" node is opened all the time, no
> matter if I open /dev/dsp or a specific /dev/dspN device.
> 
> My first thought was to compare ap->a_name to "dsp" to know if we just open
> /dev/dsp or more specific /dev/dspN, but ap->a_name always has a form
> "dspN", even if /dev/dsp is opened.
> 
> Any ideas how to implement this correctly?

I have an imperfect port of the modern FreeBSD sound system here:

http://gitweb.dragonflybsd.org/~ftigeot/dragonfly.git/shortlog/refs/heads/pcm_2014_july

(Use git://leaf.dragonflybsd.org/~ftigeot/dragonfly.git and the pcm_2014_july
branch to clone it)

The hw.snd.default_unit sysctl is present.

The two big missing parts in the pcm_2014_july branch are:
- Removal of the midi code; it's untested and nobody seem to use it anyway
- Fix the devfs interface to allow device cloning and sound mixing (this may
  be related to the default node opening issue you are encountering)

I unfortunately don't have time to work on it anymore since I'm focusing on
drm/i915 but you may nevertheless find this code useful.

-- 
Francois Tigeot


More information about the Kernel mailing list