Archive for November, 2006

No switching between analog and digital audio output on the nForce3

Saturday, November 25th, 2006

The audio output on my MythTV system is connected to a reasonably nice stereo, and it feeds the stereo both analog and digital audio, depending on whether you tell it to use ALSA:mixed-analog or ALSA:mixed digital as the playback audio device. I frequently switch between the two. HD broadcasts use digital sound, as do DVDs, but due to a quirk in the wiring, I need to use analog sound if I want to route the sound to my television and use TV volume controls.

I’m not the first person to have this problem, so I was hopeful when I found an article about switching the playback source with a remote control button in the MythTV wiki. In that article, there’s a script that uses the amixer command to switch the “IEC958 Playback Source”


# Get current setting of PCM/analog switch
AUDIO=`amixer get ‘IEC958 Playback Source’ | grep ‘Item0:’ | cut -d\’ -f 2`

if [ “${AUDIO}” == “PCM” ]; then
# Route analog signal to S/PDIF
amixer set ‘IEC958 Playback Source’,0 ‘Analog’
# Could also be: sudo /sbin/alsactl -f /home/mythtv/asound.analog2spdif restore 0
# Route PCM signal to S/PDIF
amixer set ‘IEC958 Playback Source’,0 ‘PCM’
# Could also be: sudo /sbin/alsactl -f /home/mythtv/asound.pcm2spdif restore 0

Excited, I opened a command line to see if I had support for selecting the audio source, but found that my nForce3 doesn’t support it:

myth ~ # amixer | grep IEC958
Simple mixer control ‘IEC958’,0
Simple mixer control ‘IEC958 Playback AC97-SPSA’,0

Nuts! I’ve filed this mentally under the reasons why I want to do a hardware re-spin on my Myth sytem. Although all of the parts were reasonable selections at the time, I would like to replace the noisy 60 mm fans in the Silverstone case (and maybe get a few more drive bays while I’m at it), and get a bit more processing power for transcoding.

Upgrading to MythTV 0.20

Saturday, November 25th, 2006

I have now finally upgraded to MythTV 0.20. The big reason for my delay is that the upgrade presented itself as a bit of a big project, largely because the Gentoo package system told me that an X Window System upgrade was required. I have been happily running xorg 6.8 for a year and a half, but Portage told me that I’d need to upgrade to xorg 7.1. At first glance, the report of what needs to be upgraded is massive, since the X package is now modular instead of monolithic. I was quite busy, so I didn’t want to upgrade such a critical system component without the time to fix it if it went wrong. As it turns out, my fears were misplaced, and the upgrade went off without a hitch in about an hour.

Unlike my previous upgrade to 0.19, the upgrade to 0.20 is an unqualified success. The highlights are:

  • KQED audio is back! There is something strange about the digital broadcast from KQED (the biggest PBS station in the San Francisco area). I’ve had recurring problems with getting the audio to work right in Myth. First, it was the lone holdout in Transport Stream/Program Stream conversions in 0.18. After I upgraded to 0.19, I was missing audio on KQED-HD (channel 9.1) but not on any of their secondary standard-definition channels (9.2, 9.3, 9.4, and 9.5). In 0.20, audio is available on all of the channels without any issues. In previous versions, I would have to periodically scan through the list of recordings and delete recordings that came out on the HD channel so they would be picked up on the secondary channels so that I would have sound.
  • XvMC seems to work flawlessly. I’ve also had recurring problems with XvMC on my AMD64. I don’t need XvMC to play back HD, though it seems silly to me to spin up the chip to its fastest speed when it’s not necessary. Much of the random behavior I saw previously seems to have been fixed. I don’t know if this is MythTV, the nVidia drivers, or the X server, but I’m quite pleased.
  • There are now several options for the On-Screen Display (OSD). I’m partial to the “Gray-OSD” which has a sort of transparent effect.
  • MythDVD’s internal player is now the default that I’m using. In 0.19, I was still using Xine because the internal player didn’t support DVD menus. The internal player now supports DVD menus, and that was enough to push me over the edge. The internal player uses the same keymap, which makes programming the remote control easier. Plus, the keystrokes are the same as for MythTV, which means that it’s easier for me as a user. Most importantly, the internal player has a rewind function, but Xine does not. (Xine does have a rewind function in the GUI, but it doesn’t expose it to the keyboard as far as I can tell.)
  • I haven’t used it yet, but the new MythArchive plugin should make it easier to burn DVDs of recorded shows, which will be easier for me than dumping everything to videotape.

