Android box conflict with TV remote controller

X96Q is nice android TV box and it was supposed to breathe new life into old LG 42LD650 TV. Everything was fine until I tried to volume down TV and realized that this button is also recognized by android box as media fast forward in Youtube app. So, the solution was to make android box to ignore volume up from LG TV remote controller.

First try was to remap conflicted key with button mapper app from Google play. After button mapper app was installed on android TV box next step was to remap key. In app option “Add Buttons”, volume down on LG remote was recognized as “MEDIA_FAST_FORWARD 90” key. Adding “nothing” as defined function to this button didn’t make any change.

Fortunately, I found info that X96Q comes with root option. In AIDA64 app under Android section was written:

Android Version 10
Rooted Device Yes

So, next step was to find key mapper file and to make some changes. To access android TV box I installed adb utility on my PC:

root> dnf install android-tools

Prior anything else, developer mode should be enabled on android device to make connection possible between PC and android TV with adb command. This is simple action and in settings (about) just find “build” item and click on it several times. This will made you a developer :) and adb connection can be made:

> adb connect 192.168.1.3

In my case android TV box was on 192.168.1.3 IP address and “adb connection” will just start daemon in background. Next step was to create local directory on my Linux PC:

> cd /tmp
> mkdir x96q
> cd x96q

Changing files directly on android TV box was not possible – I couldn’t find any text editor (vi, vim, nano …) so I had to retrieve files locally, make change and send them back. Key layout files are located in /system/usr/keylayout directory and here is how to make download to local folder:

> adb pull /system/usr/keylayout

Abut 20 “.kl” files were downloaded and MEDIA_FAST_FORWARD was searched with grep command:

> grep MEDIA_FAST_FORWARD *

This keyword was found in several files but for me were only interesting “kl” files where MEDIA_FAST_FORWARD had value 90 (as it was recognized with button mapper app from the beginning of this story). Only 2 files had “key 90 MEDIA_FAST_FORWARD” line:

sunxi-ir.kl
sunxi-ir-uinput.kl

So, I simply commented this line and that was all needed to configure:

#key 90  MEDIA_FAST_FORWARD

Returning back these 2 files was a bit tricky. /system directory is placed on the “/” partition and that partition is mounted as read-only filesystem. With adb shell and root access I made remount as RW:

> adb shell
> su
> mount -o rw,remount /

Manufacturer compacted “/” partition and make usage 100%. It was impossible to upload any file or to replace it with same length file. On the other hand, on “/data” partition was plenty of room so I made /data/tmp directory and move one APK file from /system/preinstall/ to /data/tmp/. This APK files were installed anyway so moving to another location will not have effect on running system. At the end I left APK there and for now is OK. Here are steps:

> mkdir /data/tmp
> mv /system/preinstall/Amazon_Prime_Video.apk /data/tmp

This step freed up about 15MB of space and now was possible to push back changed “kl” files

> adb push sunxi-ir.kl /system/usr/keylayout/
> adb push sunxi-ir-uinput.kl /system/usr/keylayout/

After making changes, “/” partition was remount to RO (read-only) just in case:

> mount -o rw,remount /

And that’s it. After rebooting android TV box was finally ignoring volume down key from my LG TV remote controller. All in all only 2 lines were changed (actually commented) with a luck of already enabled root access on android TV box. Looks like trivial config, isn’t it :)

Leave a Comment