Using the USB IR Toy with LIRC

Other languages

So I got myself a programmable remote control in the shape of Eleven's sonic screwdriver (sorry, horrible in-accessible website). Of course I want to control my PC with it!

To do that, I needed a IR receiver and LIRC. Since I sometimes like being overly generic, I bought Dangerous Prototypes USB Infrared Toy, which allows me to send & receive any kind of IR pulse stream.

Getting the three pieces (remote, toy, LIRC) to play together was more effort than I'd really liked, so here's what I did, to help everybody else.

Flash a newer firmware

Your IR Toy is probably running an old version of the firmware. If you're running Windows, the instructions provided may work; otherwise, you have to dig deeper. The source code for the fw_update program that you can get from those pages (or from the Subversion repository) does not even compile (it "forgets" to include half the header files it needs), and when you get it to compile it segfaults. User "JessH" of the Dangerous Prototypes forums posted a working version (here's the patch if you want to see it, it should apply to the SVN version).


Yes, I know I'm pointing at the updater source for the 18F24J50, but the chip on the actual IR Toy says "18F2550". What can I say, it works!

Having compiled it, I was able to update the firmware to version 22:

$ echo '$' > /dev/ttyACM0
$ ./fw_update  -e -w -v -m all -vid 0x04D8 -pid 0xFD0B \
    -ix ~/src/dangerous-prototypes-open-hardware/USB_IR_Toy/package/firmware/USBIRToy.v22.hex

Unplug, re-plug, and we're set.

Patching LIRC


lircd 0.10 has native support for the USB IR Toy, using the irtoy driver

LIRC can use the IR Toy in irman compatibility mode, but I needed full send capability, to program the sonic screwdriver. I found a patch to add full support, thanks to Peter Kooiman. If you're running Gentoo, you can add my overlay and install my patched LIRC.

Configuring LIRC

This may well be written down somewhere, but I had problems finding a useful guide, so I'll just show what I did:

  1. get a full Philips RC-5 code list from the LIRC remotes repository
  2. assign, arbitrarily, the first 39 codes to the 13 gestures on 3 memory banks of the screwdriver:
    begin remote
     name  sonic
     # snip
     begin codes
       b1_tap_top    0x1000
       b1_tap_left   0x1001
     #etc etc

Programming the remote

I wrote a simple Perl program to send the IR codes. Run it with lircd running and irsend in your path. When it say Ready to send $something, press "enter" to send it, a to go back to the previous code (useful if the screwdriver didn't get it), n to go the next code without sending anything.

I put the screwdriver in programming mode, performed all 39 gestures one after the other, and programmed all of them. LIRC now uses sensible names for the 39 gestures.

Using it

Finally, I re-compiled vlc with LIRC support, and wrote a ~/.lircrc for vlc. With that, I can control vlc with my sonic screwdriver!

DatesCreated: 2012-10-08 10:49:07 Last modification: 2023-02-10 12:45:24