Programming Remotes as Keyboards

From MythTV Official Wiki
Revision as of 17:30, 25 May 2006 by Edheller (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Many modern universal remote controls include a programmable feature known as JP1. This is very different than the learning functions also found on many remotes. Their differences will be discussed here as well as a discussion on how to program an IR remote to work as an IR keyboard and the pros and cons of this decision.

Learning remotes

A learning remote is one that has the ability to learn, via IR, commands from another remote. This is useful for universal remotes as many manufacturer remotes have uncommon commands like an eject button for a DVD player that universal remotes often lack.

The learning memory on a remote is often small but can provide enough space for a dozen commands.

Programmable remotes

A remote that supports programming via the JP1 connector can be hard coded to act like any number of IR devices. This programming consumes none of the learning memory and is often near unlimited in its ability to learn commands. This is critical for a remote programmed to act as a keyboard because the large number of keys often quickly consumes the limited learning memory.

Hardware

Choosing a remote

The best site for JP1 and remote information is http://www.hifi-remote.com. They used to have a page that provided a nice list of JP1 remotes. It is down at the time of this writing but archive.org has a cached copy of it. Look in JP1 connector column to see if a particular remote has the connector.

Note: OFA stands for One For All and is a very common brand of remote with JP1 connectors that can be bought at many stores including Best Buy, Amazon, and Buy.com to name a few.

I personally have a the URC-8910 which is both a learning and programmable remote and controls all my home theater AV equipment.

Keyboard

The keyboard is the harder of the two devices to acquire. Finding an IR keyboard that has a pre-built command file is the tricky part.

The JP1 site has a list of command files for various IR keyboards.

The keyboard I have is the SK-7551 ($25) and it also includes a joystick style mouse and two buttons in a very compact form factor.
It uses the Airboard Make and Break keyfile. Unfortunately this keyboard is no longer being manufactured.
Other suitable IR keyboards are the Solidtek ACK-571 ($28) and the ACK-581 ($29) which both include a joystick style mouse and two buttons in a very compact form factor. The ACK-581 adds 16 multimedia keys across the top of the keyboard which can be configured with LinEAK.

The JP1 cable

To program you remote using your PC, you will need a JP1 cable. There are a few places selling JP1 pre-built cables in both USB and parallel formats.

I purchased a simple parallel cable for use with my remote and it works great.

Software

To upload and download configurations to your remote, you need an IR programming software. You also need a program that will create the keymapping files for use with the programming software.

Both of these can be found in the file section of the JP1 forums site. Download each program and install them.

IR programming

This guide recommends using the IR.exe 6.15 software. This works well with the aforementioned parallel cable and provides all the upload and download features necessary.

Keymapping

This guide recommends using Remote Master software for programming your device. Using Java, it provides a visual keymapping interface making it easy to map keys to functions.

The Remote Master program configures one remote device as a time, not one remote control. The aforementioned remote control has 8 remote devices. If you are using Remote Master to program more than one device, such as MythTV and an A/V receiver, you will need two Remote Master configurations which you will import into the IR.EXE program.

Running IR.EXE and Remote Master under Linux

Unfortunately IR.EXE is a Windows program and many people may want to program their remote from the same Linux computer that runs MythTV. This is possible using WINE as described in this guide.

Programming the remote

Since the remote used here is a universal remote, you should program your functions for your other devices using the standard method. If you have special buttons you want to learn, use the learning features. If you need to get advanced, download the device codes for your devices and use them to program any function into your remote.

Programming the keys

Remotemaster.png
  • Launch the Remote Master program. You start by opening the .txt file you downloaded containing the keyboard codes using the File -> Open command and change the file filter to show all files.
  • Next, choose your Remote on the main screen using the Remote dropdown. This will allow exact configuration of your keys using the visual editor.
  • Also choose the function key on your remote you want this device to be programmed as. Depending on your existing AV equipment, this could be CBL, SAT, or any other button you are currently not using.
  • Navigate over to the Layout tab and you should see your remote pictured with each button that can be programmed circled in yellow. Keys already defined will have their cicle filled in.
  • Program each button with a keyboard button by first selecting the remote button on the left and then double clicking the keyboard button on the right. How you configure your buttons is up to you. It is important that you learn the MythTV keyboard commands and how they operate to know which keys are appropriate for which buttons.
  • When you have finished, save your configuration as a .rmdu file.

Note: This .rmdu file contains the configuration for one device, not your entire remote. If you are programming more than one device, you will need more than one .rmdu file.

Connecting the remote

The JP1 connector for most remotes is found inside the batter cover. Open the back, find the 6 pin connector, and connect the cable to it.

Preparing the IR software

Ir-interface.png

When you first launch the IR.EXE program, you must configure the appropriate interface for the JP1 cable that you purchased.

Use the Check Interface command to confirm that your cable is connected to your remote and communication is possible.

Press the Download from Remote button to download your existing remote configuration into the current session. If you do not do this each time before programming, you could lose configuration

Loading the IR configuration

With your .rmdu file ready, you need to load this configuration into the IR.EXE program for uploading into your remote.

Applying the protocol upgrade (one time only)

This is important as it allows your remote to emulate the IR keyboard

  • In the Remote Master software, select the Output tab.
  • Press the Copy button on the Protocol Upgrade section
  • Switch to the IR.EXE program and select the Protocols tab.
  • Click Add and paste the Protocol Upgrade into the program
  • Click OK to save

Importing the key configuration

  • In the Remote Master software, select the Output tab.
  • Press the Copy button on the Device Upgrade Code
  • Switch to the IR.EXE program and select the Devices tab.
  • Click Add and paste the Device Upgrade Code into the program

You should now see the device button and setup code you picked in the Remote Master program. If these need to be changed or are wrong, change them here before pressing OK to add the device.

Save the configuration

Save the configuration both to a file and also by uploading it to your remote. Everything should be set up now for your remote to work using the IR receiver from the keyboard plugged into the PS/2 ports on your PC.

Miscellaneous

Configuring the power button

One feature that I used when I used LIRC was configuring my power button to restart mythfrontend using a script. Without the use of irexec to launch programs, I had to come up with another method of providing this functionality.

First, I had to find a key that I could bind to the remote. I didn't want to use a key that might otherwise normally be used so I chose the special Power button on the keyboard that is part of the multimedia keys. The problem with this decision is that these keys are not part of the Remote Master key definitions. After much trial and error I managed to get the remote learning feature to learn the Power button from the keyboard.

The button configuration is Frequency 38277 and the commands sent are:

+2480 -854 +836 -838 +2480 -854 +2508 -1684 +836 -130234 +2480 -854 +836 -838 +1672 -1670 +2508
-1684 +836 -1676 +836 -25984 +2480 -854 +836 -838 +2480 -854 +2508 -1684 +836 -130234 

I believe you can paste this into the Learned signals of the IR.EXE program and assign it to the POWER button of your device.

Once configured, I needed also to get my system to respond to this key. To do this, I had to use xmodmap to configure this key. My .Xmodmap file has this extra line in it

keycode 222 = XF86PowerDown

Once configured, XWindows recognized the key. Now I configured my window manager, FluxBox to launch a script when this key was pressed. I needed to do it in the Window Manager because no other running program would intercept global key presses. I only use this script when mythfrontend rarely has a problem so it had to work even when the frontend was unresponsive.

I added this line to my keys file in ~/.fluxbox

None XF86PowerDown :ExecCommand /home/mythtv/frontend-restart.sh

and my script is

MYTHEXISTS=`/bin/ps -e | grep mythfrontend | grep -v grep | awk '{print $1}'`;

if [ "$MYTHEXISTS" != "" ]; then
        for MYTHPROCESS in `/bin/ps -e | grep mythfrontend | grep -v grep | awk '{print $1}'`
        do
                echo $MYTHPROCESS;
                kill -9 $MYTHPROCESS;
        done
fi 

cp -f mythfrontend.log mythfrontend.log.old
/usr/bin/mythfrontend > ~/mythfrontend.log 2> ~/mythfrontend.log &

Now when I press either the Power button on the keyboard or remote, my frontend process restarts

Pros and Cons

The advantage to configuring your system with this is that you do not require LIRC and all the configuration that is needed to set it up. You are simply emulating a keyboard with your remote and any button you set will be sent. I have found also that they keyboard responsiveness is much faster than LIRC.

The disadvantage to this is that you lose some of the flexibility that LIRC provides. LIRC can be configured differently for each program (MythTV, mplayer, xine, etc) and the remote-as-keyboard solution cannot, each button only sends one keyboard button. This requires you to use the features of the programs to remap keys sometimes so that they match what you have configured. Alternatively, multiple remote devices (CBL, SAT, etc) could be used to provide alternative keybindings.

Conclusion

The IR.EXE program allows for complete control over the functions of your remote. I will not go into all those features here but you may find them useful. I find this configuration to be the best for me as it alleviated me finding a good, reliable, and stable IR receiver and instead just work with the keyboard I already had.