Tira2 and Lirc

I converted my old workstation into a media pc. What is a media pc? Also known as a home-theater pc (HTPC) it's basically a computer hooked up to a TV. This lets me play my MP3s over my stereo system as well as watch digital videos on my tv. I can also theoretically play games on my TV but I don't do that (yet). There was nothing to this setup as my video card automatically supported the TV-out. All that remained was to add remote-control support, so that I could skip to the next MP3 using my trusty all-in-one remote.

My remote is the Pioneer AXD7381, which is a learning remote that came with my VSX-1015TX system. In order for this remote to send signals to the computer, however, I needed an infra-red receiver. Since I don't believe in classic serial ports, I opted to buy a USB IR device called the Tira, from a Toronto-based company. Lirc (the Linux infrared program) claimed to support it and so I figured I'd spring for the $50.

I'd hoped it would be trivial to get this thing going, but I severely underestimated the Lirc documentation. I don't know if I've ever tried to read a less helpful doc. The documentation assumed that you already knew how to set up Lirc, that you were using a serial device (is anyone still using serial devices?), and that you were installing lirc from source. None of those things were true for me, but I managed to get things working after much weeping and gnashing of teeth.

In the end, all I needed to do to get the Tira working was tell Lirc to use the Tira driver. On Fedora 8 you edit the /etc/sysconfig/lirc file and specify the -H Tira command line parameter:

LIRCD_OPTIONS="-H tira"

Easy enough, but the lirc documentation doesn't mention Tira other than to say it supports it. Specifically it doesn't tell you that Lirc won't need any of its usual device nodes, which means you don't need to waste time writing udev rules like I did. I wasted a lot of time because for some reason the Tira would sometimes be recognized as USB device 1, and Lirc refuses to work unless it's device 0 (/dev/ttyUSB1 vs /dev/ttyUSB0 for those of you who understand what I'm talking about). Once I unplugged/re-plugged the Tira a few times things magically started working.

Then I ensured that Lirc started with

/sbin/chkconfig lirc on
/sbin/service lirc restart


Anyway, the executive summary of Tira is thus:

1. It's a USB device that shows up in the kernel as a serial device.
2. Lirc supports usb serial devices but the documentation doesn't seem to want to admit it.
3. Once Lirc starts talking to your tira you need to set up some kind of action to take place. I did this using KDE's IRKicker, a niceadequate gui tool which lets you do things when you press a button on the remote. Unfortunately the tool is more complex than it should be. I've been thinking about this for a few days and I think making the tool easier to use would be a lot of work, but it's still pretty important work. But it's an acceptable compromise, for now.

Now I have another problem, which is that a universal remote control and a universal device (such as Lirc) don't really get along; the remote doesn't know what to say and Lirc doesn't know what to do. Since both devices speak any language, they need to be made to agree as to which language they should be speaking to each other. My remote was originally programmed to control (among other things) a CD Changer, which I no longer use, so I told Lirc to answer to the CD Changer's remote. But that makes it annoying to control things because, among other things, the CD remote doesn't have separate play and pause buttons. At least now it's just a matter of making the right thing happen when you press a button.

What would make this whole process a lot easier is if there were 1. A better installer/auto-detection for IR devices; 2. A standard way of mapping remote buttons, so that if the remote has a "play" button it "plays" the current application, such as a movie player or music player; Also it would be really nice if the Lirc mouse/keyboard control mode was better integrated with standard lirc and programs like IRKicker. But now I can play my mp3s and skip to the next song without getting up and pressing a key. And my music sounds GOOD on my stereo... I never knew how bad my computer speakers were.

2 comments:

Anonymous said...

Sounds like you had fun. As for what still uses serial? Well try configuring a CISCO switch or firewall. There are quite a bit of things that still uses the good old COM2. Hell I still see dip switches/jumpers on RAID controllers/SCSI Hard Drives. But meh I am used to the idiosyncrasies of servers. By the way could you not use the Logitech universal remote? Or you just needed to re-use your old remote?

HJ

Mr. Shiny and New said...

As far as I'm concerned network gear shouldn't require serial ports either; heck most new computers don't even come with those ports anymore. Thankfully I don't have to deal with that gear anymore. As for my choice of universal remotes, I have a couple of them and the remote that came with my stereo receiver is fairly good. The only problem is that the universal remote, by definition, doesn't speak any particular remote-control dialect, so you have to just pick a random one. Anyway the system works now with the limitation that most computer programs are very poorly suited for remote controls and nearly impossible to automate in a coherent manner.