My only complaint right now is that I can’t get the icon display in the on-screen display to work, but that should be easy to fix with a little bit of digging.

Zap2it program guide data for MythTV goes AWOL for San Francisco broadcast TV

Thursday, November 23rd, 2006

This week, my MythTV system stopped recording on most of the over-the-air digital channels. I had noticed, for example, that a program was supposed to record on Sunday, but did not, even though it had appeared in the to-do list on Thursday. This seemed quite strange, until I looked at the program guide data and found that only two of the channels were receiving program guide data:

No guide data!

I tried to refresh the database contents using mythfilldatabase, but the program completed quickly and didn’t put any data in. A check of the MythTV mailing list turned up the suggestion to add the XMLTV channel id numbers, but I added those numbers to my system when I first built in in 2005. To try and figure out if the problem was my system or the data feed, I ran mythfilldatabase in verbose mode, and found that it wasn’t receiving any data for most of the channels. A check from Zap2it Labs showed that the number of available channels was very small because most of the digital channels didn’t exist. Of the channels I received, only KTSF-DT and KCSM-DT (2 subchannels) were feeding me guide data.

Missing channels at the data feed

The eventual work-around was to delete my over-the-air channel lineup and re-create it from scratch. As part of that process, I received a much fuller list of channels to pick from for some reason:

Zap2it Labs rebuild, now with all channels back

With all the right channels selected, I could run mythfilldatabase to get all the data for the next two weeks, minus the current day. (To get the current day, you need to run mythfilldatabase –refresh-today.)

It appears that what happened is that at some point last week, Zap2it rebuilt their channel lineup. Every day, mythfilldatabase dutifully went out to get new data, and received an indication from Zap2it that the channel had no programs. Therefore, all the scheduled recordings would show up until the day before they would normally be expected, at which point, they guide data would get clobbered and they would drop off. Thankfully, everything seems to be running fine now.

Jeers! to TiVo for taking three years to figure out WPA

Tuesday, November 21st, 2006

This afternoon, I received the latest TiVo newsletter. My TiVo and I have been drifting apart for years, in large part because TiVo seems to be falling behind. Today’s newsletter bragged about how the current TiVo software update now has WPA:

MORE SECURITY: Choose either WEP or WPA security for your wireless networks (WPA requires the TiVo Wireless Network Adapter) [Networking nerds cheer.]

Actually, we don’t cheer you. We wonder what took you so long.

A serious network engineer would never use WEP, because it is unsafe at any key length, and we’ve known that for more than six years. WPA was announced on October 31, 2002. (I remember that date because I was speaking on wireless security the day after the announcement, and the audience asked about it.) WPA-certified products have been available since 2003.

In 2003, my home wireless LAN was running WPA. When I discovered that my TiVo could only support WEP, I grudgingly pulled an Ethernet cable into the living room because I didn’t feel the need to downgrade my network security to WEP.

In September 2004, I was invited to be part of a security panel at the Wi-Fi Security Seminar in Washington, D.C. Before the panel took the stage, I vividly remember talking with David Cohen of Broadcom, who was leading the marketing efforts for the Wi-Fi Alliance on WPA2. In our discussion, David pointed out that many consumer electronics devices were supporting WPA, and that there was no reason why anybody needed to use WEP. When I pointed out to him that TiVos only supported WEP and that they had no apparent plan to support WPA, he was shocked. I never imagined that the situation would remain unchanged for the next two years.

To add insult to injury, the upgrade doesn’t help the TiVo customers who are already using 802.11. TiVo WPA support doesn’t work with just any wireless adapter like the one that most users already have stuck into the USB port. Oh no, it requires the use of the TiVo-branded wireless adapter! The TiVo adapter lists for $60, which is a pretty high price premium over a “standard” USB-to-802.11 network adapter. With careful shopping, you can get a regular Linksys/D-Link/Netgear adapter for $20 or less.

