[Bug 273901] Handbook: Automatically Switching to Headphones: More explanation needed

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 17 Sep 2023 14:10:53 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273901

            Bug ID: 273901
           Summary: Handbook: Automatically Switching to Headphones: More
                    explanation needed
           Product: Documentation
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Books & Articles
          Assignee: doc@FreeBSD.org
          Reporter: jwb@freebsd.org

I'm trying to get a better understanding of how to diagnose sound issues on
FreeBSD.

The handbook, under "Automatically Switching to Headphones", contains the
following example:

===
Some systems may struggle with switching between audio outputs, but fortunately
FreeBSD allows automatic switchover to be configured in device.hints.

Identify how the system is enumerating the audio outputs by executing the
following command:

% dmesg | grep pcm

The output looks something like this:

pcm0: <Realtek ALC892 Analog> at nid 23 and 26 on hdaa0
pcm1: <Realtek ALC892 Right Analog Headphones> at nid 22 on hdaa0

Add the following lines to /boot/device.hints:

hint.hdac.0.cad0.nid22.config="as=1 seq=15 device=Headphones"
hint.hdac.0.cad0.nid26.config="as=2 seq=0 device=speakers"
===

It is not at all evident how the values of "as" and "seq" were determined from
the dmesg output above. 

Also, running "dmesg | grep pcm" does not even reveal which device is the
headphone jack on my Lenovo T430.  I suspect the details provided to dmesg are
highly variable across devices.

===
FreeBSD moray.acadix  bacon ~ 1004: dmesg|grep pcm
pcm0: <Realtek ALC269 (Analog)> at nid 20 and 24 on hdaa0
pcm1: <Realtek ALC269 (Analog)> at nid 21 and 18 on hdaa0
pcm2: <Intel Panther Point (HDMI/DP 8ch)> at nid 5 on hdaa1
pcm3: <Intel Panther Point (HDMI/DP 8ch)> at nid 6 on hdaa1
pcm4: <Intel Panther Point (HDMI/DP 8ch)> at nid 7 on hdaa1
pcm0: <Realtek ALC269 (Analog 2.0+HP/2.0)> at nid 20,21 and 24 on hdaa0
pcm1: <Realtek ALC269 (Internal Analog Mic)> at nid 18 on hdaa0
pcm2: <Intel Panther Point (HDMI/DP 8ch)> at nid 5 on hdaa1
pcm3: <Intel Panther Point (HDMI/DP 8ch)> at nid 6 on hdaa1
pcm4: <Intel Panther Point (HDMI/DP 8ch)> at nid 7 on hdaa1
===

Maybe the handbook should explain how to use "sysctl dev.hdac.0.pindump=1" and
"dmesg" to obtain that information?  Another developer pointed me to this
method in bug #273809.

===
<<<ROOT@moray.acadix>>> /home/bacon 1063 # sysctl dev.hdac.0.pindump=1
dev.hdac.0.pindump: 0 -> 0
<<<ROOT@moray.acadix>>> /home/bacon 1064 # dmesg | awk '$2 == "nid" || $6 ==
"Headphones"'
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 21 0321101f 1  15 Headphones    Jack  1/8     Left       Black   0
hdaa0: 27 6121113f 3  15 Headphones    None  1/8     Ext-Rear   Black   1 DISA
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
===

-- 
You are receiving this mail because:
You are the assignee for the bug.