Remote working for X96 TV Box (LibreELEC 8 Kodi 17)

  • by

I have just bought a Android TV box X96 and it works quiet well with Android 6. However, I decided to use it with LibreELEC 8.x including with Kodi 17.6. This is how I managed to get the remote X96 TV Box running LibreELEC 8 working..

What do I expect to?

  • Have all the button work.
  • The Power button will show Power Menu.
  • Press KD button for codec info, long press KD button for debug info.
  • Press Setup for Setting section, press App for Video section.
  • Mouse button works.

What currently my system is on?

What I have done?

There is 2 files that I need to copy and overwrite: remote.conf and keyboard.xml.

First off, I login to my TV box with SSH (root:libreelec). I then run cd /storage/.config, create or edit the remote.conf : nano /storage/.config/remote.conf with this content:

Click to show remote.conf content.

######################################################################
#  This file is configuration for each factory remote device
# 	work_mode	  0: software mode - 1: hardware mode 
#	repeat_enable	  0: disable repeat - 1: enable repeat	
#
#	factory_code      each device has it's unique factory code. 
#			  pattern:custom_code(16bit)+index_code(16bit)
#			  examble: 0xff000001 = 0xff00(custom code)  0001 (index)
#
#	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 enable
#
# 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
#
# X96 Remote Amlogic LE8 from aplaceto.win

factory_code    = 0xfe010001
work_mode       = 0
repeat_enable   = 1
release_delay   = 150
debug_enable	= 1

fn_key_scancode    = 0x00
left_key_scancode  = 0x51
right_key_scancode = 0x50
up_key_scancode    = 0x16
down_key_scancode  = 0x1a
ok_key_scancode    = 0x13

mouse_begin
    0 0x51
    1 0x50
    2 0x16
    3 0x1a
mouse_end

key_begin
	0x40 143		# 143 - KEY_WAKEUP / 116 - KEY_POWER
	0x44 21 		# KEY_Y (PlayerDebug mod in keyboard.xml) / 24-KEY_O (CodecInfo)
	0x55 168		# KEY_REWIND
	0x5a 164		# KEY_PLAYPAUSE
	0x52 128		# KEY_STOP
	0x54 208		# KEY_FASTFORWARD
	0x43 45			# KEY_X (ActivateWindow(Settings) mod in keyboard.xml)
	0x0f 30			# KEY_A (ActivateWindow(Videos) mod in keyboard.xml)
	0x10 114		# KEY_VOLUMEDOWN
	0x18 115		# KEY_VOLUMEUP
	0x11 102		# KEY_HOME
	0x19 158		# KEY_BACK
	0x16 103		# KEY_UP
	0x51 105		# KEY_LEFT
	0x13 28			# KEY_ENTER
	0x50 106		# KEY_RIGHT
	0x1a 108		# KEY_DOWN
	0x4c 139		# KEY_MENU
	0x00 63			# KEY_F5 (FN)
	0x4e 2			# KEY_1
	0x0d 3			# KEY_2
	0x0c 4			# KEY_3
	0x4a 5			# KEY_4
	0x09 6			# KEY_5
	0x08 7			# KEY_6
	0x46 8			# KEY_7
	0x05 9			# KEY_8
	0x04 10			# KEY_9
	0x41 113		# KEY_MUTE
	0x01 11			# KEY_0
	0x42 14			# KEY_BACKSPACE
key_end

repeat_key_begin
	0x16 103		# KEY_UP
	0x51 105		# KEY_LEFT
	0x13 28			# KEY_ENTER
	0x50 106		# KEY_RIGHT
	0x1a 108		# KEY_DOWN
repeat_key_end

[collapse]

Save it.

Then create keyboard.xml file in ~/.kodi/userdata/keymaps/ folder:

nano ~/.kodi/userdata/keymaps/keyboard.xml

with this content:

Click to show keyboard.xml content.

<keymap>
  <global>
    <keyboard>
      <y>PlayerProcessInfo</y>
      <y mod="longpress">PlayerDebug</y>
      <x>ActivateWindow(Settings)</x>
      <a>ActivateWindow(Videos)</a>
      <home>ActivateWindow(Home)</home>
    </keyboard>
  </global>
</keymap>

[collapse]

Save it. Then run

remotecfg /storage/.config/remote.conf
systemctl restart kodi

After that, Kodi will restart and the remote is surprisingly working very well. In my case, when I restart the box (power off then on), I have to run remotecfg command again, so I have put it in autostart.sh file to make it run that command on every boot.

Enjoy, cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.