codesnake / OpenELEC.tv

Port of the OpenELEC for Amlogic-based TV boxes
http://openelec.tv
62 stars 70 forks source link

OpenELEC-Amlogic.M8.arm-6.0.3.tar does not pick up custom remote.conf at start #153

Open Teppopups opened 7 years ago

Teppopups commented 7 years ago

Hi,

Problem:

After upgrading the M8N from 5.0.3 to 6.0.3 (OpenELEC-Amlogic.M8.arm-6.0.3.tar) it stopped to load custom remote.conf file at start.

At the same time I can load it manually using: /usr/bin/remotecfg /storage/.config/remote.conf

Cause:

I found that this is because of wrong configuration file /usr/lib/openelec/remote-config, which is loading by amlogic-remotecfg.service at start. It checks the standard built-in remote.conf file first and loads it, not even checking for custom one. It will never load custom remote.conf file as the standard file always exist.

... if [ -f /etc/amremote/remote.conf ]; then /usr/bin/remotecfg /etc/amremote/remote.conf elif [ -f /storage/.config/remote.conf ]; then /usr/bin/remotecfg /storage/.config/remote.conf elif [ "$LSUSB_RET" = 0 ]; then /usr/bin/remotecfg /etc/amremote/wetek.conf elif [ "$LSUSB_RET" = 1 ]; then /usr/bin/remotecfg /etc/amremote/openelec.conf fi

Reference: https://github.com/OpenELEC/OpenELEC.tv/blob/master/packages/sysutils/amremote/system.d/amlogic-remotecfg.service

Solution:

We need to modify the /usr/lib/openelec/remote-config, but the file system where it's located is Read-only, so we cannot do that directly.

We have to create another custom amlogic-remotecfg.service in /storage/.config/system.d (if I remember correctly), and point it to another custom remote-config in /storage/.config/ with correct command order along with your custom remote.conf file:

/storage/.config/system.d/amlogic-remotecfg.service:

[Unit] Description=Amlogic IR remote support [Service] Type=oneshot ExecStart=/storage/.config/remote-config RemainAfterExit=yes [Install] WantedBy=basic.target

/storage/.config/remote-config

... if [ -f /storage/.config/remote.conf ]; then /usr/bin/remotecfg /storage/.config/remote.conf elif [ -f /etc/amremote/remote.conf ]; then /usr/bin/remotecfg /etc/amremote/remote.conf elif [ "$LSUSB_RET" = 0 ]; then /usr/bin/remotecfg /etc/amremote/wetek.conf elif [ "$LSUSB_RET" = 1 ]; then /usr/bin/remotecfg /etc/amremote/openelec.conf fi

That's it.