Automatically refreshing election results in San Francisco

Tuesday, November 7th, 2006

I’m at a post-campaign party right now, and we’re all huddled around the computer watching the San Francisco election results. At first, the common injunction to whoever was sitting at the computer was to “hit refresh” to see if new results were posted. I quickly tired of hitting refresh, so I cooked up a small CGI script to fetch the results, and embedded them in a page to automatically update.

The CGI is pretty simple. The nice thing about the San Francisco results is that they’re plain text embedded in a pair of <pre> tags, so all the CGI has to do is grab the text between the tags:
#!/usr/bin/perl -w

use CGI;
use LWP::Simple;
use Time::Piece;

# Get results from between


my $sf_results_html = get ‘’;

my @htmlbeforepre = split ( ‘

', $sf_results_html );
my @htmlafterpre = split ( '

‘, $htmlbeforepre[1] );
my $sf_results_txt = $htmlafterpre[0];

# write up page, with date
my $page = new CGI;
print $page->header;
print $page->start_html(‘SF Election results’);

my $t = localtime;
print “Date retrieved by CGI = $t\n”;

print “\n

print $sf_results_txt;
print "\n


print $page->end_html;

Then, to automatically refresh it, I embedded in an server-side include that refreshed every three seconds. (Though, on further reflection, perhaps I should have set the timeout to be longer.)

Auto Refreshing election results

Page generated on

Robo-caller, meet Asterisk. And then go to a special circle of hell.

Monday, November 6th, 2006

Clearly, for people who use automatic robot callers to send you recorded messages deserve to go to hell. If somebody with the right connections is reading, I’d like to propose construction of an extra-special circle of hell for people who use mis-programmed auto-dialers. The Barrington Courier-Review (Illinois) is reporting that some political telemarketing machines will call you right back if you don’t listen to the whole message.

The campaign caught making repeated phone calls has blamed the telemarketing contractor, saying that it was obviously a mis-configured computer. Well, those campaigns can retain their mis-configured computer, because my correctly configured Asterisk machine will handle the calls appropriately. I’ll make my voting decision in peace, by reviewing sources of information I trust. (Hint to campaign managers: this probably is not you.) Please, make as many calls as you want. My computer is happy to listen to you spew your message, and it will deliver it to me if it is appropriate. I have programmed my computer with an algorithm that is working quite well so far, namely, that all telemarketing calls should be discarded.

However, there’s clearly a reason why these calls get made. Somebody has to believe that they work, which means that they’re either effective or cheap. Thudfactor says that a robo-call is only five cents per call, though I’ve also heard figures between one and two cents per call. No wonder they’re so depressingly common. The Center for Information and Research on Civic Learning and Engagement (CIRCLE) says that

[t]he most effective way of getting a new voter is the in-person door knock by a peer; the least effective is an automated phone call. Canvassing costs $11 to $14 per new vote, followed closely by phone banks at $10 to $25 per new vote. Robocalls mobilize so few voters that they cost $275 per new vote. (These costs are figured per vote that would not be cast without the mobilizing effort.)

(The figures cited are a study of the youth vote, which may not necessarily be representative of the whole voting population.)

Keeping track of mobile phone minute usage

Monday, November 6th, 2006

One of the things that I can’t stand about being a mobile telephone subscriber is the worry about overage charges. A long time ago, I did go over my monthly allocation, and paid for it at 35 cents per minute. (Years ago, the company I was working for at the time refused to pay for the overage at first, even though it was incurred working a major customer problem, but they did come around eventually and cut me a check.)

Well, Winston Huang felt my frustration, and has released a Firefox plug-in that checks my T-Mobile minute balance. Now, every time I open a web browser, the minute usage is displayed in the bottom bar. Here’s what it looks like this morning:

T-Mobile Firefox plug-in screen shot

The only thing that needs to happen now is a monthly graph so you can display trends over time, for visual people like me. It would be nice if I could see how much data I’m using, too. Although my T-Mobile data plan is unlimited, there may come a time when they charge by the bit, in which case, I’ll want to track that, too.

(If you don’t subscribe to T-Mobile, Winston has a Verizon plug-in, and his site has links to a Cingular plug-in, too.)