[Android Stick & Console AMLogic based Computers] r0nmlt:
I flashed my X96 with Aidan's ROM and applied his rooting method to obtain ROOT with Magisk. This all works flawlessly with this image version:

03.+[v8]+Aidan's+ROM+[S905X]+[ATV+9]+(RTL+QCA9377++LTM8830)

Like many of you I have been having issues with the IR remote control. The USB remote and the Android Remote work without any problems out of the box.

When trying to come to the source of the issue I renamed the remote.tab files in /vendor/etc to remote.tab1.backup so that these are not loaded at bootup and therefore dmesg would give me the IR codes for my remote. Note /vendor is mounted as read only. You have to issue a

mount -o remount,rw /dev/block/vendor

to be able to modify/delete/rename the files.

Surprisingly the remote started to work thenafter. Parsing through the dmesg I came over this:

[ 2.642068] meson-remote: Driver init
[ 2.645802] meson-remote: remote_probe
[ 2.649456] meson-remote c8100580.rc: protocol = 0x1
[ 2.654530] meson-remote c8100580.rc: don't find the node <led_blink>
[ 2.661078] meson-remote c8100580.rc: led_blink = 0
[ 2.666093] meson-remote c8100580.rc: don't find the node <led_blink_frq>
[ 2.672980] meson-remote c8100580.rc: led_blink_frq = 100
[ 2.678610] meson-remote c8100580.rc: platform_data irq =39
[ 2.684306] meson-remote c8100580.rc: custom_number = 5
[ 2.689646] meson-remote c8100580.rc: ptable->map_size = 27
[ 2.695320] meson-remote c8100580.rc: ptable->custom_name = amlogic-remote-1
[ 2.702484] meson-remote c8100580.rc: ptable->custom_code = 0xff00
[ 2.708774] meson-remote c8100580.rc: ptable->release_delay = 80
[ 2.714935] meson-remote c8100580.rc: ptable->map_size = 23
[ 2.720591] meson-remote c8100580.rc: ptable->custom_name = amlogic-remote-2
[ 2.727747] meson-remote c8100580.rc: ptable->custom_code = 0x4040
[ 2.734045] meson-remote c8100580.rc: ptable->release_delay = 80
[ 2.740190] meson-remote c8100580.rc: ptable->map_size = 25
[ 2.745863] meson-remote c8100580.rc: ptable->custom_name = amlogic-remote-3
[ 2.753020] meson-remote c8100580.rc: ptable->custom_code = 0x7f80
[ 2.759316] meson-remote c8100580.rc: ptable->release_delay = 80
[ 2.765453] meson-remote c8100580.rc: ptable->map_size = 29
[ 2.771131] meson-remote c8100580.rc: ptable->custom_name = amlogic-remote-4
[ 2.778291] meson-remote c8100580.rc: ptable->custom_code = 0xfe01
[ 2.784587] meson-remote c8100580.rc: ptable->release_delay = 80
[ 2.790722] meson-remote c8100580.rc: ptable->map_size = 11
[ 2.796404] meson-remote c8100580.rc: ptable->custom_name = amlogic-remote-5
[ 2.803563] meson-remote c8100580.rc: ptable->custom_code = 0x4cb3
[ 2.809856] meson-remote c8100580.rc: ptable->release_delay = 80
[ 2.815993] meson-remote c8100580.rc: default protocol = 0x1 and id = 0
[ 2.822711] meson-remote c8100580.rc: reg=0x0, val=0x1f40190
[ 2.828487] meson-remote c8100580.rc: reg=0x4, val=0x12c00c8
[ 2.834267] meson-remote c8100580.rc: reg=0x8, val=0x960050
[ 2.839961] meson-remote c8100580.rc: reg=0xc, val=0x480028
[ 2.845652] meson-remote c8100580.rc: reg=0x10, val=0x70fa0013
[ 2.851603] meson-remote c8100580.rc: reg=0x18, val=0x8616800
[ 2.857468] meson-remote c8100580.rc: reg=0x1c, val=0x9f00
[ 2.863074] meson-remote c8100580.rc: reg=0x20, val=0x0
[ 2.868422] meson-remote c8100580.rc: reg=0x24, val=0x0
[ 2.873769] meson-remote c8100580.rc: reg=0x28, val=0x0
[ 2.879729] input: aml_keypad as /devices/platform/c8100580.rc/input/input1
[ 2.886779] meson-remote: IR XMP protocol handler initialized

