Rainbow Scenery
Valid HTML 4.01 Transitional

Zotac Zbox AD03BR
Software Setup

Jim Carter, 2012-03-16

Contents

Migrating from Aurora

As much as possible, I tried to copy the working configurations from Aurora onto Iris. Here is a laundry list of software subsystems that had to be dealt with.

Graphics Processor Struggles

Which graphics driver am I going to use? This is a comparison of radeon vs. fglrx. The radeonhd driver was excluded because it does not support the HD 6310 device. On the 3D tests, ragged means that alternate scan lines were shifted about 16 pixels.

  radeon fglrx
Political Status Open Source Proprietary
Supports AMD HD 6310 Yes Yes
KMS (Kernel Mode Setting) Required Forbidden
2D Graphics Perfect Perfect
glxgears Ragged Perfect
mesademo fire Ragged 60fps Perfect 157 fps
Play Theora (CPU utilization on each core) 25% + 25%
Play MPEG-2 12% + 12%
Play MPEG-4 6% + 6%
HDMI audio Works Works
Suspend to RAM 1/5 hang Similar, hangs
Suspend to disc Perfect Perfect

Notes for MPEG-2 and MPEG-4 playback:

Clearly the open source Radeon driver is not going to fly in this application, at least until the raggedy problem is fixed. But compiling and installing the ATI proprietary module fglrx is always traumatic and messy.

Sound Issues

ALSA sound is the most frustrating of all Linux subsystems due to arcane configuration and fungoid evolution of the design. Here's what I did t get ALSA sound under control.

First, on this system there are three sound devices.

The normal default audio device of hw:0,0 exists only rarely. Numerically based card assignments are subject to change without notice. This situation of course is unacceptable for daily use. The goal at this point is to specify the three sound devices using keys that are unique and immutable. Here is what I did to bring some sanity to the sound configuration.

If your sound devices are each served by different modules, the easiest way to nail them down is to specify the index parameter of each relevant driver; this parameter determines the card number(s). Following forum postings I tried (unsuccessfully) the following method. Look in /etc/modprobe.d . Files therein have the form: number hyphen basename .conf, e.g. 50-radeon_audio.conf . In this file I put:

options snd_hda_intel index=0,1 
options snd_usb_audio index=2
(Use e.g. modinfo snd_hda_intel to determine which drivers have the index parameter.) These settings were obeyed, and if each driver served only one device this fix would have been sufficient, but I have multiple devices on the Intel driver, so I had to use a different solution. It is possible to specify a model parameter on the Intel driver, but I could not get it to cue on the IDs.

Next, let's look at /proc/asound/cards .

 0 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfeb44000 irq 44
 1 [SB             ]: HDA-Intel - HDA ATI SB
                      HDA ATI SB at 0xfeb40000 irq 16
 2 [Device         ]: USB-Audio - USB Sound Device
                      C-Media INC. USB Sound Device at usb-0000:06:00.0-2.4, full speed
The integers are the card numbers, determined by the drivers' index parameters, or the order in which their respective driver modules are loaded (if the index is unspecified), which occurs in parallel threads and so is not deterministic. The third column, e.g. USB Sound Device, comes from the idProduct attribute on USB, and I can't find it for PCI. The last whitespace separated word of this attribute gives the value for the id attribute, which appears in the second column of /proc/asound/cards . These values are kind of lame and could easily be non-unique.

If your ID values are not satisfactory, use this solution to set the ID attributes to something consistent and unique, by a udev rule. Do this for each sound device. Pick a device inode associated with each sound device: /dev/snd/controlC2 (substitute each card number) always exists. Now do:

udevadm info --attribute-walk --name=/dev/snd/controlC2
Find its ancestor that has the id attribute, which you're going to change. The output will say something like ATTRS{id}=="Device". Now look for one grand-ancestor with unique attributes, like the vendor and product. Finally you will assign ATTR{id} (singular) (one = for assignment, 2 for comparison). Here are my rules, in /etc/udev/rules.d/26-soundJ.rules .
ATTR{id}=="*" ATTRS{vendor}=="0x1002" ATTRS{device}=="0x4383" ATTR{id}="Azalia"
ATTR{id}=="*" ATTRS{vendor}=="0x1002" ATTRS{device}=="0x1314" ATTR{id}="AMD_HDMI"
ATTR{id}=="*" ATTRS{idVendor}=="0d8c" ATTRS{idProduct}=="0103" ATTR{id}="TurtleBeach"

Explanation:

If you have multiple devices with the same vendor and product codes, you need to find another unique attribute to cue on. Some devices have a serial number. I believe the KERNEL uniquely identifies the port or slot that the device is plugged into, so it will be satisfactory as long as you do not move the device, which can be a problem with USB.

To make this rule effective, remove all the sound driver modules like this:

lsmod | grep ^snd_
modprobe -r -v snd_usb_audio # (pick an unused driver)
modprobe -r -v snd_hda_intel
etc. etc.; repeat from the lsmod step until all are gone.

Then reload the keystone drivers. Instead you might simplify your life by rebooting, just like on Windows. Check your work by inspecting /proc/asound/cards and make sure your ID values are now shown in the second column.

Now that you have useful ID values, you can use them like this. For the user who is going to play the sound, change to its home directory (the value of the HOME environment variable when the sound program executes). For MythTV I have a special user called watchtv. ALSA is configured from these files:

Edit $HOME/.asoundrc . Here is what I use for MythTV. The name ati_hdmi is arbitrary, but avoid sleeping dragons and don't try to replace a system-defined PCM.
pcm.ati_hdmi {
        type    hw
        card    AMD_HDMI
        device  3
}
ctl.ati_hdmi {
        type    hw
        card    AMD_HDMI
}
# The ! is important; without it, ALSA lib gets an error.
pcm.!default    pcm.ati_hdmi

You need to define both the pcm and ctl devices (mixer). While the card is normally specified as an integer, you can give the ID attribute as appearing in /proc/asound/cards . With this default override, the sound generating program will send output over HDMI no matter how the module order is randomized at boot time.

Reviving MythTV

We encountered a problem: programs were being captured, but not written to disc. Missing filenames:
3181_20120326120000.mpg
3181_20120327180000.mpg
3181_20120327190000.mpg

Checked storage; plenty is free. For /home/video, 222Gb total, 184Gb used, 11Gb reserved for root, 27Gb available (not reserved). I also deleted about 50Gb of old programs that we couldn't watch due to Myth being unavailable (after the above df output). And rebooted Iris.

A few shows were recorded, but after a sleep-wake cycle the next show was not recorded. Forum postings indicated that whenever this symptom was seen, the problem was in the capture device. I rebooted the HDHomeRun; now shows are recorded.

After the next sleep-wake cycle, the next show was missed. Restarted mythbackend; now it records the program and two following. This pattern repeated over several days of testing, including both suspend to disc and to RAM. That's where it stands now.

The problem is not fixed, but a workaround is to stop and restart the backend when the machine sleeps. This has been effective in getting our programs recorded.

Rainbow Scenery