ir-keytable or: How I Learned to Stop Worrying about the LIRC Kernel
This is for kernel's 2.6.35+ and LIRC 0.9.0 and above.

Foreword: I've put off upgrading from Lucid because of the cluster that was LIRC in Kernel (and have not been shy about it). After Natty... I'm not happy about Natty, I'm going back to what every thing else in my house runs. A good proper Debian system. I've finally bit the bullet and started to figure out how to deal with LIRC in the Kernel, because it's not going away. Turns out, its just a little bit of awesome (and a whole lot of work.)

First you're going to need ir-keytable. It's available in natty (not maverick) and Sid & Testing.
apt-get install ir-keytable. ir-keytable turns ... I'm not really sure what ir-keytable really does. But it turns remote presses into LIRC stuff.

This is the flow chart of fun. I'll try and work on this in order.
lirc kernel -> ir-keytable mapping -> LIRC devinput -> lircmap.xml -> remote.xml.

Do not install LIRC yet. Un-install it if you have it. Right now we're going to be futzing without it.

Running ir-keytable by itself will dump out what IR receiver it recognizes in addition to what protocols it supports. I have a real HP receiver & Remote (ID 045e:006d Microsoft Corp. eHome Remote Control Keyboard keys)
Found /sys/class/rc/rc0/ (/dev/input/event0) with:
    Driver mceusb, table rc-rc6-mce
    Supported protocols: NEC RC-5 RC-6 JVC SONY LIRC
    Enabled protocols: NEC RC-5 RC-6 JVC SONY LIRC
    Repeat delay = 500 ms, repeat period = 33 ms

RC5/6 are the IR protocols defined by Philips.
NEC aka "Japanese Format" are by NEC. This is the bread and butter protocol as most remotes use this. (At least in my house hold my Yamaha receiver and Samsung TV both use it.)
Sony. Sony ALWAYS does their own thing... I don't have anything in my house that uses this.
JVC. JVC has their own too.
First, You're going to be making a hex -> LIRC button name file for each of your remotes. I have 3. MCE Remote, Yamaha Receiver Remote & TV Remote.

The MCE Remote should already be mostly mapped, but if you try to standardize something as non-standard as remotes, you're bound to get a few wrong. Inside of /lib/udev/rc_keymaps/, there should be an rc6_mce. Copy that to /etc/rc_keymaps/, we're going to be editing that instead of creating a brand new file.
cp /lib/udev/rc_keymaps/rc6_mce /etc/rc_keymaps/

1) Open up my dump of valid LIRC keys: You can use your own, but these are "standard". These are the names we'll be working
2) I'm opening text files on my laptop for each remote then scping them over. You can edit directly in nano. You can export the /etc/rc_keymaps/. You can use butterflies if you like
3) Run "ir-keytable -c" to clear out the old table. Fire up "ir-keytable -t". If you'd like to think of this as the new "irw", you can. (If you're running LIRC, you didn't follow the directions and you have to at least stop it before running ir-keytable.)

"ir-keytable -t/--test" shows you what is being pressed. This is where the slight bit of awesome comes in. irrecord would NOT record some buttons for me, TV up down. This literally shows me something every time I press the remote. Even weird keys like +10. All of my TV commands, etc.

4) First we're going to go through our rc6 remote and 'correct' any keys that are funky. For example the "Start" key on my remote is KEY_PROG1, I want to change it to KEY_HOME.
nano /etc/rc_keymaps/rc6_mce

5) Repeat this for every remote you want to program. For my Yamaha remote "XBMC" is going to be the DVD button. When I press it on remote the receiver swaps to the correct HDMI and SPDIF in. So when I press the DVD button, it'll now control my XBMC.

Down, Up, Left, Right, Select, Keys 1-0.
ir-keytable -t
Testing events. Please, press CTRL-C to abort.
1304995824.617619: event MSC: scancode = 7cb3
1304995825.030592: event MSC: scancode = 7cb4
1304995825.380603: event MSC: scancode = 7cb5

I'm personally doing this in TextMate and then just copying it to ssh. The scan codes are in hex. So right now it looks like this:
0x7cb3 KEY_DOWN
0x7cb4 KEY_UP
0x7cb5 KEY_LEFT
0x7cb6 KEY_RIGHT
0x7cb8 KEY_OK

0x7c93 KEY_NUMERIC_0
0x7c94 KEY_NUMERIC_1

The first line of the file, best I can figure, MUST look like this:
==> rc6_mce <==
# table rc6_mce, type: RC6

==> samsung_stb <==
# table samsung, type: NEC

==> yamaha_dvd <==
# table yamaha, type: NEC

Again, it's not really documented. But if it didn't look like this, it threw a fit.

