distraction in action

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com

In a recent post I discussed the URC-300 universal remote, one of my favorite new toys. I yakked a bit about discrete codes and left off with a tantalizing tease about using discrete codes from the Remote Central database with LIRC. Just to refresh your memory, this would be nifty because it would allow me to learn the discrete codes into the URC-300 (or any other learning remote), which otherwise wouldn’t be able to use them.

I’m not going to cover setting up LIRC or choosing an IR transceiver, since those topics are covered in detail on the LIRC website. Let’s just say that there are many options available to you at pretty cheap prices, and if you’ve got any skill at all with a soldering iron you can build an IR transceiver for pocket change.

Discrete codes are almost always distributed in Philips Pronto format. It’s sort of the lingua franca of remote controls. What we really want is a nice little utility that reads a pronto code and spits out a LIRC config file. There’s lots of info out there on the pronto format and IR codes in general, but, sadly, no such utility exists, so we have to do things the hard way.

First, an overview of our strategy. When you push a button on a remote control it transmits a number to the device it controls. There are a variety of techniques manufacturers use for encoding numbers as IR pulses, but in the end it’s all about getting one number (or “code”) to that device. As you’ll see, it’s not too hard to get that code out of a pronto code, but it can be tricky to translate the encoding information to LIRC. What we’re going to do is let LIRC worry about all the encoding details by either using a pre-existing config file for the device or learning one from its remote. Once we have that config it’s trivial to insert the new discrete codes.

To start with, we need a LIRC config file for the device in question. I’m going to use the Roku Soundbridge as an example device here. If you’re lucky there’s a ready-made config file on the LIRC website for your device. If you’re really lucky it already has the discrete codes and you’re finished! For the Soundbridge I’m not so lucky1. Thankfully we have the original remote, so we can use LIRC to build a config file. We fire up irrecord and follow the instructions (no need to actually record all the remote’s buttons), and pretty soon we have something like this:

begin remote

  name  soundbridge
  bits           16
  pre_data_bits   16
  pre_data       0xF609
      begin codes
          power                    0x6897
          menu                     0xE817
      end codes
end remote

There’s no need to understand everything in the file, so I’ve snipped out everything but the interesting parts. What do we see here? It looks like the Soundbridge remote sends 32-bit codes (a 16-bit header and a 16-bit code). The code for toggling power is 0xF6096897 and the code for the menu button is 0xF609E817. All the codes start with the same prefix (0xF609) so it’s only written once.

Now all we need is are the discrete power codes (we’ll call them power_on and power_off). These are normally provided in one of two ways — as pronto codes or .ccf files. We can use either one, but for now let’s assume you have a .ccf file. In fact, Roku Labs provides a .ccf file for the Soundbridge on their website. We’re going to use Tonto, the open-source ccf editor, to examine the contents of the .ccf file. I’m not going to talk about installing Tonto, just suffice to say that it’s much the same as setting up any other Java program.

So now we do the following steps (here’s a screenshot you can follow if you get lost):

  1. Start Tonto
  2. Load Soundbridge.ccf
  3. Use the tree view on the left side to navigate to devices/soundbridge/extras
  4. Double-click “extras” to open a view of the extras panel. The “power on” and “power off” buttons here are the discrete controls we’re looking for!
  5. Double-click the “power on” button to examine its properties
  6. Double-click the “[IR] Power On” line to see the details of the IR signal
  7. Click the “Expert” button to see the “expert” details. :)

Bingo! In the expert details view there’s a HexValue field that reads f609c23d. Remember how our other codes started with F609? So all we need to do is add a line to the codes section of the LIRC config file:

      begin codes
          power                    0x6897
          menu                     0xE817
          power_on                 0xC23D
      end codes
end remote

Save this file in the appropriate place, point your IR transmitter at the Soundbridge (or whatever your device is), restart lircd, and try irsend SEND_ONCE soundbridge power_on. The power should turn on. Try it again and it should stay on. Yay! Now you can teach the code to your remote or use it with LIRC. Repeat with the rest of the codes you want to use and write macros that Just Work™.

One last detail. If you don’t have a full ccf file and just have the pronto code (a very long string of hex digits) for a command, you can still extract the code. In the first (non-expert) IR Signal dialog we saw in Tonto, the text field contains the pronto code for the button. If you paste in a different pronto code and then click “expert” you’ll see the hex code for that code. So just use any old ccf file you can find, any device, any button, and paste in the code you need. This is how I got the discrete power codes for my JVC TV.

[1] If you have a Soundbridge your luck should be much better now. I’ve sent in the Soundbridge config file to the LIRC developers so it should be in their database soon. :-)

  • Share/Bookmark


1. Doug replies:

Great article! I have the Roku m500 and I’m using the Sony RM-VL600 and would like to use power on power off codes discrete codes also. I don’t have any linux machines setup to use irrecord , do you know of a Windows application that works like irrecord?



2. n8 replies:

There’s a port of LIRC to windows called WinLIRC. There’s also a similar thing for Pocket PC portables if you have one of those. If you’re brave you could even boot a machine into Linux with an Ubuntu LiveCD, set up LIRC and use irrecord there. ;)


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Please type this word with the letters reversed: live

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com