Table of Contents

Walk through: Create an Amlogic remote.conf file

This step-by-step tutorial shows how to create a remote.conf file for a Tanix Factory Remote using a Windows PC, SSH (Putty), and a Home Area Network (HAN).

These instructions easily can be adapted for other Operating Systems.


Requirements

Ensure the PC and Android Set-top Box are both hardwired too and receive their network settings automatically from, the home router or modem


Preparations

In CoreELEC:

Use the CoreELEC configuration addon to access the SSH settings.

Enable SSH

Find the IP of the device in Settings/System Information/Summary:


SSH into device

systemctl stop kodi
systemctl stop eventlircd
ir-keytable -u

##############################################
#                  CoreELEC                  #
#            https://coreelec.org            #
##############################################

CoreELEC (official): 19.2-Matrix_rc2 (Amlogic-ng.arm)
CoreELEC:~ # systemctl stop kodi
CoreELEC:~ # systemctl stop eventlircd
CoreELEC:~ # ir-keytable -u
Protocols changed to irmp
Waiting for IRMP decode event. Please, press CTRL-C to abort.

Received IRMP code: remotewakeup='0xb24d4040', decode_type='0x0', remotewakeupmask='0xffffffff'
Received IRMP code: remotewakeup='0xb24d4040', decode_type='0x0', remotewakeupmask='0xffffffff'

Legend

Received IRMP code: remotewakeup='0xb24d4040', decode_type='0x0', remotewakeupmask='0xffffffff'

The code is structured as follows:

0x AA BB CCCC
0x b2 4d 4040

On soc Amlogic only sections 0x, BB and CCCC are needed for the remote.conf file.

AA is ignored.

0xBB becomes the key_code.

CCCC is the factory_code.

#	factory_code      each device has it's unique factory code.
#			  pattern: custom_code(16bit)+index_code(16bit)
#			  example: 0xff000001 = 0xff00(custom cod) _ 0001 (index)

Now that the factory code has been found, it is time to link the key_code for each key to the corresponding event_code, which can be found in input-event-codes.sh.

#define KEY_POWER		116	/* SC System Power Down */

Putting it all together

IRMP_code factory_code key_code event_code key_function
0xb24d4040 0x40400001
0xb24d4040 0x4d 116 KEY_POWER

Proceed for each key on the remote.

IRPM_code key_code event_code key_function
0xb24d4040 0x4d 116 KEY_POWER
0xbc434040 0x43 113 KEY_MUTE
0xe8174040 0x17 114 KEY_VOLUMEDOWN
0xe7184040 0x18 115 KEY_VOLUMEUP
0xf40b4040 0x0b 103 KEY_UP
0xf10e4040 0x0e 108 KEY_DOWN
0xef104040 0x10 105 KEY_LEFT
0xee114040 0x11 105 KEY_RIGHT
0xf20d4040 0x0d 97 KEY_ENTER
0xe51a4040 0x1a 102 KEY_HOME
0xba454040 0x45 125 KEY_MENU
0xbd424040 0x42 1 KEY_BACK
0xfe014040 0x01 2 KEY_1
0xfd024040 0x02 3 KEY_2
0xfc034040 0x03 4 KEY_3
0xfb044040 0x04 5 KEY_4
0xfa054040 0x05 6 KEY_5
0xf9064040 0x06 7 KEY_6
0xf8074040 0x07 8 KEY_7
0xf7084040 0x08 9 KEY_8
0xf6094040 0x09 10 KEY_9
0xff004040 0x00 11 KEY_0
0xb8474040 0x47 fn_key_scancode BTN_MOUSE
0xf30c4040 0x0c 24 KEY_O ( <x] Kodi Player Process Info)

remote.conf structure

Amlogic specifies following file structure:

One file: remote.conf

The factory code is inserted as factory_code = 0xCCCC0001

Mouse events are entered between mouse_begin and mouse_end

Key events are entered between key_begin and key_end

Repeat key events are entered between repeat_key_begin and repeat_key_end


Entering the data in remote.conf

Write the remote.conf file in a Windows text editor with RAW support such as vim for Windows.


remote.conf

Bellow is the resulting remote.conf file:

#
# *********************************************************************************************************
#       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 cod)  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 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 * Tanix Factory Remote for all TX devices
#

factory_code    = 0x40400001

work_mode       = 0
repeat_enable   = 1
repeat_delay    = 130
repeat_peroid   = 120
release_delay   = 20
debug_enable    = 1

fn_key_scancode    = 0x47     # MOUSE
left_key_scancode  = 0x10     # KEY_LEFT
right_key_scancode = 0x11     # KEY_RIGHT
up_key_scancode    = 0x0b     # KEY_UP
down_key_scancode  = 0x0e     # KEY_DOWN
ok_key_scancode    = 0x0d     # KEY_ENTER

mouse_begin
		0 0x10     # KEY_LEFT
		1 0x11     # KEY_RIGHT
		2 0x0b     # KEY_UP
		3 0x0e     # KEY_DOWN
mouse_end

key_begin

    0x4d 116 # KEY_POWER
    0x43 113 # KEY_MUTE

    0x17 114 # KEY_VOLUMEDOWN
    0x18 115 # KEY-VOLUMEUP

    0x0b 103 # KEY_UP
    0x0e 108 # KEY_DOWN
    0x10 105 # KEY_LEFT
    0x11 106 # KEY_RIGHT
    0x0d 97  # KEY_ENTER

    0x1a 102 # KEY_HOME
    0x45 125 # KEY_MENU
    0x42 1   # KEY_BACK

    0x01 2   # KEY_1 
    0x02 3   # KEY_2
    0x03 4   # KEY_3
    0x04 5   # KEY_4
    0x05 6   # KEY_5
    0x06 7   # KEY_6
    0x07 8   # KEY_7
    0x08 9   # KEY_8
    0x09 10  # KEY_9
    0x00 11  # KEY_0

#    0x00 xx  # BTN_MOUSE IS MAPPED IN fn_key_scancode

    0x0c 24  # KEY_O <X] (PLAYER PROCESS INFO)

key_end

repeat_key_begin

    0x17 114 # KEY_VOLUMEDOWN
    0x18 115 # KEY-VOLUMEUP

    0x0b 103 # KEY_UP
    0x0e 108 # KEY_DOWN
    0x10 105 # KEY_LEFT
    0x11 106 # KEY_RIGHT

repeat_key_end