[Call for testing] HDA audio redirection without manual patching associations

From: Christos Margiolis <christos_at_freebsd.org>
Date: Wed, 04 Jun 2025 18:19:37 UTC
Some of you may remember D49216 [1], which was meant to be part of a
series of patches to address the pin patching problem with HDA sound
cards. For anyone who doesn't understand what this means; some HDA
devices need manual patching inside snd_hda(4) in order for sound to be
redirected to/from headset/headphones once the jack is (un-)plugged.

However, I abandoned that patch along with the followup ones, as they
would most likely introduce bugs and maintenance burden. Instead I've
been working on D50070 [2], which is significantly more elegant, albeit
slightly slower and requiring virtual_oss, which is not _yet_ in base.

The commit message in the review explains how this all works.

To test:

1. Apply [3] to disable pin patches. _Note_ that this may not have an
   effect if your device doesn't require any of those patches, which in
   that case means you do not need this workaround in the first place.

	$ cd /usr/src
	$ curl https://people.freebsd.org/~christos/disable_patch.diff | patch -p1

2. Apply the patch [2].

	$ cd /usr/src
	$ git arc patch D50070

   If you do not have git-arc(1) set up, download the diff (see
   "Download Raw Diff") and apply it manually.
3. Rebuild the sound driver, as well as devd(8), and reboot. If you have
   sound(4) compiled into the kernel, then you'll have to rebuild the
   whole kernel.
4. Start a virtual_oss instance with vdsp.ctl (see -t option) as the
   control device. For example:

	# virtual_oss -S -C 2 -c 2 -r 48000 -b 16 -s 1024 -f /dev/dsp0 -t vdsp.ctl -d dsp

   Replace /dev/dsp0 with the file corresponding to the HDA device you
   want to test. Of course, make sure you have audio/virtual_oss
   installed.
5. Start playing audio.
6. Plug and unplug headphones and headsets. The expected result is that
   sound is redirected properly to the headphones/headset mic when
   plugged, and back to the speakers/internal mic when unplugged.

I am sure this seems rather tedious, but once virtual_oss is ported to
base, and the patch committed, this can all be automatic.

Please let me know if there is any problem, which I assume there will
be. :-)

Christos

[1] https://reviews.freebsd.org/D49216
[2] https://reviews.freebsd.org/D50070
[3] https://people.freebsd.org/~christos/disable_patch.diff