This led me to think that there must be a set of remote mappings in the kernel that are loaded by default on bootup.

Using Ricky's customisation tool I unpacked the img to level 2 and in the folder /dtb there is the file dtb_1 which actually loads a set of default remote mappings:

rc@c8100580 {
compatible = "amlogic, aml_remote";
dev_name = "meson-remote";
reg = <0xc8100580 0x44 0xc8100480 0x20>;
status = "okay";
protocol = <0x1>;
interrupts = <0x0 0xc4 0x1>;
pinctrl-names = "default";
pinctrl-0 = <0x1e>;
map = <0x1f>;
max_frame_time = <0xc8>;
phandle = <0xbc>;
};

custom_maps {
mapnum = <0x5>;
map0 = <0x20>;
map1 = <0x21>;
map2 = <0x22>;
map3 = <0x23>;
map4 = <0x24>;
phandle = <0x1f>;

map_0 {
mapname = "amlogic-remote-1";
customcode = <0xff00>;
release_delay = <0x50>;
size = <0x1b>;
keymap = <0x590074 0x190071 0x130073 0x170072 0x8007a 0xb007b 0x180046 0xd0066 0x5009e 0x60067 0x5a0069 0x1a0061 0x1b006a 0x16006c 0x45007d 0x520002 0x500003 0x100004 0x560005 0x540006 0x140007 0x4e0008 0x4c0009 0xc000a 0xf000b 0x22007f 0x51000e>;
phandle = <0x20>;
};

map_1 {
mapname = "amlogic-remote-2";
customcode = <0x4040>;
release_delay = <0x50>;
fn_key_scancode = <0x47>;
fn_key_scancode_other = <0x46>;
cursor_left_scancode = <0x10>;
cursor_right_scancode = <0x11>;
cursor_up_scancode = <0xb>;
cursor_down_scancode = <0xe>;
cursor_ok_scancode = <0xd>;
size = <0x17>;
keymap = <0xb0067 0xe006c 0x100069 0x11006a 0xd0061 0x4d0074 0x1a0066 0x42009e 0x180073 0x170072 0x430071 0xc000e 0x10002 0x20003 0x30004 0x40005 0x50006 0x60007 0x70008 0x80009 0x9000a 0xb 0x4500d9>;
phandle = <0x21>;
};

map_2 {
mapname = "amlogic-remote-3";
customcode = <0x7f80>;
release_delay = <0x50>;
size = <0x19>;
keymap = <0x260067 0x28006c 0x250069 0x27006a 0xd0061 0x510074 0x530066 0x1b009e 0x4e0073 0x560072 0x4d0071 0x44000e 0x310002 0x320003 0x330004 0x340005 0x350006 0x360007 0x370008 0x380009 0x39000a 0x30000b 0xbb00a3 0xbd00a5 0x49007f>;
phandle = <0x22>;
};

map_3 {
mapname = "amlogic-remote-4";
customcode = <0xfe01>;
release_delay = <0x50>;
size = <0x1d>;
keymap = <0x160067 0x1a006c 0x510069 0x50006a 0x130061 0x400074 0x110066 0x19009e 0x180073 0x100072 0x410071 0x42000e 0x4e0002 0xd0003 0xc0004 0x4a0005 0x90006 0x80007 0x460008 0x50009 0xb04000a 0x1000b 0x5a00a3 0x5400a5 0x520080 0x5a00a4 0xf0244 0x43008d 0x4c007f>;
phandle = <0x23>;
};

map_4 {
mapname = "amlogic-remote-5";
customcode = <0x4cb3>;
release_delay = <0x50>;
size = <0xb>;
keymap = <0xca0067 0xd2006c 0x990069 0xc1006a 0xce0061 0xdc0074 0xc50066 0x82009e 0x800073 0x810072 0x84008b>;
phandle = <0x24>;
};
};

One of these default mappings was my remote but this got me nowhere closer to identifying it.

