Using LIRC to control a TV

Time for a longer entry in response to a four-month-long posting drought :) I’ve been struggling for a long time to get a Logitech Harmony 515 remote to do discrete input switching on a Sharp LC-46LE600E TV. “Discrete input switching” means I wanted to switch the TV to a specific input using a single button press, instead of cycling through all the inputs (which is the only solution using the remote bundled with the TV).

Those of you who don’t care about the introduction to this story, just skip to the next paragraph. The rest of you – read on :) At first, I was hoping that the commands from Logitech database will simply do the trick. Well, they didn’t. So I opened a support case with Logitech. For the first month I’ve been corresponding with a Pole, but frankly, it was a complete waste of time. The instructions he sent me were utterly cryptic and laconic. After that, I got in touch with a more competent person who spoke English and usually responded me within 24 hours. I tested several different command sets, but none of them worked. Eventually, the Logitech person told me to contact Sharp directly. So I sent an e-mail to Sharp Poland, asking what IR commands do I need to send to the TV to use discrete input switching. After almost three weeks of waiting, I received a response – a three-page long document which had nothing to do with what I was asking about. Great. So I sent an inquiry to Sharp Japan, via their web page. No response for another month, so I went all the way and sent a formal inquiry to Sharp headquarters in Japan, on paper. Meanwhile, I learned that it is possible to switch the TV to a specific input using a serial cable (RS-232). I mentioned that in my letter. Soon, I received a response. Unfortunately, Sharp only told me it’s not possible to switch the TV mentioned to a specific input using a single IR command. The only way of switching inputs is cycling through all of them. Too bad, I thought, and decided to just forget about the whole matter as I was already fed up with dealing with it. That was in October 2010.

Not two weeks ago, I accidentally (looking through the stuff cluttering up my closet) came across two things: a serial (null modem) cable and an old PC remote called PC MAK, along with a USB IR receiver. I had good memories from using LIRC with that remote, so I came up with a simple idea: to use my home server (which runs 24/7) to receive IR commands from PC MAK and then send corresponding commands to the TV via serial cable in order to switch it to a specific input. What I did was:

  1. Connect the TV to the server via serial cable, check if it’s possible to switch the TV to a specific input using a single command.
  2. Install LIRC, check if I can make it understand the IR commands sent by PC MAK.
  3. Associate IR commands sent by PC MAK with commands sent via serial cable.
  4. Teach the Harmony remote the IR commands sent by PC MAK.
  5. Configure the Harmony remote to use a different input switching method.

For starters, I used Minicom to set the serial port to 9600bps, 8-N-1 and tested the commands found in the TV’s user’s manual. This worked out-of-the-box, without any problems. The LIRC part was tricky – I had to recompile the kernel with CONFIG_USB_SERIAL_FTDI_SIO=y – apparently, the USB IR receiver bundled with PC MAK is simply a USB-to-serial converter. After a restart, it appeared in my system as /dev/ttyUSB0, so that’s what I had to pass to lircd via command line (-d /dev/ttyUSB0). After that, all I had to do was to create a configuration file for irexec and make sure it runs on system startup, along with lircd. The configuration file for irexec looked like this:

...
begin
   button = 5
   prog = irexec
   config = echo -e -n "IAVD5   \r\n" > /dev/ttyS0
end
...

The sample entry above means after detecting that key “5” was pressed on the remote, send “IAVD5   \r\n” through the serial port. Other entries were analogic.

Mission accomplished! :D

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s