0

I read a lot of texts to come this far :) After 17.04 upgrade LIRC didn't work anymore with my NUC7i5...so I did find out about using ir-keytable. (This post helped me a lot!)

So after uninstalling LIRC, my ir-keytable looked like this (interesting the lirc-protocol is still enabled):

sudo ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event6) with:
    Driver ite-cir, table rc-rc6-mce
    Supported protocols: unknown other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp 
    Enabled protocols: lirc 
    Name: ITE8708 CIR transceiver
    bus: 25, vendor/product: 1283:0000, version: 0x0000
    Repeat delay = 500 ms, repeat period = 125 ms

Then I found out the old Mac remote I have is working on the NEC-protocol, so I created my own rc_keymaps and activated the NEC-protocol like this:

cp /lib/udev/rc_keymaps/nec_terratec_cinergy_xs /etc/rc_keymaps/nec_mac
sudo ir-keytable -p nec

Now I could run the ir-keytable-test to see the scancodes of the remote keys:

sudo ir-keytable -t
Testing events. Please, press CTRL-C to abort.
1504134142.373150: event type EV_MSC(0x04): scancode = 0x77e15025
1504134142.373150: event type EV_SYN(0x00).
1504134143.213712: event type EV_MSC(0x04): scancode = 0x77e13025
1504134143.213712: event type EV_SYN(0x00).
1504134143.935559: event type EV_MSC(0x04): scancode = 0x77e16025
1504134143.935559: event type EV_SYN(0x00).
1504134145.042733: event type EV_MSC(0x04): scancode = 0x77e19025
1504134145.042733: event type EV_SYN(0x00).
1504134145.844078: event type EV_MSC(0x04): scancode = 0x77e1a025
1504134145.844078: event type EV_SYN(0x00).

Those scancodes have been useful to modify the copied keymap-file:

sudo nano /etc/rc_keymaps/nec_mac

The result of this modification looks like this:

cat /etc/rc_keymaps/nec_mac 
# table nec_mac type: NEC
0x77e15025 KEY_VOLUMEUP
0x77e13025 KEY_VOLUMEDOWN
0x77e1a025 KEY_PLAYPAUSE
0x77e19025 KEY_PREVIOUSSONG
0x77e16025 KEY_NEXTSONG

After clearing the old keytable of ir-keytable and loading the new rc_keymaps file nec_mac, the remote worked partly in 17.04 and in Rhythmbox (I do have those commands in my rc.local to activate the keymaps on startup):

sudo ir-keytable -c
sudo ir-keytable -p nec -w /erc/rc_keymaps/nec_mac

But two buttons are not working: KEY_PREVIOUSSONG and KEY_NEXTSONG. I do have a wireless Logitech keyboard (k830, with an USB-reciever)...here all the media-keys are working with Rythmbox. And if I try the sudo showkey command and I press the keyboard KEY_NEXTSONG and the IR remote KEY_NEXTSONG, I get the same keycode:

keycode 163 press
keycode 163 release

If I try installing LIRC again after all those configurations, either the IR remote is not working anymore or it's getting in some "endless loop" (eg pressing once KEY_VOLUMEUP and it goes all the way up).

So anyone has any idea how to handle the ir-keytable without LIRC to make those two keys working in rhythmbox?

My kernel-version should be up2date: 4.10.0-33-generic

Thanks for every hint.

1 Answer 1

0

I have 4.4.0-generic running on Macbook Pro (2011) with an apple remote and I had the same problem. Background first then how I fixed it:

Background:

My kernel - installed w/Mint 18.1 based on ubuntu 16.4 so older than yours - recognizes the remote before I installed anything. Volume up, Volume down, play/pause work same as keyboard keys, next track and previous track did not. I reinstalled package lirc and edited in a mac mini specification for the remote. No change. Running irw I can see that the kernel recognizes the remote and creates an event for each button.

Some people have mentioned that the newer kernel just didn't work with the remote the way an older one did and gave up or rolled back to an earlier kernel, but here is what I did.

