From 6f6af3185ab478eb4826b76fe7d9413bc6f6009b Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Thu, 5 Mar 2015 02:24:42 +0100 Subject: [PATCH] amremote: configure remote depending on device (WeTek/OpenELEC) Signed-off-by: Stephan Raue --- .../sysutils/amremote/config/openelec.conf | 13 ++++++++ .../sysutils/amremote/config/wetek.conf | 6 ++-- packages/sysutils/amremote/package.mk | 8 ++++- .../sysutils/amremote/scripts/remote-config | 30 +++++++++++++++++++ .../system.d/amlogic-remotecfg.service | 2 +- 5 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 packages/sysutils/amremote/config/openelec.conf rename projects/WeTek_Play/filesystem/etc/remote.conf => packages/sysutils/amremote/config/wetek.conf (72%) create mode 100755 packages/sysutils/amremote/scripts/remote-config diff --git a/packages/sysutils/amremote/config/openelec.conf b/packages/sysutils/amremote/config/openelec.conf new file mode 100644 index 0000000000..2fe76e9768 --- /dev/null +++ b/packages/sysutils/amremote/config/openelec.conf @@ -0,0 +1,13 @@ +# OpenELEC NEC remote + +factory_code = 0x00680001 +work_mode = 1 +repeat_enable = 1 +release_delay = 150 +debug_enable = 1 +reg_control = 0xfbe40 + +key_begin + 0xdb 116 ;POWER +key_end + diff --git a/projects/WeTek_Play/filesystem/etc/remote.conf b/packages/sysutils/amremote/config/wetek.conf similarity index 72% rename from projects/WeTek_Play/filesystem/etc/remote.conf rename to packages/sysutils/amremote/config/wetek.conf index e5b75cc07b..7543fb00bc 100644 --- a/projects/WeTek_Play/filesystem/etc/remote.conf +++ b/packages/sysutils/amremote/config/wetek.conf @@ -1,4 +1,4 @@ -# Amlogic NEC remote +# WeTek Play NEC remote factory_code = 0xbc430001 work_mode = 1 repeat_enable = 1 @@ -7,5 +7,5 @@ debug_enable = 1 reg_control = 0xfbe40 key_begin - 0xca 116 ;POWER -key_end + 0xca 116 ;POWER +key_end \ No newline at end of file diff --git a/packages/sysutils/amremote/package.mk b/packages/sysutils/amremote/package.mk index 02e4ecc7a8..9f14fd91ae 100644 --- a/packages/sysutils/amremote/package.mk +++ b/packages/sysutils/amremote/package.mk @@ -24,7 +24,7 @@ PKG_LICENSE="other" PKG_SITE="http://www.amlogic.com" PKG_URL="https://github.com/codesnake/amremote/releases/download/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" +PKG_DEPENDS_TARGET="toolchain usbutils" PKG_PRIORITY="optional" PKG_SECTION="sysutils/remote" PKG_SHORTDESC="amremote - IR remote configuration utility for Amlogic-based devices" @@ -36,6 +36,12 @@ PKG_AUTORECONF="no" makeinstall_target() { mkdir -p $INSTALL/usr/bin cp remotecfg $INSTALL/usr/bin + + mkdir -p $INSTALL/usr/lib/openelec + cp $PKG_DIR/scripts/* $INSTALL/usr/lib/openelec + + mkdir -p $INSTALL/etc/amremote + cp $PKG_DIR/config/*.conf $INSTALL/etc/amremote } post_install() { diff --git a/packages/sysutils/amremote/scripts/remote-config b/packages/sysutils/amremote/scripts/remote-config new file mode 100755 index 0000000000..bddc60c51a --- /dev/null +++ b/packages/sysutils/amremote/scripts/remote-config @@ -0,0 +1,30 @@ +#!/bin/sh +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +# check the Security chip if we run on a WeTek device + lsusb -d 096e:0006 &> /dev/null + LSUSB_RET=$? + +if [ -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 diff --git a/packages/sysutils/amremote/system.d/amlogic-remotecfg.service b/packages/sysutils/amremote/system.d/amlogic-remotecfg.service index 1b00383524..26e9b2c985 100644 --- a/packages/sysutils/amremote/system.d/amlogic-remotecfg.service +++ b/packages/sysutils/amremote/system.d/amlogic-remotecfg.service @@ -3,7 +3,7 @@ Description=Amlogic IR remote support [Service] Type=oneshot -ExecStart=/bin/sh -c '[ -f /storage/.config/remote.conf ] && /usr/bin/remotecfg /storage/.config/remote.conf || /usr/bin/remotecfg /etc/remote.conf' +ExecStart=/usr/lib/openelec/remote-config RemainAfterExit=yes [Install]