6) Edit /etc/rc_maps.cfg ... To what. I really don't know right now. I have no @#)(* clue how it works or what it does.

Right now I'm loading each of the files individually.
/usr/bin/ir-keytable -c
/usr/bin/ir-keytable -p NEC,RC6 -w /etc/rc_keymaps/rc6_mce
/usr/bin/ir-keytable -p NEC,RC6 -w /etc/rc_keymaps/yamaha_dvd
/usr/bin/ir-keytable -p NEC,RC6 -w /etc/rc_keymaps/samsung_stb

Now when you run 'ir-keytable -t' you should see each of the buttons mapped.
You need to specify the protocol otherwise it'll drop one of them based on the rc_keymaps.

7) NOW you can install LIRC. Edit /etc/lirc/hardware.conf so that
DEVICE="/dev/input/by-id/**YOUR DEVICE HERE***"

To determine where the input device is mapped just do an 'ls' of /dev/input/by-id/. It should be fairly obvious which one it is. If it's not obvious, unplug everything else until your receiver is the only thing left.

Edit /etc/lirc/lircd.conf so that it looks like this:
include "/usr/share/lirc/remotes/devinput/lircd.conf.devinput"

Fire up lirc. Now when you run irw, you should see the output of each of your remotes, except they're all channeled as devinput.

/etc/rc_keymaps# irw
0000000080010069 00 KEY_LEFT devinput
0000000080010069 01 KEY_LEFT devinput
0000000080010069 00 KEY_LEFT devinput
000000008001006a 00 KEY_RIGHT devinput
000000008001006a 01 KEY_RIGHT devinput
0000000080010067 00 KEY_UP devinput
000000008001006c 00 KEY_DOWN devinput
0000000080010160 00 KEY_OK devinput
0000000080010160 00 KEY_OK devinput

8-n) From here on out, you're on your own. Read up on LIRC and lircmap.xml

Problems as of now: I literally have no clue WTF rc_maps.cfg does or how to use it. For some crazy reason if LIRC starts in init.d like it should, it won't work. I always have to restart it. So right now, my rc.local looks like this:
/etc/init.d/lirc stop
/usr/bin/ir-keytable -c
/usr/bin/ir-keytable -p NEC,RC6 -w /etc/rc_keymaps/rc6_mce
/usr/bin/ir-keytable -p NEC,RC6 -w /etc/rc_keymaps/yamaha_dvd
/usr/bin/ir-keytable -p NEC,RC6 -w /etc/rc_keymaps/samsung_stb
/etc/init.d/lirc start

All 3 of my remotes work on reboot, and that's better than they used to.
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
No bug here. Just me being special. Carry. on.
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
Thank you! I've been scratching my head trying to understand how the change fom the external LIRC module to in-kernel LIRC driver works, and how I could get my remotes working without relying on LIRC.

In my trials I found a couple of things. I think the in-kernel LIRC reads the standard hardware.conf, which specifies devinput as the driver amongst other things. It then turns the scancodes from the remote into keycodes using the ir-keytable mapping. I think these are passed as actual keystrokes so Lircmap.xml and remote.xml never factor into it and I keyboard.xml does the translation.

I think this because none of the changes I was making to Lircmap.xml were having any effect. So I turned on key logging in XBMC, assigned a standard key (M) to a button on my remote using ir-keytable, then pressed it and the M key on my keyboadr. Both show up in the log just the same.

The upshot is that you can assign any KEY_NAME to any button and as long as it's key code is less than 255 it'll work in XBMC. No more futzing around with xml files.

I've now uninstalled Lirc and everything still works just fine.

Caveat: I'm new to XBMC and LIRC, so my conclusions could be very wrong, but I don't think they are Smile
"In Kernel" LIRC reads nothing. It just "is" It's like a keyboard.

hardware.conf tells the standalone lirc program that it should be looking at devinput instead of one of the normal kernel.

And do you have a real deal MCE remote? Because it sounds like you have a fax knockoff where the remote actually does show up like a keyboard and just sends key presses.
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
Fair enough. So I should be able to delete hardware.conf and lircd.conf?

I've actually got two remotes. One's a Harmony 525 set to emulate an MCE remote, the other is a cheap knock off I bought for the receiver. It's branded HP but shows up as a Fintek (lsusb). Both remotes behave the same.

Is there anyway to tell if the remote is being treated as a keyboard?
In xbmc_dharma_10 ( Ubuntu) in the xbmc.log was key id:
SDLKeyboard: scancode: 123, sym: 0, unicode: 0, modifier: 0
OnKey: 61615 pressed, action is
and can be edited keyboard.xml for key id, for example:
<key id='61615'>play</key>
In xbmc_eden_11 debug xbmc.log :
SDLKeyboard: scancode: 1a, sym: 0065, unicode: 0005, modifier: 40
OnKey: ctrl-e (1f045) pressed, action is ActivateWindow(video)
SDLKeyboard: scancode: 25, sym: 0132, unicode: 0000, modifier: 0
OnKey: leftctrl (f0a2) pressed, action is

