News:

Latest versions:
Server plugin: 0.5.1
MVP dongle: 0.5.2
Raspberry Pi client: 0.5.2
Windows client: 0.5.2-1

Main Menu

Vomp 0.4.0 and remapping Microsoft MCE remote keys (or any other modern remote)

Started by dingo35, October 13, 2013, 13:21:09

Previous topic - Next topic

dingo35

Finally got my Raspberry Pi, installed vompclient and then discovered some keys of my Microsoft MCE remote control were not recognized. Especially the BACK key (marked BACK/EXIT on hauppauge's remote) is a pain when missed.
Also this remote lacks the red/green/yellow/blue keys, but it has four unused keys in a row (Recorded TV, Guide,Live TV and DVD Menu) which can be remapped to those colours easily.

Also Power, Menu, Fast forward and Rewind keys were not working.

Now first thing I did was
apt-get purge inputlirc
apt-get purge lirc
apt-get autoremove


to get rid of all LIRC stuff. LIRC has had its use in the far past when people bought an IR-sensitive transistor and hooked it up to their serial RS232 port. In this day and age of USB and event- and input driven code in the kernel you don't need it, it will only mess up stuff.

Then test if your remote is recognized by the kernel:
ir-keytable -t

Now press keys on your remote, and if your remote is recognized by the kernel it reports every keypress. Now press all the keys you want to remap, and write down their key-codes. E.g. I want to remap my DVD-Menu key to act like the blue button on my old hauppauge remote, pressing that key reports: KEY_DVD.

Now look at by which driver, and at which table it is recognized:

root@raspvideo:/tmp# ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event0) with:
        Driver mceusb, table rc-rc6-mce
        Supported protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
        Enabled protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
        Repeat delay = 500 ms, repeat period = 125 ms



Now generate new keymap file:
ir-keytable --read --device=/dev/input/event0 >/etc/rc_keymaps/rc6_mce

Now change the lines of the keys you want to remap (note how we remap the KEY_DVD to KEY_BLUE):

scancode 0x800f040c = KEY_POWER #was KEY_SLEEP (0x8e)
scancode 0x800f040d = KEY_M #was KEY_MEDIA (0xe2)
scancode 0x800f0414 = KEY_FORWARD # was KEY_FASTFORWARD (0xd0)
scancode 0x800f0415 = KEY_BACK #was KEY_REWIND (0xa8)
scancode 0x800f0423 = KEY_BACKSPACE #was KEY_EXIT (0xae)
scancode 0x800f0424 = KEY_BLUE #was KEY_DVD (0x185)
scancode 0x800f0425 = KEY_YELLOW #was KEY_TUNER (0x182)
scancode 0x800f0426 = KEY_GREEN #was KEY_EPG (0x16d)
scancode 0x800f0448 = KEY_RED #was KEY_PVR (0x16e)


The left-hand keynames are the ones that VOMP expects, you can find them in the source code of vompclient in remotelinux.cc .

Now test the keymap by writing it:
ir-keytable --write=/etc/rc_keymaps/rc6_mce --device=/dev/input/event0

Your vompclient should now use new mappings, but will lose these mappings after reboot.

vi /etc/rc_maps.cfg
change line:
*  rc-rc6-mce               /lib/udev/rc_keymaps/rc6_mce
to:

#*  rc-rc6-mce               /lib/udev/rc_keymaps/rc6_mce
#remap microsoft MCE remote color buttons for VOMP
* rc-rc6-mce               rc6_mce


Now you would expect that linux would load this settings at reboot, but it doesn't at my machine. I suspect it is because the kernel at Raspbian is compiled without CONFIG_RC_MAP set, but I am not sure about that.

What I am sure about is that it will load when specified explicitly, add these lines at the end of /etc/rc.local, just before the exit statement:
ir-keytable -a /etc/rc_maps.cfg
/usr/local/bin/vompclient


Have fun!

MartenR

Just one note, you can also use any other keycodes. The names you find in remotelinux.h are only the names, which were made humanreadable. You can assign in the settings dialog any scancode to a given vomp key, the only difference will be that a hex code will appear.

Marten

domaju

As a newbie, I had the following starting point:

- I installed the vompclient using the instructions http://www.loggytronic.com/vomp-pi.php
- During the (second) installation, I had the USB IR sensor of my HAMA MCE plugged in (I first missed that and the remote was not working at all)
- The hama remote worked out of the box so far.

In order to be more flexible with the key mapping, I thought following the instructions of dingo35 is a good idea. After installing ir-keytable with "apt-get install ir-keytable", I run "ir-keytable -t". This is the result:

/sys/class/rc/: No such file or directory

What do I miss?

Markus




dingo35

Things you could try:
-login as root and retry; perhaps it is a permissions problem?
-check the /sys directory structure (again as root)
-what does ir-keytable (without arguments) report?
-unplug and replug your remote, and look with dmesg and/or /var/log/syslog what the kernel is reporting

I have no access to my raspi right now, so I am not sure which kernel module would create the /sys/class../rc directory, but my first guess would be the mceusb module (lsmod | grep mceusb), so perhaps that one doesn't get loaded properly. You could 
-load the mceusb module by hand with modprobe).
-what does lsusb report?