Fixing it:

I installed evtest package

$ sudo apt install evtest

Ran evtest. The program gives you a list of every input device &c. Select the number for the remote and press enter. On my laptop the list included

/dev/input/event6:  Apple Computer, Inc. IR Receiver
/dev/input/event7:  Apple Inc. Apple Internal Keyboard / Trackpad

so to see the apple remote I type 6 .

$ sudo evtest

Select the device event number [0-16]: 6
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x5ac product 0x8242 version 0x111
Input device name: "Apple Computer, Inc. IR Receiver"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event code 28 (KEY_ENTER)
  Event code 114 (KEY_VOLUMEDOWN)
  Event code 115 (KEY_VOLUMEUP)
  Event code 139 (KEY_MENU)
  Event code 158 (KEY_BACK)
  Event code 159 (KEY_FORWARD)
  Event code 164 (KEY_PLAYPAUSE)
  Key repeat handling:
    Repeat type 20 (EV_REP)
      Repeat code 0 (REP_DELAY)
        Value    250
      Repeat code 1 (REP_PERIOD)
        Value     33
Properties:
Testing ... (interrupt to exit)
Event: time 1509552582.912009, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
Event: time 1509552582.912009, -------------- SYN_REPORT ------------
Event: time 1509552583.034614, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1509552583.034614, -------------- SYN_REPORT ------------
Event: time 1509552586.159731, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1509552586.159731, -------------- SYN_REPORT ------------
Event: time 1509552586.338556, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1509552586.338556, -------------- SYN_REPORT ------------
Event: time 1509552587.375649, type 1 (EV_KEY), code 158 (KEY_BACK), value 1
Event: time 1509552587.375649, -------------- SYN_REPORT ------------
Event: time 1509552587.626549, type 1 (EV_KEY), code 158 (KEY_BACK), value 2
Event: time 1509552587.626549, -------------- SYN_REPORT ------------
Event: time 1509552587.650543, type 1 (EV_KEY), code 158 (KEY_BACK), value 0
Event: time 1509552587.650543, -------------- SYN_REPORT ------------

Now lets look at what happens when I press the next track button and previous track button on the keyboard:

Select the device event number [0-16]: 7

Event: time 1509552799.129798, type 1 (EV_KEY), code 165 
(KEY_PREVIOUSSONG), value 1
Event: time 1509552799.129798, -------------- SYN_REPORT ------------
Event: time 1509552799.265788, type 1 (EV_KEY), code 165 
(KEY_PREVIOUSSONG), value 0
Event: time 1509552799.265788, -------------- SYN_REPORT ------------
Event: time 1509552800.641684, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 1

So the keyboard is generating the correct code "KEY_PREVIOUSSONG", "KEY_NEXTSONG" but the remote is not.

so, edit the file /etc/lirc/hardware.conf

Well, on my machine the directory /etc/lirc does not exist. so...

$ apt install lirc

After installing the package files a script gets run automatically. You have to select your remote hardware from a list and hit enter. I selected "mac mini blah blah" and from the next list (transmitters, I think) I selected none. Now there is a file /etc/lirc/hardware.conf. It is mostly empty and points to a file specific for this remote control. so edit this file - its not easy to figure out the location, I found it at

cd /usr/share/lirc/remotes/apple/
nano lircd.conf.macmini

change the word KEY_REWIND to KEY_PREVIOUSSONG and change KEY_FORWARD to KEY_NEXTSONG.

Now restart the lirc daemon to recognize the new configuration.

sudo /etc/init.d/lirc restart

Now the right and left buttons will work. :)

1
  • Thanks a lot - didn't know evtest till now... I did uninstall lirc (by purge-cmd) and I removed the /etc/lirc folder. Then I did install evtest and since then the IR works - also the KEY_PREVIOUSSONG and KEY_NEXTSONG. I tried to follow your further description, but the lirc-install just blocked the remote again... So, somehow there had been a conflict, and now it's gone with lirc :) Thx!
    – lorny
    Nov 2, 2017 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.