I came across this and helped me a great deal with identifying the codes that are being received by the x96:

echo 1 > /sys/class/remote/amremote/debug_enable
dmesg | grep "meson-remote"

By default, if the remote is already programmed the codes are not issued in dmesg but with this command the codes are reported in dmesg.

Through this I was able to find what X96 actually expects:

0xbf40fe01 Power
0xbb44fe01 Kodi

0xaa55fe01 Rewind
0xa55afe01 Play/Pause
0xad52fe01 Stop
0xab54fe01 Forward

0xbc43fe01 Setup
0xf00ffe01 App
0xef10fe01 Vol-
0xe718fe01 Vol+

0xee11fe01 Home
0xe619fe01 Back

0xe916fe01 Up
0xe51afe01 Down
0xae51fe01 Left
0xaf50fe01 Right
0xec13fe01 OK

0xb34cfe01 Menu
0xff00fe01 Mouse

0xb14efe01 1
0xf20dfe01 2
0xf30cfe01 3
0xb54afe01 4
0xf609fe01 5
0xf708fe01 6
0xb946fe01 7
0xfa05fe01 8
0xfb04fe01 9
0xbe41fe01 Mute
0xfe01fe01 0
0xbd42fe01 Backspace

The end 32 bits (fe01) is the factory code while the first 32 bits are the function.

My remote.tab1 ended up looking like this:

0x40 116
0x44

0x55 121
0x5a 119
0x52 128
0x54 120

0x43
0x0f
0x10 114
0x18 115

0x11 102
0x19 15

0x16 103
0x1a 108
0x51 105
0x50 106
0x13 97

0x4c 125
0x00

0x4e 2
0x0d 3
0x0c 4
0x4a 5
0x09 6
0x08 7
0x46 8
0x05 9
0x04 10
0x41 113
0x01 11
0x42 14

as some keys are not used in this ROM.

If you are using mobile software to replicate the IR remote please note that some use MSB first whilst X96 expects LSB first. So for example IRPLUS on android need to be setup with the following codes:

[FONT=courier new]X96 sees IRPLUS
0xbf40fe01 Power 0x807F 0x02FD
0xbb44fe01 Kodi 0x807F 0x22DD

0xaa55fe01 Rewind 0x807F 0xAA55
0xa55afe01 Play/Pause 0x807F 0x5AA5
0xad52fe01 Stop 0x807F 0x4AB5
0xab54fe01 Forward 0x807F 0x2AD5

0xbc43fe01 Setup 0x807F 0xC23D
0xf00ffe01 App 0x807F 0xF00F
0xef10fe01 Vol- 0x807F 0x08F7
0xe718fe01 Vol+ 0x807F 0x18E7

0xee11fe01 Home 0x807F 0x8877
0xe619fe01 Back 0x807F 0x9867

0xe916fe01 Up 0x807F 0x6897
0xe51afe01 Down 0x807F 0x58A7
0xae51fe01 Left 0x807F 0x8A75
0xaf50fe01 Right 0x807F 0x0AF5
0xec13fe01 OK 0x807F 0xC837

0xb34cfe01 Menu 0x807F 0x32CD
0xff00fe01 Mouse 0x807F 0x00FF

0xb14efe01 1 0x807F 0x728D
0xf20dfe01 2 0x807F 0xB04F
0xf30cfe01 3 0x807F 0x30CF
0xb54afe01 4 0x807F 0x52AD
0xf609fe01 5 0x807F 0x906F
0xf708fe01 6 0x807F 0x10EF
0xb946fe01 7 0x807F 0x629D
0xfa05fe01 8 0x807F 0xA05F
0xfb04fe01 9 0x807F 0x20DF
0xbe41fe01 Mute 0x807F 0x827D
0xfe01fe01 0 0x807F 0x807F
0xbd42fe01 Backspace 0x807F 0x42BD[/FONT]

For the sake of information:

start remotecfg1 will update the keycodes without rebooting the box

/vendor/usr/keylayout/Vendor_0001_Product_0001.kl has all the keymaps relative to the keycodes.

I hope this post helps some of you in getting your remotes to work or setup a mobile app to replicate your IR remote.