Good luck!

domaju

Hi again,

here comes the result of my efforts:

> -login as root and retry; perhaps it is a permissions problem?
This made no difference

>check the /sys directory structure (again as root)
The /sys/class/rc directory  is missing (class and other subdirectories of class exist)

>-what does ir-keytable (without arguments) report?
Exactly the same as with "-t"

>-unplug and replug your remote, and look with dmesg and/or /var/log/syslog what the kernel is reporting

Jan 25 15:49:34 raspberrypi kernel: [21664.448880] usb 1-1.2: USB disconnect, device number 4
Jan 25 15:49:38 raspberrypi kernel: [21668.271897] usb 1-1.2: new low-speed USB device number 6 using dwc_otg
Jan 25 15:49:38 raspberrypi kernel: [21668.429383] usb 1-1.2: New USB device found, idVendor=05a4, idProduct=9881
Jan 25 15:49:38 raspberrypi kernel: [21668.429422] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Jan 25 15:49:38 raspberrypi kernel: [21668.462338] input: HID 05a4:9881 as /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/input/input4
Jan 25 15:49:38 raspberrypi kernel: [21668.475287] hid-generic 0003:05A4:9881.0005: input,hidraw0: USB HID v1.10 Keyboard [HID 05a4:9881] on usb-bcm2708_usb-1.2/input0
Jan 25 15:49:38 raspberrypi kernel: [21668.588528] input: HID 05a4:9881 as /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.1/input/input5
Jan 25 15:49:38 raspberrypi kernel: [21668.589514] hid-generic 0003:05A4:9881.0006: input,hidraw1: USB HID v1.10 Mouse [HID 05a4:9881] on usb-bcm2708_usb-1.2/input1

> load the mceusb module by hand with modprobe.
Done using "sudo modprobe mceusb". I hope that was the right way of doing it.

Now, the error message when entering "ir-keytable" or "it-keytable -t" changed:
Couldn't find any node at /sys/class/rc/rc*.
Indeedd, /sys/class/rc now exists but has no entries

>what does lsusb report?

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 007: ID 05a4:9881 Ortek Technology, Inc.
Bus 001 Device 005: ID 046a:0023 Cherry GmbH CyMotion Master Linux Keyboard

Just to state it again: In general, the remote is working with the vompclient, meaning that somehow, somewhere it was recognized.

Markus


dingo35

Looks like your remote receiver uses another chipset, which uses another kernel module than mceusb ...

From the net:
=================================
Remote controls of internal TV adapters

Receivers that are integral to the TV adapters are usually attached via rc-core and will be configured via ir-keytable. There are a few exceptions from this rule. Thus, you may check whether or not an corresponding rc-core device has been created:

rc-core recognized.

user@yavdr:~$ sudo ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event3) with:
        Driver ir-kbd-i2c, table rc-rc5-tv
        Supported protocols: RC-5
        Enabled protocols:
Repeat delay = 500 ms, repeat period = 33 ms

The subsequent setup instructions are described in the section ir-keytable in this manual.

When there is no rc-core device recognized, the following output is given:

user@yavdr:~$ sudo ir-keytable
Couldn't find any node at /sys/class/rc/rc*.

To identify whether the remote control is recognized and how it is hooked into the sytem, please check the input devices: cat /proc/bus/input/devices

================================
So this last command would give you some insight; your only chance would be if the kernel module has some parameters to have rc_core used (doubtful), you could try modinfo <modulename> . If not, last chance would be some kernel-compiletime paramater for this module (just guessing here), but it would require recompiling your kernel.

If all else fails, I'm afraid you will have to use lirc....

domaju

Thanks for the explanation! I think I have to give it up with my remote.

However: Before actually switching to LIRC: Another option might be to buy exactly the same hardware which you are using. Which Microsoft MCE remote control and IR receiver were you using?

Markus