Today I’ve been trying to get my FreeBSD machine working with my (wonderful) TV set through HDMI. While I had no problems with the video (It worked out of the box), I was unable to get the sound working.
I was able to put everything in place by “merging” the information in:
In this post I’ll put everything together as a reminder to myself; as a nice side effect, this may be useful to other people with the same issues.
What you need to do to get everything working is 1) tell X to use the correct video driver, and 2) tell the FreeBSD kernel to use HDMI output for the audio.
In my case, I had X working with HAL, so I had no configuration file to tweak. If this is also your case, you can dump your X configuration to a file with the command:
sudo Xorg -configure
The previous command should have left an
xorg.conf.new file in
/root. Copy it to some temporary place and edit it. You should look for a line like the following:
and substitute it with:
Option "Audio" "on"
Option "HDMI" "all"
You can try the new configuration with the command
X -config <your-newly-create-file>; if nothing explodes, copy the file to
/usr/local/etc/X11/xorg.conf (or anywhere where X can find it; see xorg.conf(5)) and you’re done.
Now we have to tell to FreeBSD that we want to use the friggin’ HDMI channel for sound output. To see what device is currently using, execute the command
cat /dev/sndstat. You should see something like this:
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
pcm0: <HDA VIA VT1708S_0 PCM #0 Analog> (play/rec) default
pcm1: <HDA VIA VT1708S_0 PCM #1 Digital> (play)
pcm2: <HDA ATI RS690/780 HDMI PCM #0 HDMI> (play)
As you can see, it is using pcm0 (the analog output) while we want to use pcm2 (the HDMI output). We can change the device with
$ sysctl hw.snd.default_unit=2
And now everything is working fine! (well … at least for me). The only remaining step is to add the last tweak to sysctl.conf (but beware if using modules to load the sound driver; see sysctl.conf(5)).