How do I edit keyboard.xml in xbmc_eden on key id?
I was looking for an answer here, but did not find Sad
Are you able to have lirc working if you suspend the pc and resume it?

thnak you

lupick: yep, problems after resume. I just tested it. Tried dumping the kernel modules and reloading them, everything. Probably just another bug from the merge.

bsp134: They're just dumped in hex now. Why they didn't prefix it with 0x you'll have to ask the devs.
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
lupick: My remotes work after suspend/resume using the in kernel LIRC.
/sys/class/rc/: No such file or directory
any ideas Huh
its the xbox DVD remote btw, I hate that every single update of ubuntu breaks everything just to add some new stuff that's not needed but what ya gonu do :/
What does lsusb do? Because right now it doesn't think it has an RC remote connected.
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
well I reconfigured the ati module with "#undef LIRC_HAVE_KFIFO" to get it working, I tried running lsusb before but it crashed and I didn't try it again. but now its showing;
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 045e:0284 Microsoft Corp. Xbox DVD Playback Kit
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102 flash drive
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
so it can see it there with the reconfigure but ir-keytable still says the same thing. would it help if I reconfigure it back to "#define LIRC_HAVE_KFIFO" and try it again?
I'm stuck on programming the keycodes... I have copied the file to /etc/rc_keymaps/rc6_mce, used ir-keytable -r to see the existing keycodes, -c to clear them, -r to confirm they are now cleared. Then the -p command to program the new codes from the file above.

It says "wrote 61 keycode(s) to driver... protocols changed to RC-6" and so on, but now when I use -r the only entry in the table is:
scancode 0x7fffff = KEY_PLAYPAUSE (0xa4)
And that isn't even in the file! But judging by the hex value, it just isn't working in the first place....

Any thoughts? I've tried it multiple times with the same result. Reboot gives me back the original keycode table, then I go through the process again, with the same result.

I have tried using the original file without modifications, and with the # table rc6_mce, type: RC6 line at the top... same deal...

UPDATE: hmmm I use the -v verbose option when updating the keycode table and this results. Initially it looks as though it is parsing it correctly, then at the end it appears to be writing all the codes to the same scancode, which is presumably why I'm only left with a single entry! Any thoughts?

UPDATE2: it seems that the maximum scancode it accepts is 7fffff! When I set a pair manually using the -k option, below 80000000 it works fine... but the standard codes for rc6 are all well over 80000000 ... now I'm really confused!

UPDATE3: OK, ir-keymaps has a bug in it - build new version from these instructions then it allows codes higher than 7ffffff ...

