Bug 273901 - Handbook: Automatically Switching to Headphones: More explanation needed
Summary: Handbook: Automatically Switching to Headphones: More explanation needed
Status: In Progress
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Sergio Carlavilla Delgado
URL: https://github.com/freebsd/freebsd-do...
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2023-09-17 14:10 UTC by Jason W. Bacon
Modified: 2023-09-20 07:43 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason W. Bacon freebsd_committer freebsd_triage 2023-09-17 14:10:53 UTC
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
===