An alternative to LIRC for MythTV remotes

What I don’t understand is why nobody else has come up with this and posted it.
MythTV has been both a bane and a joy over the years, the main bane being getting the remote to work properly. The most annoying and recurring symptom is that most of the keys work, but for some reason, the most important, the “OK” key never does.
The latest kernel now has ir keymaps built in, unfortunately this means that my carefully crafted LIRC configuration for my Hauppuage remote no longer works, and the default keymap settings are as useless as ever, Basically, the 1-9 keys, volume controls, up, down, left and right work, but nothing else.
There must be some well hidden documentation about this somewhere, but after much use of Google and reading webpages, I came to the conclusion that to get the best results without using LIRC as a “bridge” I would need to configure my remote as a keyboard.

To do this, I basically ignored all of the internet posts and guides, apart from the ones that gave me the clues to where the keymap files were kept.
First I installed the ir-keytable package from the repositories.
This also installs a selection of ir keymaps in /lib/udev/rc_keymaps

Using the ir-keytable, command,  you can find out which drivers are in use and which keymaps they use.

on my system, it returns:

Found /sys/class/rc/rc1/ (/dev/input/event7) with:
Driver (null), table rc-dib0700-rc5
Supported protocols: NEC RC-5 RC-6
Enabled protocols: RC-5

I started by looking at the relevant keymap (dib0700_rc5) in /lib/udev/rc_keymaps, and tested the remote to see what buttons actually worked.
Then I ran ir_keytable -t > ~/devtest.txt, pressed every key on the remote in sequence from left to right descending in rows. This gave me a text file with the scancodes and their key attributes.
I then saved a copy of the dib0700_rc5 keymap, and edited it.

The first entry that I tried changing was KEY_OK.

I changed this to KEY_ENTER, rebooted, and lo! The OK key worked! I could now select items in the menus!
So basically, I edited the dib0700_rc5 keymap so that every key corresponds with a key on the keyboard, then going through the key setup in MythTV’s frontend creating links where necessary.

Unfortunately, there are a lot of keys already mapped to functions in MythTV, so this last bit was a little hit and miss, as some symbols or combinations such as CTRL+P don’t seem to work, but finally I can use every key on my Hauppuage remote. I have an MCE remote as well, but I haven’t bothered to do that one yet.
My Keymap is here

Yes I know that using devinput with LIRC as a bridge is more elegant for applications that support LIRC, but I only use a remote with MythTV, and the LIRC solution seems just too convoluted and unreliable to be worthwhile, too many links in the chain.

Note: you need to cold boot, i.e.shut down the PC and then restart it, for the new keymap to be read. I found that the remote would not work after a warm reboot, not sure why.

Advertisements

20 thoughts on “An alternative to LIRC for MythTV remotes

  1. This is what I get:
    ir-keytable
    /sys/class/rc/: No such file or directory

    I tried
    ir-keytable -t -d /dev/input/event6
    Testing events. Please, press CTRL-C to abort.
    Nothing happens when I press keys.
    I tried
    ir-keytable –read
    /sys/class/rc/: No such file or directory

    Any ideas would be appreciated.

    1. Which distro? ( I am running Mythbuntu 11.10)
      What remote are you using?
      It looks like it is not being recognised.
      There could be several reasons for that, from the kernel not having LIRC compiled in to the remote not being detected.

  2. I am using 11.1 and Snapstream Firefly Remote.
    ir-keytable –version
    IR keytable control version 0.8.5
    I was using the remote up until I replaced my backend computer and decided to update to 11.1. It is a RF remote that uses a USB receiver. The receiver is detected when I lsusb.Is there a way to determine if LIRC is compiled?

    1. Sorry to take so long replying.
      LIRC is in kernel 3+ by default, I think.
      It works fine for me in Mythbuntu 11.10, but I use the Hauppuage remote,. I also have an MCE remote which works.
      not much use to you, I know, sorry.

  3. Apparently, you need to make sure that the following kernel modules are installed.
    lirc_dev
    lirc_atiusb

    You can check this with

    lsmod | grep lirc

    Not having your set up means that I can’t really test it further.

  4. So I realized earlier today I had to go to Mythbuntu 11.04 in order to get .25. So I guess I have to go through this remote stuff too? I have an mceusb remote. Some of the buttons were programmed for things like Alt+P, so if I’m reading you correctly, that’s not possible now?

    1. Actually, I was wrong about that, you just need the right syntax.
      I think I have a list somewhere, I meant to post it a while back and forgot.
      If I can find it I’ll post it.

      EDIT:
      Actually, IIRC, it was that the modifier need to be uppercase.
      Ctrl+Esc doesn’t work
      CTRL+Esc does

      Example List here:
      http://xbmc.exstatic.org/ir_keys.txt

      1. Thanks. So, to be clear on the steps…when I move to 11.04, do I need to uninstall lirc and install ir-keytable instead and then follow your steps?

      2. I need more coffee… I upgraded to 11.04 last night and when MythTV .24-fixes came back up, my remote was working just fine. All the buttons still did what they were expected to. Did I read something wrong or do you think my lirc was programmed differently all along? Colour me confused…

      3. I only hit problems with LIRC when I got to 11.10, I think.
        It might depend on the Kernel version.
        10.10 to 11.10 was the first time I had any upgrading issues, ended up having to do a fresh install.
        Probably serves me right for skipping a version.

  5. After much trawling and reddened eyes I managaed to discover taht you can do an instant reload of your new keytable with:

    `sudo ir-keytable -vc -w /lib/udev/rc_keymaps/[your_New_Keytable]`

    This should save people a bit more pain.

  6. A minority of IR remotes actually pretend to be a USB HID keyboard or keyboard + mouse. The VRC-1100 (prod/vend 05a4:9881) is a (really affordable!) example. In that case, /sys/class/rc won’t exist, or will be empty because the IR core doesn’t think you have any IR remotes plugged in. Thus, you will search in vain for help and no one will understand why none of this advice about IR keytables works for you.

  7. I just did this on Ubuntu 15.04 and I will NEVER go back. With LIRC we were getting 2-3 second delay on each keypress. Now we can scroll through MythTV screens faster than we can read. Amazing.

  8. I know this is an old thread but still this is more use than the Mythbuntu Wiki on how to set up Hauppauge remote. I run Mytbuntu 0.28 & Remote was clunky & horrible to use. I took the plunge and removed/purged LIRC then followed your guide. All worked great with this method apart from ForwardFast and Rewind which produced a “no entry” sign on the screen when using your dib0700-rc5. After lots of googling I discovered that on my Hauppauge Nova T Remote, FF key 0x1e34 is KEY_DOT & Rewind is 0x1e32 KEY_COMMA. Which makes no sense but does the job …..
    Also, varying the Delay/Repeat for volume & arrows made no difference, but the Keyboard Settings Manager in Mythbuntu does work. Note that I couldn’t find any combination of settings that make both typing and Remote Control work optimally so compromise is necessary.
    Oh & you’ve occasionally used _ instead of – in a few commands (eg. Then I ran ir_keytable..)

    Thanks again – you saved me lots of time.

  9. Glad it helped.
    I no longer use MythTV as a frontend (since about 2 years ago), I use Kodi with a MythTVbackend, and I use a TBS 6280 dual HDTV tuner/

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