xbmc@xbmc:~$ sudo ir-keytable -v -p RC6 -w /etc/rc_keymaps/rc6_mce
Parsing /etc/rc_keymaps/rc6_mce keycode file
parsing 0x800f0400=KEY_NUMERIC_0:    value=512
parsing 0x800f0401=KEY_NUMERIC_1:    value=513
parsing 0x800f0402=KEY_NUMERIC_2:    value=514
parsing 0x800f0403=KEY_NUMERIC_3:    value=515
parsing 0x800f0404=KEY_NUMERIC_4:    value=516
parsing 0x800f0405=KEY_NUMERIC_5:    value=517
parsing 0x800f0406=KEY_NUMERIC_6:    value=518
parsing 0x800f0407=KEY_NUMERIC_7:    value=519
parsing 0x800f0408=KEY_NUMERIC_8:    value=520
parsing 0x800f0409=KEY_NUMERIC_9:    value=521
parsing 0x800f040a=KEY_DELETE:    value=111
parsing 0x800f040b=KEY_ENTER:    value=28
parsing 0x800f040c=KEY_POWER:    value=116
parsing 0x800f040d=KEY_PROG1:    value=148
parsing 0x800f040e=KEY_MUTE:    value=113
parsing 0x800f040f=KEY_INFO:    value=358
parsing 0x800f0410=KEY_VOLUMEUP:    value=115
parsing 0x800f0411=KEY_VOLUMEDOWN:    value=114
parsing 0x800f0412=KEY_CHANNELUP:    value=402
parsing 0x800f0413=KEY_CHANNELDOWN:    value=403
parsing 0x800f0414=KEY_FASTFORWARD:    value=208
parsing 0x800f0415=KEY_REWIND:    value=168
parsing 0x800f0416=KEY_PLAY:    value=207
parsing 0x800f0417=KEY_RECORD:    value=167
parsing 0x800f0418=KEY_PAUSE:    value=119
parsing 0x800f046e=KEY_PLAYPAUSE:    value=164
parsing 0x800f0419=KEY_STOP:    value=128
parsing 0x800f041a=KEY_NEXT:    value=407
parsing 0x800f041b=KEY_PREVIOUS:    value=412
parsing 0x800f041c=KEY_NUMERIC_POUND:    value=523
parsing 0x800f041d=KEY_NUMERIC_STAR:    value=522
parsing 0x800f041e=KEY_UP:    value=103
parsing 0x800f041f=KEY_DOWN:    value=108
parsing 0x800f0420=KEY_LEFT:    value=105
parsing 0x800f0421=KEY_RIGHT:    value=106
parsing 0x800f0422=KEY_OK:    value=352
parsing 0x800f0423=KEY_EXIT:    value=174
parsing 0x800f0424=KEY_DVD:    value=389
parsing 0x800f0425=KEY_TUNER:    value=386
parsing 0x800f0426=KEY_EPG:    value=365
parsing 0x800f0427=KEY_ZOOM:    value=372
parsing 0x800f043a=KEY_BRIGHTNESSUP:    value=225
parsing 0x800f0446=KEY_TV:    value=377
parsing 0x800f0447=KEY_AUDIO:    value=392
parsing 0x800f0448=KEY_PVR:    value=366
parsing 0x800f0449=KEY_CAMERA:    value=212
parsing 0x800f044a=KEY_VIDEO:    value=393
parsing 0x800f044c=KEY_LANGUAGE:    value=368
parsing 0x800f044d=KEY_TITLE:    value=369
parsing 0x800f044e=KEY_PRINT:    value=210
parsing 0x800f0450=KEY_RADIO:    value=385
parsing 0x800f045a=KEY_SUBTITLE:    value=370
parsing 0x800f045b=KEY_RED:    value=398
parsing 0x800f045c=KEY_GREEN:    value=399
parsing 0x800f045d=KEY_YELLOW:    value=400
parsing 0x800f045e=KEY_BLUE:    value=401
parsing 0x800f0465=KEY_POWER2:    value=356
parsing 0x800f046e=KEY_PLAYPAUSE:    value=164
parsing 0x800f046f=KEY_MEDIA:    value=226
parsing 0x800f0480=KEY_BRIGHTNESSDOWN:    value=224
parsing 0x800f0481=KEY_PLAYPAUSE:    value=164
Read rc6_mce table
Found device /sys/class/rc/rc0/
Input sysfs node is /sys/class/rc/rc0/input7/
Event sysfs node is /sys/class/rc/rc0/input7/event7/
Parsing uevent /sys/class/rc/rc0/input7/event7/uevent
/sys/class/rc/rc0/input7/event7/uevent uevent MAJOR=13
/sys/class/rc/rc0/input7/event7/uevent uevent MINOR=71
/sys/class/rc/rc0/input7/event7/uevent uevent DEVNAME=input/event7
Parsing uevent /sys/class/rc/rc0/uevent
/sys/class/rc/rc0/uevent uevent NAME=rc-rc6-mce
/sys/class/rc/rc0/uevent uevent DRV_NAME=mceusb
input device is /dev/input/event7
/sys/class/rc/rc0/protocols protocol rc-5 (disabled)
/sys/class/rc/rc0/protocols protocol nec (disabled)
/sys/class/rc/rc0/protocols protocol rc-6 (enabled)
/sys/class/rc/rc0/protocols protocol jvc (disabled)
/sys/class/rc/rc0/protocols protocol sony (disabled)
/sys/class/rc/rc0/protocols protocol lirc (disabled)
Opening /dev/input/event7
Input Protocol version: 0x00010001
Wrote 61 keycode(s) to driver
Protocols changed to RC-6
...ok next problem!

I've got through all the config up to testing using irw - but none of the keys do anything when I run irw.

ir-keytable -t shows me the scan codes and the correctly mapped keycodes.

as soon as I start lirc, ir-keytables stops reporting anything. Lirc starts fine it seems, but then irw doesn't report anything at all when I press buttons on the remote. As soon as I stop lirc, ir-keytable starts working again.

I have the devinput settings in both the lirc config files. if I cat /dev/input/by-id .... it generates junk characters whilst lirc isn't running, and nothing when it is running...

for some reason it seems that lirc just isn't connected to that device properly, but enough to cut off anything else from using it!

I'm not clear on whether I am using the built in lirc stuff new to Natty or not... I just apt-get installed lirc

Can anyone help?
bump! Can anyone help me?? (mum and dad want their media centre back Smile )

Logout Mark Read Team Forum Stats Members Help
ir-keytable or: How I Learned to Stop Worrying about the LIRC Kernel0
This forum uses Lukasz Tkacz MyBB addons.