I have a new TX3-Pro (S905X- Android 6) box. I run it with kszaq 7.0.2.009 version (thanks to kszaq, great job!). The only problem I had was that the remote control didn’t work at all. Also copying remote.conf from the Android /etc folder to libreelec /storage/.config didn’t help. I thought a while, that may be the device tree (dtb) was wrong for my box but this wasn’t. It was the remote.conf. It seems to me, that Android 6 uses a remote configuration different from the /system/etc/remote.conf.
After ‘googleing’ a while, I found a description from a openelec user. He build a romete.conf from scratch for a WeeTeck-Box. I tried and it works. I was able to generate a working remote.conf for my box and now may remote works perfectly. Another benefit is, I was able to do my preferred key mapping.
I’ve seen a lot of posts regarding a not working remote-control. Hopefully my post will help a little bit.
1) Peparation
Copy a remote.conf file to libreelec Configuration folder over SSH :
/storage/.config
or using Windows shares:
\\your_box_IP\Configuration
You can either use my file from the post or the file from your Android. If you use your file, take care that:
- all lines between key_begin and key_end are deleted or marked as comment (leading #)
- debug_enable = 1
#******************************************************************************************
#
# this file is configuration for each factory remote device
#
# factory_code each device has it's unique factory code.
# pattern: custom_code(16bit) + index_code(16bit)
# examble: 0xff000001 = 0xff00(custom_code) + 0001(index_code)
#
# work_mode 0 :software mode 1 :hardware mode
# repeat_enable 0 :disable repeat 1 :enable repeat
#
# release_delay unit: ms
# release will report from kernel to user layer after this period
# of time from press or repeat triggered.
#
# debug_enable 0 :debug disable 1 :debug disable
#
# SW MODE:
# bit_count how many bits in each frame
# tw_leader_act time window for leader active
# tw_bit0 time window for bit0 time.
# tw_bit1 time window for bit1 time
# tw_repeat_leader time window for repeat leader
# REG:
# reg_base_gen set value for PREG_IR_DEC_BASE_GEN
# reg_control set value for PREG_IR_DEC_CONTROL
# reg_leader_act set value for PREG_IR_DEC_LEADER_ACTIVE
# reg_leader_idle set value for PREG_IR_DEC_LEADER_IDLE
# reg_repeat_leader set value for PREG_IR_DEC_REPEAT_IDLE
# reg_bit0_time set value for PREG_IR_DEC_BIT0_TIME
#******************************************************************************************
#amlogic NEC remote
factory_code = 0x7f800001
work_mode = 0
repeat_enable = 1
repeat_delay = 130
repeat_peroid = 120
release_delay = 20
debug_enable = 1
# fn_key_scancode = 0x52 #MOUSE
# left_key_scancode = 0x25 #LEFT
# right_key_scancode = 0x27 #RIGHT
# up_key_scancode = 0x26 #UP
# down_key_scancode = 0x28 #DOWN
# ok_key_scancode = 0x0d #OK
mouse_begin
# 0 0x25 #LEFT
# 1 0x27 #RIGHT
# 2 0x26 #UP
# 3 0x28 #DOWN
mouse_end
key_begin
# 0x51 116 #Power
# 0x4d 164 #PLAYPAUSE (MUTE)
# 0x09 398 #RED
# 0x11 399 #GREEN
# 0x54 400 #YELLOW
# 0x4f 401 #BLUE
# 0x56 104 #PAGEUP (VOL-)
# 0xbd 168 #REWIND
# 0xbb 208 #FASTFORWARD
# 0x4e 109 #PAGEDOWN (VOL+)
# 0x25 105 #LEFT
# 0x27 106 #RIGHT
# 0x26 103 #UP
# 0x28 108 #DOWN
# 0x0d 28 #ENTER (OK)
# 0x53 102 #HOME
# 0x1b 1 #ESC (BACK)
# 0x49 46 #C (CONTEXTMENU)
## 0x52 nn #MOUSE (dont use this line, key is mapped in fn_key_scancode)
# 0x30 11 #No.0
# 0x31 2 #No.1
# 0x32 3 #No.2
# 0x33 4 #No.3
# 0x34 5 #No.4
# 0x35 6 #No.5
# 0x36 7 #No.6
# 0x37 8 #No.7
# 0x38 9 #No.8
# 0x39 10 #No.9
# 0x44 14 #BACKSPACE
# 0x58 23 #INFO
# 0x4d 113 #MUTE
# 0x56 114 #VOLUMEDOWN
# 0x4e 115 #VOLUMEUP
# 0x09 364 #FAVORITES
# 0x11 102 #HOME
# 0x54 158 #BACK
# 0x4f 171 #CONFIG
key_end
repeat_key_begin
repeat_key_end
Display More
2) Set Factory Code
Open the /storage/.config/remote.conf in any editor. You can also use the windows share \\your_box_IP\Configuration.
Open a SSH session to your box (I use putty for this. User root, password libreelec).
Type ‘dmesg –c’ in the ssh terminal. Ignore the message, it’s only for clearing the cache.
Press any key in your remote control and directly dmesg -c in the ssh terminal. You will get something like this:
Go to the editor with the remote.conf. You will find a line like this:
Change the factory_code with this 0xZZZZ0001 (ZZZZ is the digits you have got as 'wrong custom code is' from the ssh above).
For example if you get in the dmesg wrong custom code is 0x14fg76ad then your factory_code should be 0x76ad0001.
Save the remote.conf and type 'remotecfg remote.conf' in the shell (or reboot your box). Factory code is set.
3) Key Map
Open the remote.conf in editor and the ssh in 2nd window again. Type Type ‘dmesg –c’ in the ssh terminal and ignore the message.
Press any key in your remote control and directly dmesg -c in the ssh terminal. You will now get something like this:
If you get this, the Factory code was set correctly.
Now you can start the do the keymapping. In my remote.conf file, you’ll find the lines between key_begin and key_end likes this:
# 0xca 116 ;POWER
# 0x07 105 ;KEY_LEFT
Start with the fist line. Press the POWER button on your remote. Type dmesg -c in the ssh terminal. You will now get something like this:
Change the 1st line in the remote.conf to
0x43 116 ;POWER
This means:
- removing the leading # (line is active)
- change 0xca to 0x43 (change old/wong remote code with the correct code.)
- keep 116 (this is the linux code for POWER button).You need to do this for all lines in the file. Don’t forget to save from time to time.
Do this for all lines in the file.
If you have no corresponding button on the remote, keep the line unchanged or delete it.
If you have keys on the remote with no corresponding line in the file, you can create a new line. For this, you need to now the right linux code. In the link below, you’ll find all avalible codes. Not all of them work in Kodi, so you need to play a bit with the codes.
linux/input-event-codes.h at master · torvalds/linux · GitHub
If you set the code for all buttons on your remote, save the remote.conf and and type 'remotecfg remote.conf' in the shell (or reboot your box). Key Maping is done.
4) Mouse
If you like to use the mouse function on your remote, you have to define one key on your remote as mouse key. To get the mouse working, you also need to set the values in the upper section of the remote.conf. This are the lines you need to change. The '0x25' is the value you need to change with the value you got bavk from the ‘dmesg –c’. You also need to remove the leading '#'.
# fn_key_scancode = 0x52 #MOUSE
# left_key_scancode = 0x25 #LEFT
# right_key_scancode = 0x27 #RIGHT
# up_key_scancode = 0x26 #UP
# down_key_scancode = 0x28 #DOWN
# ok_key_scancode = 0x0d #OK
mouse_begin
# 0 0x25 #LEFT
# 1 0x27 #RIGHT
# 2 0x26 #UP
# 3 0x28 #DOWN
mouse_end
Display More
5) repeat key section
This is for keys on your remote where you like to have a repeat function if you press the key and keep it pressed. The only thing you need to do is to copy the relevant lines from the key section into the repeat_key section. I did it with the for lines for 'left', 'right', 'up', 'down'.