I'm a busy guy. It's been very, very hard for me to find the time to learn enough about the innards of LinuxMCE to tackle the problem of the non-working HDMI sound on my Jetway Mini-top. However, a week ago after several months of wimpy twiddling and random bashing of the keyboard, I finally figured out how to get HDMI sound working in the crappy 10.04 release (note: I do not like Ubuntu, but don't take that to mean I don't like LinuxMCE. I will be randomly raging against Upoontu, so don't cry).
I have no idea if what I'm about to spell out will work on the current stable LinuxMCE release. I gave up on it while ago because of stupidness (e.g. my second NIC not working without manually building a new driver). I also pieced together most of what needed to be done from several different sources. However, figuring out the order and the repeated testing, plus some key pieces to the final solution were all my doing. If I wasn't already very well experienced with Linux systems, I would have been completely lost. Overall it was not fun, but man was I happy when it all came together.
So...
PRO TIP: make sure the Mini-top's (or whatever it is you're using for your MD) HDMI port is actually plugged into something and that something is powered ON!
NOTE: All these steps were performed on the MD after I logged into it via SSH. I did not do a "chroot" to the MD's directory on the core (i.e. /usr/pluto/diskless/XX).
1. In /etc/modprobe.conf/blacklist, add at the bottom the following:
blacklist snd-usb-audio
This was important. I needed to blacklist this module to prevent it from breaking the MD's boot process and to ensure ONLY the nvidia HDMI audio was enabled.
2. In /etc/modprobe.conf/alsa-base.conf, add this, again at the bottom of the file:
alias snd-card-0 snd-hda-intel
options snd-hda-intel enable_msi=0 probe_mask=0xfff2
This alias bullshit I pulled from memory....from way, way back in the early days of Fedora when I had to battle with alsa to get sound working. I'm not sure it's actually needed here, but I put the crap in anyway. The second line came from the xbmc forums and the xbmc wiki - so awesome.
3. Upgrade alsa. I used this page as a guide:
http://monespaceperso.org/blog-en/2010/05/02/upgrade-alsa-1-0-23-on-ubuntu-lucid-lynx-10-04/I only upgraded alsa-driver and alsa-libs. There's no need to update alsa-utils.
4. Reboot
5, Upgrade the nvidia drivers. Nothing special to note here.
6. Reboot
7. Install this package:
apt-get install linux-backports-modules-alsa-$(uname -r)
This was the biggest piece of the puzzle. Without this package, the nvidia soundcard would not be detected by alsa. I have no idea how the shit I figured this crap out. I think I read about it somewhere on the net. I know for sure it wasn't at all in reference to LinuxMCE, the ION2 or HDMI sound. FUCK!
8. Reboot
9. Edit, /usr/pluto/bin/AVWizard_AudioConnector.sh, like so:
#!/bin/bash
. /usr/pluto/bin/AVWizard-Common.sh
. /usr/pluto/bin/Utils.sh
Param="$1"
case "$Param" in
'Analog Stereo')
XineConfSet audio.output.speaker_arrangement 'Stereo 2.0' "$XineConf"
XineConfSet audio.device.alsa_front_device plughw:0 "$XineConf"
XineConfSet audio.device.alsa_default_device plughw:0 "$XineConf"
;;
'SPDIF Coaxial'|'SPDIF Optical')
XineConfSet audio.output.speaker_arrangement 'Pass Through' "$XineConf"
XineConfSet audio.device.alsa_front_device asym_spdif "$XineConf"
XineConfSet audio.device.alsa_default_device asym_spdif "$XineConf"
XineConfSet audio.device.alsa_passthrough_device "iec958:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2" "$XineConf"
;;
'HDMI')
XineConfSet audio.output.speaker_arrangement 'Pass Through' "$XineConf"
#XineConfSet audio.device.alsa_front_device asym_hdmi "$XineConf"
XineConfSet audio.device.alsa_front_device nvidia_hdmi "$XineConf"
#XineConfSet audio.device.alsa_default_device asym_hdmi "$XineConf"
XineConfSet audio.device.alsa_default_device nvidia_hdmi "$XineConf"
XineConfSet audio.device.alsa_passthrough_device "hdmi:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2" "$XineConf"
;;
esac
/usr/pluto/bin/SetupAudioVideo.sh
Makes sure Xine uses the nvidia HDMI card (configured below).
10. At the bottom of /usr/pluto/templates/asound.conf, add this:
pcm.nvidia_hdmi {
type hw
card 0
device 3
}
This configures the HDMI "card" for use with alsa.
8. Edit, the Setup_AsoundConf() function in /usr/pluto/bin/SetupAudioVideo.sh like so:
Setup_AsoundConf()
{
local AudioSetting="$1"
local SoundCard
SoundCard=$(GetDeviceData "$PK_Device" "$DEVICEDATA_Sound_Card"|cut -f2 -d";")
SoundCard=$(TranslateSoundCard "$SoundCard")
if [[ -z "$SoundCard" ]]; then
SoundCard=0
fi
sed -r "s,%MAIN_CARD%,$SoundCard,g" /usr/pluto/templates/asound.conf >/etc/asound.conf
case "$AudioSetting" in
*[CO]*)
# audio setting is Coaxial or Optical, i.e. S/PDIF
#echo 'pcm.!default asym_spdif' >>/etc/asound.conf
echo 'pcm.!default nvidia_hdmi' >> /etc/asound.conf
EnableDigitalOutputs
;;
*H*)
# audio setting is HDMI
#echo 'pcm.!default asym_hdmi' >>/etc/asound.conf
echo 'pcm.!default nvidia_hdmi' >> /etc/asound.conf
EnableDigitalOutputs
;;
*)
# audio setting is Stereo or something unknown
echo 'pcm.!default asym_analog' >>/etc/asound.conf
;;
esac
}
That makes the nvidia HDMI card configured in the previous step the default output for sound.
9. Reboot
When the MD came back up, "aplay -L" correctly reported the NVidia HDMI sound card, and because of the mask (in alsa-base.conf), only one soundcard was shown. You should see the same.
Now everything works. mp3s, MKVs, AVIs, stereo sound, multichannel, dolby, DTS, LPCM...you name it. Sound over HDMI works flawlessly. Also, my changes to a couple of the scripts have assured reboots won't adversely affect sound over HDMI.
The only problem is I'm sure a future update will likely blow some of my changes away. I hope the devs can incorporate what I've done into the setup scripts, thereby truly automating this particular MD's LinuxMCE setup.
Oh, one final note: I'll make sure the wiki article has a better flow for the steps (a couple are out of logical order, though the way I wrote the above how-to won't prevent HDMI sound from being correctly setup).
I hope this helps someone!