Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Oct 2024 00:53:45 +0300
From:      Christos Margiolis <christos@freebsd.org>
To:        Alban Hertroys <haramrae@gmail.com>
Cc:        Dag-Erling =?utf-8?B?U23DuHJncmF2?= <des@freebsd.org>,  freebsd-stable@freebsd.org
Subject:   Re: uaudio device re-attach and persisting dev.pcm.$pcm.bitperfect sysctl
Message-ID:  <fgpuue37atkszq5hbty2ec47c47nd3dpokrdhl4g4b3qlh4po2@luayn4ocxtpw>
In-Reply-To: <8745F9FB-9CC1-476C-9445-DC0A7A76165F@gmail.com>
References:  <F61ECC96-6FCB-4A4E-9EEC-8D6AF31A8A62@gmail.com> <86ploiwxw8.fsf@ltc.des.dev> <8745F9FB-9CC1-476C-9445-DC0A7A76165F@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Alban Hertroys wrote:
> Meanwhile, several people here suggested that devd is the way to go
> about this. I had actually looked into that a bit, but that seemed to
> require a related device node in /dev, and there’s neither one for pcm
> nor for uaudio, so I discarded that as not being a viable option.
> Perhaps too soon.

Audio device nodes are /dev/dspX, where X is the unit number, which has
a 1-1 relation with the pcmX unit number, so pcm2's device node is
/dev/dsp2.

To clarify some more things, the sound subsystem roughly consists of the
following layers:
- The sound(4) layer, which is the highest-level layer, and among other
  things, is responsible for mixing channels, doing conversions,
  providing some generic functions for sound drivers to use, as well as
  providing a uniform device interface (i.e pcmX).
- The device driver (e.g snd_uaudio(4), snd_hda(4), ...) layer, which is
  responsible for actually communicating with the sound card.

You could visualize it as follows:

some usb card		-> uaudio0	-> pcm0
some other usb card	-> uaudio1	-> pcm1
some intel card		-> hdaa0	-> pcm2

>
> [...]
>
> I can see devd looking to match uaudio0 and pcm2 devices to several
> names it knows (probably from other devd confs?), but it doesn’t seem
> to match my attempt. Let alone that it got around to attempting to
> parse my sh tidbit.

So in your case, "pcm2" is a generic name given to the device by
sound(4) and "uaudio0" is the name of the driver this device is using,
but the actual device node is /dev/dsp2.

What I think is confusing is that sound(4) names devices as "pcm", but
creates the nodes as "dsp"... Maybe I should propose a patch to get rid
of this scheme, and simply name them everywhere as either "pcm", "dsp",
or something else like "snd".

Christos



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fgpuue37atkszq5hbty2ec47c47nd3dpokrdhl4g4b3qlh4po2>