As I mentioned my little PC came without remote. What's more zbox for some reasons doesn't support CEC (over HDMI) , so it's not possible to just use TV remote that easily.
There are few options I was considering.
Finally for me most obvious solution was to play with LIRC and Kodi configuration and try to make my TV remote work with Kodi. This way I would have only 1 remote for TV and HTPC and I would save some $$$.
Sooooooo...
Just to mention at the moment I use openelec 4.95.3 beta (with beta Kodi 14.0 Helix).
I needed to stop lirc service
systemctl stop eventlircd
Then to be sure clear current mappings and set generic protocols:
ir-keytable -p NEC,RC-5,RC-6,JVC,SONY,LIRC,OTHER
ir-keytable -c
After that we can test if our remote works. Execute:
and start pushing buttons on remote. I could see something like :
1417281263.268482: event type EV_MSC(0x04): scancode = 0x02
1417281263.268482: event type EV_SYN(0x00).
1417281263.627818: event type EV_MSC(0x04): scancode = 0x4010
1417281263.627818: event type EV_SYN(0x00).
I also for some reasons didn't finally used all generic protocols and i found out that my remote (from Phillips TV) works with RC-6 (of course i executed ir-keytable command with one protocol at a time [not with the full list] and checked which one is working fine). So finally my command is:
ir-keytable -p RC-6 -t
So now we can generate list of mappings. First we need to know names of keys... Possibilities are listed
HERE or you can list it by command
irrecord -list namespace
Then we have to create file in /storage/.config. You can use whichever name you want (in my case "phillips_remote"). And list key codes from remote with names of keys from LIRC. My conf file looks like that:
# table phillips_remote, type: RC-6
0x005c KEY_ENTER
0x005b KEY_RIGHT
0x005a KEY_LEFT
0x0058 KEY_UP
0x0059 KEY_DOWN
0x0010 KEY_VOLUMEUP
0x0011 KEY_VOLUMEDOWN
0x000a KEY_ESC # back
0x004c KEY_MENU # right >|
0x004d KEY_CONTEXT_MENU # left <|
0x0000 KEY_0
0x0001 KEY_1
0x0002 KEY_2
0x0003 KEY_3
0x0004 KEY_4
0x0005 KEY_5
0x0006 KEY_6
0x0007 KEY_7
0x0008 KEY_8
0x0009 KEY_9
0x004b KEY_INFO # teletext
Just in case also second remote
# table exposure_remote, type: RC-5
0x1435 KEY_ENTER
0x1420 KEY_RIGHT
0x1421 KEY_LEFT
0x1430 KEY_UP
0x1436 KEY_DOWN
0x1010 KEY_VOLUMEUP
0x1011 KEY_VOLUMEDOWN
0x1432 KEY_ESC # <<
0x1434 KEY_MENU # >>
0x141c KEY_CONTEXT_MENU # random
0x141d KEY_INFO # repeat
0x140b KEY_PLAY # time
0x140f KEY_STOP # display
0x142d KEY_AUDIO # open
0x1451 KEY_PREVIOUS # sel-
0x1450 KEY_NEXT # sel+
Next step is to apply it to system
ir-keytable -c -p RC-6 -w /storage/.config/phillips_remote
And test under Kodi. Here I had weird situation. At beginning most of buttons worked fine but not all... for example KEY_ESC didn't work - I tried with KEY_BACK etc and nothing could work. From what I noticed it was because we cleared all default mappings (as suggested on official wiki) and somehow since then not all the mappings were fine.
After getting back to default settings (and restarting lirc service) it went back to normal. If you want to be sure - after you get all the mappings from your remote (by ir-keytable -t) you should restart your PC.
Anyway finally, in my case, all keys - I wanted - worked fine.
So now we have working setup - we need to make it permanent. Trick is easy as mentioned
HERE...
We just put final command (ir-keytable) into autostart.sh
EDIT...
I decided that I want to map one of the keyboards to start music "Party mode" - so i can start it without turning on TV.
To do that:
cp /usr/share/kodi/system/Lircmap.xml /storage/.kodi/userdata
cp /usr/share/kodi/system/keymaps/remote.xml /storage/.kodi/userdata/keymaps
I mapped my button with KEY_AUDIO (of course it can be something different)
Then I used command irw
# irw
188 0 KEY_AUDIO devinput
188 0 KEY_AUDIO_UP devinput
So I check Lircmap.xml file searching for devinput string where I can see :
<mymusic>KEY_AUDIO</mymusic>
So it means that this button is mapped to label mymusic in Kodi.
Now we go to file remote.xml and I found
<mymusic>ActivateWindow(MyMusic)</mymusic>
Then we go to Kodi wiki site
HERE and search for Party mode function.
There is
PlayerControl(command)
and short description
Partymode(music/video) toggles the appropriate partymode, defaults to
music if no parameter is given, besides the default music or video
partymode you can also pass a path to a custom smartplaylist (.xsp) as
parameter.
So simply we edit our remote.xml file and do a small change:
<mymusic>PlayerControl(Partymode(music))</mymusic>
Restart of kodi and we're ready :)
Of course it is only one of ways to accomplish the task... there are few other options - described on kodi wiki of course :)