From 32491014a9d359ab4e6ab6c778472b8140e5ac02 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Thu, 20 Oct 2011 10:31:52 -0500 Subject: linhes-config: add support for remotes in the home dir. install_functions: add the function in_kernel_support. The same change is also in the lircd runit script. --- abs/core/LinHES-config/PKGBUILD | 13 ++----- abs/core/LinHES-config/install_functions.sh | 25 ++++++++++++ abs/core/LinHES-config/mv_ir.py | 60 ++++++++++++++++++++--------- 3 files changed, 71 insertions(+), 27 deletions(-) diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index b94878b..b79a01e 100644 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -106,11 +106,11 @@ md5sums=('6259677916192a92d1adf47b276f7829' 'e36da536dd651ef182e7642337889e77' '985891a43f7c4c983eb2a362162f1a0f' '2f0b85d37b15956b3d92419c886e040c' - 'd705eb26cd25862bf0e84cc9964bd3db' + '71030af86cf678a1bef06bbb4b627a55' 'c20f73d4da5d7e15e1f3eb85c7dcb49a' '8ac1cfd2eca0f641737da0d0aca416a7' '9ae8d79f620c6d19973c55c32a921874' - '287c91018794963a52510273f08d3de7' + '17019ff68a8cf95c0b63a429d1fba094' 'ecf9e5df20683a769c4a8a8f2d65de85' 'e459ed069317bccb20351f037a9df3d2' '97de45a04f4efbd9d40d9fc0e1db1c3f' @@ -121,16 +121,11 @@ md5sums=('6259677916192a92d1adf47b276f7829' 'a225143e3df6f56d451c2875e54ddbae' '9151c74fcaf18ec4cf5e757cfdbc7017' '3d1e4a119f38cff0498bf8a67e94e4b3' -<<<<<<< HEAD - 'fb80a58b1b4cfb26aee48bc991162b40' - '5f3259afe031fda189edae41dd1458f0' -======= 'd6c2d07c58ca6484c5be8b7093b921cd' - 'e6538618f7bb5fb6b79c132803451c39' ->>>>>>> origin/testing + '5f3259afe031fda189edae41dd1458f0' '41b03fb1e0a9d9ae7588e3b813212772' 'b845de3e05c1734cce4b9ac5e8f1baaf' - '56ca5fd7d6b8d1828c95d13eb0d34de5' + 'e4ba9376d04cfad6c6877190df840d41' '5e69839659d65ddda35b8a9982dc29e9' '62b4ce94277c32f525db5c1480670acd' 'ec6a9961e4d1b53ec1240c5979efff11' diff --git a/abs/core/LinHES-config/install_functions.sh b/abs/core/LinHES-config/install_functions.sh index 8f24835..3e70e79 100755 --- a/abs/core/LinHES-config/install_functions.sh +++ b/abs/core/LinHES-config/install_functions.sh @@ -309,7 +309,31 @@ function request_dhcp(){ } +function in_kernel_support() { + #lifted from mythbuntu + #For disabling other protocols, adjust to the new location in 2.6.37. 91 + if [ -d /sys/class/rc ] + then + for file in `find /sys/class/rc/*/ -name protocols` + do + if [ "$1" = "disable" ] + then + echo "lirc" > $file + else + echo "none" > $file + for protocol in `cat $file`; do + echo "+${protocol}" > $file + done + fi + done + fi +} + + + function init_remote { + mkdir -p /var/run/lirc + echo $CMDLINE | grep -q remoteport if [ $? -eq 0 ] then @@ -327,6 +351,7 @@ function init_remote { fi fi + in_kernel_support "disable" echo $CMDLINE | grep -q remote if [ $? -eq 0 ] diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py index f3be276..5316bbc 100755 --- a/abs/core/LinHES-config/mv_ir.py +++ b/abs/core/LinHES-config/mv_ir.py @@ -80,7 +80,7 @@ def include_file( incfile,filename): f.write("\n") f.close() -def setup_ir_remote(Remotetype,templates): +def setup_ir_remote(Remotetype,templates,mythhome): logging.debug(" Setup of remote type %s",Remotetype) if Remotetype == "no_remote": mv_common.remove_service("lircd") @@ -92,22 +92,46 @@ def setup_ir_remote(Remotetype,templates): mv_common.runcmd(cmd) cmd = "mv /etc/lircrc /etc/lircrc-%s" %currenttime mv_common.runcmd(cmd) - files = templates + "/remotes/" + Remotetype + "/lircd*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - include_file("/etc/lircd.conf",filename) - files = templates + "/remotes/" + Remotetype + "/lircrc*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - include_file("/etc/lircrc",filename) + + + if os.path.isdir(mythhome+"remotes"+Remotetype): + #search home dir + files = mythhome + "/remotes/" + Remotetype + "/lircd*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircd.conf",filename) + files = mythhome + "/remotes/" + Remotetype + "/lircrc*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircrc",filename) + else: + #template dir + files = templates + "/remotes/" + Remotetype + "/lircd*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircd.conf",filename) + files = templates + "/remotes/" + Remotetype + "/lircrc*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircrc",filename) + + cmd = "chmod 755 /etc/lircrc" mv_common.runcmd(cmd) mv_common.add_service("lircd") @@ -310,7 +334,7 @@ def setup_ir(systemconfig, data_config): else: remotetype = systemconfig.get("Remotetype") - setup_ir_remote(remotetype,systemconfig.get("TEMPLATES")) + setup_ir_remote(remotetype,systemconfig.get("TEMPLATES"),data_config.MYTHHOME) setup_lirc_links(data_config.MYTHHOME) if systemconfig.get("ReceiverType"): -- cgit v0.12