Remote control basics

  • Hi. I'm running LE 7.2.009 (kszaq build)
    I'm having some trouble with remote IR control. Some buttons works fine, some others activate different actions, some others do nothing.
    I'm trying to figure out on how change mapping for my remote.
    I followed the suggestion to copy the original Android remote.conf file to my /storage/.config directory. No luck.


    I investigated on how remote can work in LE, and I got confused.
    Lircd is not running (and no lirc in dmesg after boot). From process list i found "eventlircd" running. It uses .evmap configuration files stored in /etc/evenlircd.d directory.
    I can't figure how this can let my remote control (partially) works, so I'm not able to modify my mapping.
    Also, I have no idea on where or how the map in remote.conf file is "translated" into something usable by KODI (i.e. /keymaps/remote.xml or Lircmap.xml)
    My remote.conf contains mapping like:
    ...
    key_begin
    0x01 11
    0x4e 2
    0x0d 3
    ...


    I didn't succeed to use any of the traditional lirc tools to grab button event, I even didn' t understand which /dev/input my remote is linked to.
    From my syslog the only clue when I press remote buttons:
    # journalctl -f
    Dec 09 18:14:28 LibreELEC kernel: remote: press ircode = 0x16,
    Dec 09 18:14:28 LibreELEC kernel: remote:
    Dec 09 18:14:28 LibreELEC kernel: scancode = 0x0067,maptable = 0,code:0xe916fe01
    Dec 09 18:14:28 LibreELEC kernel: remote: release ircode = 0x16,
    Dec 09 18:14:28 LibreELEC kernel: remote:
    Dec 09 18:14:28 LibreELEC kernel: scancode = 0x0067, maptable = 0,code:0x00000000
    Dec 09 18:14:29 LibreELEC kernel: remote: press ircode = 0x50,
    Dec 09 18:14:29 LibreELEC kernel: remote:
    Dec 09 18:14:29 LibreELEC kernel: scancode = 0x006a,maptable = 0,code:0xaf50fe01
    Dec 09 18:14:29 LibreELEC kernel: remote: release ircode = 0x50,
    Dec 09 18:14:29 LibreELEC kernel: remote:
    Dec 09 18:14:29 LibreELEC kernel: scancode = 0x006a, maptable = 0,code:0x00000000
    Dec 09 18:14:30 LibreELEC kernel: remote: press ircode = 0x13,
    Dec 09 18:14:30 LibreELEC kernel: remote:
    Dec 09 18:14:30 LibreELEC kernel: scancode = 0x001c,maptable = 0,code:0xec13fe01
    Dec 09 18:14:31 LibreELEC kernel: remote: release ircode = 0x13,
    Dec 09 18:14:31 LibreELEC kernel: remote:
    Dec 09 18:14:31 LibreELEC kernel: scancode = 0x001c, maptable = 0,code:0x00000000
    Dec 09 18:14:32 LibreELEC kernel: remote: press ircode = 0x51,
    Dec 09 18:14:32 LibreELEC kernel: remote:
    Dec 09 18:14:32 LibreELEC kernel: scancode = 0x0069,maptable = 0,code:0xae51fe01
    Dec 09 18:14:33 LibreELEC kernel: remote: release ircode = 0x51,
    Dec 09 18:14:33 LibreELEC kernel: remote: scancode = 0x0069, maptable = 0,code:0x00000000




    I read something special is for amremote device, so I stopped trying with my own knowledge.
    Can someone please point me in the right direction to understand basics of remote control for this hardware related to this OS? My Linux knowledge didn't help ...


    Thanks
    giuliano

  • Easy way - fire up the keymap editor from the official repo, press a button that doesn't work and map it to the function you want. I don't like it for a few reasons but it will do the job.
    What I do:
    enable debug logging, bring the log up on my pc, press a key, refresh the log. Read the last couple of lines, it tells you the code (hex) and the action linked to it. List the buttons / codes / actions. Then either edit remote.conf directly (to send different codes) or write a keymap (.xml file) and stick it in .kodi/userdata/keymaps (which is how the keymap editor addon does its stuff).
    If you click the link in my sig there's a bit more detail.


  • Easy way - fire up the keymap editor from the official repo, press a button that doesn't work and map it to the function you want. I don't like it for a few reasons but it will do the job.
    What I do:
    enable debug logging, bring the log up on my pc, press a key, refresh the log. Read the last couple of lines, it tells you the code (hex) and the action linked to it. List the buttons / codes / actions. Then either edit remote.conf directly (to send different codes) or write a keymap (.xml file) and stick it in .kodi/userdata/keymaps (which is how the keymap editor addon does its stuff).
    If you click the link in my sig there's a bit more detail.


    Thank trogggy. I'try the add-on and the easy way to quick be able rising the volume.
    In the mean time, I still would like to learn the hard way :)
    [hr]
    Just a little step forward. The journalctl output states:


    press ircode = 0x16
    scancode = 0x0067


    I understud this is the corrispondent to remote.conf mapping, but in remote.conf are mapped the ircodes to the decimal scancodes (0x0067 = 103) so 0x16 -> 103.
    Now I have to understand where is done the association of scancode 103 to KODI action ...

    Edited once, last by Virtex ().


  • The only 2 places I've looked at for amremote are the remote.conf and the kodi log - anything else I've no clue.
    But that seems to be all that's needed. Remote.conf gives you as a minimum the IR keycode and linux keycode. Checking kodi.log in real time lets you link those to key id and kodi action.
    That 103 (guessing it's an 'up' signal?) is a linux keycode - there's a list in the first post of my linked thread.
    You can change the linux keycodes in remote.conf and that will change the key id / action seen in kodi.log.

  • Thanks. I'll try, even I can't understand how to do it.
    I really can't find where or how the code 103 is declared to be "Up", so I don't know how to change this (or others) associations.


    You say it is a linux keycode. I take a look at some tables, but I didn't found all of the event used by KODI (i.e. VolumeUp is missing in the table :( )
    So I can't figure out on how to change button association or associate some unrecognized button of my remote. Pressing them the journalctl states only one line:


    Dec 11 16:05:53 LibreELEC kernel: remote: scancode is 0x0056,invalid key is 0x0000.


    I think I'm missing something obvious, something you believe is clear to me. I'm feeling very stupid :(

  • Can you paste your remote.conf into a post here - it's hard to work out what's going on without looking at it, but from what you say you'll need to change some values in there (yes, those linux keycodes).
    Plus an example of a remote button that doesn't work at all, and a remote button that works but doesn't do what you want (including what you'd like it to do in both cases).


  • Can you paste your remote.conf into a post here - it's hard to work out what's going on without looking at it, but from what you say you'll need to change some values in there (yes, those linux keycodes).
    Plus an example of a remote button that doesn't work at all, and a remote button that works but doesn't do what you want (including what you'd like it to do in both cases).


    Yes, you are right. It' is difficult to help me, also because I'm in the dark confusion :D
    Here my remote.conf in /storage/.config/


    This is when I press VOL+ in the "TV Control" area of the remote:

    Code
    1. Dec 11 17:14:49 LibreELEC kernel: remote: scancode is 0x0056,invalid key is 0x0000.


    This is when I press the "Green" button (do nothing, I'd like to toggle audio from Analog to Bluetooth and back):

    Code
    1. Dec 11 17:17:20 LibreELEC kernel: remote: press ircode = 0x0f,
    2. Dec 11 17:17:20 LibreELEC kernel: remote:
    3. Dec 11 17:17:20 LibreELEC kernel: scancode = 0x003c,maptable = 0,code:0xf00ffe01
    4. Dec 11 17:17:20 LibreELEC kernel: remote: release ircode = 0x0f,
    5. Dec 11 17:17:20 LibreELEC kernel: remote:
    6. Dec 11 17:17:20 LibreELEC kernel: scancode = 0x003c, maptable = 0,code:0x00000000


    This is when I press the "Yellow" button (highlights "System" when I'm in Home screen, switch to previous channel when I'm watching TV, I'd like to control volume globally):

    Code
    1. Dec 11 17:23:55 LibreELEC kernel: remote: press ircode = 0x10,
    2. Dec 11 17:23:55 LibreELEC kernel: remote:
    3. Dec 11 17:23:55 LibreELEC kernel: scancode = 0x006d,maptable = 0,code:0xef10fe01
    4. Dec 11 17:23:55 LibreELEC kernel: remote: release ircode = 0x10,
    5. Dec 11 17:23:55 LibreELEC kernel: remote:
    6. Dec 11 17:23:55 LibreELEC kernel: scancode = 0x006d, maptable = 0,code:0x00000000

    Edited once, last by Virtex ().

  • Okay, can you do the following...
    Fire up kodi and enable debug logging.
    Open the log on your pc (/storage/.kodi/temp/kodi.log)
    For each of the 3 buttons:
    1. Press the button.
    2. Refresh / reload the log straight away.
    3. Look at the last few lines of the log - there should be a couple of lines describing what you've done (maybe even the last 2 if you're quick and the button's not doing much).
    So you end up with something like:

    Quote


    Exit button: (that's not in the log!!!)
    Keyboard: scancode: 0x0e, sym: 0x0008, unicode: 0x0008, modifier: 0x0
    DEBUG: OnKey: backspace (0xf008) pressed, action is Back


    for each of the 3.
    Post up the results.


  • Thank for quick reply. It seems the first button is ignored. Other are unmapped or mapped to something different one can expect to be.



    VOL+ in TV area of the remote control (same situation as previous post):
    Nothing logged at all


    Green button (same situation as previous post):

    Code
    1. 18:34:56 T:548400222208   DEBUG: Keyboard: scancode: 0x3c, sym: 0x011b, unicode: 0x0000, modifier: 0x0
    2. 18:34:56 T:548400222208   DEBUG: OnKey: f2 (0xf091) pressed, action is


    Yellow button (same situation as previous post):

    Code
    1. 18:36:18 T:548400222208   DEBUG: Keyboard: scancode: 0x69, sym: 0x0114, unicode: 0x0000, modifier: 0x0
    2. 18:36:18 T:548400222208   DEBUG: OnKey: left (0xf082) pressed, action is Left
  • I found this hard to get my head around tbh, because I don't have your remote to match buttons to functions. So what I did was to make a test remote.conf using my numbers buttons, and test each keycode I didn't already know.
    The ones I know (from my remote.conf) I just added to yours.
    So here's what I came up with. It's in a different order (irrelevant, but you might want to tidy it up. There are probably mistakes in it - you'll no doubt find them. There are a whole bunch of buttons that are either not recognised at all by kodi or have no function attached to them.
    The ones that aren't recognised - you'll need to change the linux keycodes (second column); ideally change them to something you'll use with the remote, otherwise you'll have a lot of keymapping to do.


    The ones that are recognised but not mapped to an action - you can either do as above (change the linux keycode) or make a keymap within kodi to map the code kodi reads to an action - see the link in my sig for some discussion / examples if you need them.
    Then you'll need to work out which button corresponds to each command - ie you're linking the button to the code in the first column - and then swap them around to do what you want. Don't forget to add any repeats you want when you've finished (as per your original).
    If you look in my remote.conf you'll see a bunch of linux keycodes that are already linked to kodi functions - use those to replace the ones you have that don't work.
    My remote.conf:


    As I can't seem to find a way to post those here without the spacing being buggered up I've zipped them up here.
    Good luck.


  • Thanks for all the information ad for sharing your remote.conf. As you suggest, I will take an exact map of my remote's buttons pressing one by one and mapping the linux codes to the one you posted. Then I will associate the action for KODI via the add-on (I hope to be able to find and remove existent associations ...)
    This doesn't clarify to me how or where, in configuration files, linux codes are associated to keys descriptions (i.e.<VolumeUp> or <volumeplus>) used by Kodi in keymaps/remote.xml file.
    But for now it's enought :D
    Thank you very very much.
    g

  • hi virtex,


    I spent an hour last night remapping my remote as i had a similar experience to you LibreELEC.


    troggy's explanation is good, but thought i would add what worked for me.


    I couldnt find an official linux keymap explanation, but used another remote.conf to get the codes.


    Quick Summary:
    1. I found my factory code and googled that, that gave me a start remote.conf but you already seem to be there.
    2. I modified my remote.conf to set the debug_enable = 1, either edit in-situ with vi or copy to the /storage/.config directory.
    3. Make that live by typing /usr/lib/libreelec/remote-config


    i used this as a reference - IR CODE | KEY ID | COMMENT


    0x00 116#power
    0x0c 113#mute
    0x01 66#media
    0x05 67#tv
    0x09 68#web
    0x0d 69#app
    0x02 114#vol-
    0x06 122#prv
    0x0a 123#next
    0x0e 115#vol+
    0x03 102#home
    0x0f 1#return
    0x07 103#up
    0x10 105#left
    0x11 97#ok
    0x12 106#right
    0x15 119#play_pause
    0x16 128#stop
    0x44 108#down
    0x40 139#menu
    # 0x4c 53#mouse
    0x41 2#1
    0x45 3#2
    0x4d 4#3
    0x42 5#4
    0x46 6#5
    0x4e 7#6
    0x43 8#7
    0x47 9#8
    0x4f 10#9
    0x48 64#caplock
    0x49 11#0
    0x4a 14#del
    ==
    4. I then cycled through my remote buttons and using dmesg to see what the code was one at a time and then edited the remote.conf second column to match what i wanted matching the press ircode. If one didnt exist then i added it.
    eg: 0x26 was returned as the press ircode (or scan code) for pressing UP, i then edited/created a line that said 0x26 103 ;UP eg: remote_id from dmesg, key id from above, ;comment
    make sure you dont double up, but i think it takes the first or last, also add to your repeat key section at the bottom.
    5. You can then test by putting the file into .config and running /usr/lib/libreelec/remote-config


    worked a charm. this will give you a base setup. Then you can use the kodi keymap tool to just change buttons that give you windows and functions outside the list above eg: change audio, i dont think you would add all the functions.


    cheers

  • I just copied the remote.conf
    from sd card after flashing LE sd card install.
    I have a working remote except the volume button Volume UP does nothing and Volume DOWN takes me back to the beginning of a movie file during playback.
    This volume button seems to navigate through my skin back and forward using volume up and down .


    I used Keymap Editor to assign the volume up and down presses and it worked whilst i was using the GUI.
    During playback it failed with above mentioned result.


    So i can only use volume up and down before i start a movie. When i start a movie the volume up and down assigned using Keymap Editor fail to stick.


    Someone help me out on this one greatly appreciated.


    EDIT: Just tried Keymap Editor Fullscreen Video Menu and found Audio in there.
    Assigned and it works during Playback.


    Edited once, last by kostaman ().