From 4dbdf15b3b556cbf566b7a4cd77b712a4ad79991 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 9 Oct 2012 16:26:53 -0500
Subject: LinHES-system:  set_windowmanager, change_channel - set_windowmanager
  now sets the database when default is selected. - included new
 change_channel scripts that work in conjuction with /etc/systemconfig

Instead of hardcoding the value of the remote name, it's dynamic selected from /etc/systemconfig.  The transmitter number matchs the blaster proto number.

change_channel.sh transmitter  cmd
change_channel.sh  1  12  #Change channel to 12 using transmitter 1
---
 abs/core/LinHES-system/PKGBUILD                  |  9 ++-
 abs/core/LinHES-system/change_channel.sh         | 71 ++++++++++++++++++++++++
 abs/core/LinHES-system/change_channel_wrapper.sh |  2 +
 abs/core/LinHES-system/set_windowmanager.sh      |  8 ++-
 4 files changed, 85 insertions(+), 5 deletions(-)
 create mode 100755 abs/core/LinHES-system/change_channel.sh
 create mode 100755 abs/core/LinHES-system/change_channel_wrapper.sh

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 8abecab..dc31936 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=113
+pkgrel=117
 arch=('i686' 'x86_64')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -28,7 +28,8 @@ binfiles="LinHES-start optimize_mythdb.py
  misc_status_config.py
  misc_status_info.sh
  misc_upcoming_recordings.pl
- misc_which_recorder.pl"
+ misc_which_recorder.pl
+ change_channel.sh change_channel_wrapper.sh"
 
 source=(LinHES-session
     LinHES-profile.sh $binfiles
@@ -86,7 +87,7 @@ md5sums=('5bd4938cf41b63787aa4cdfd76423e09'
          'dc0be354ce77ba2b89868fc29b942c43'
          '542e670e78d117657f93141e9689f54d'
          '41951459ea9d2b0567be521b67e6285a'
-         'ee6b9d277843e7047f46bdd83e1377ec'
+         '659c0a55b0b375c48fcd751252dd2102'
          '309638acf596ce3c790aa2bf5c7c9880'
          '962a3e9eaba2d1466251b7ab0956705d'
          '1758aed160de64abfafb28a3a8f3390e'
@@ -109,6 +110,8 @@ md5sums=('5bd4938cf41b63787aa4cdfd76423e09'
          '45f46d1f9193c8dde18e56369ec29a1e'
          'a8edbe7bc37e9932e8749d9f5f89c16f'
          '116b0f62ed4e8dd6e437930deeb6e49e'
+         'd173f98728e436a5180f56e888c2bf91'
+         'bacc813b48bafcc6fe906e5969930501'
          'eb879fee9603a05d5420d4ce8ed9e450'
          'f1870a9522c79e6b248fcbf81dec3280'
          '84492954db16740f949d795b74383189'
diff --git a/abs/core/LinHES-system/change_channel.sh b/abs/core/LinHES-system/change_channel.sh
new file mode 100755
index 0000000..819076a
--- /dev/null
+++ b/abs/core/LinHES-system/change_channel.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+# Maintained by CommandIR Support mini at commandir.com - Comments / Suggestions Welcome.
+# Modified for LinHES specifics
+echo $@ > /tmp/change_channel.log
+if [ $# -lt 2 ]
+then
+  echo "IR Control Script for LIRC V2.0
+Includes support for CommandIR transmitter selection and lockfile.
+The remote codes will be specific to the transmitter number  and matched via /etc/systemconfig
+Usage:
+$0 TRANSMITTER_NUM (CHANNEL_NUMBER | IR_COMMAND) [DELAY]
+
+Sends an IR command or sequence of numbers using REMOTE_NAME via emitter
+TRANSMITTER_NUM.  DELAY (in seconds) is waited between sending IR commands.
+
+Example:  Change to channel 123 using emitter 2 with a 0.3s pause between digits:
+$0 1 123 .3
+
+"
+  exit 1
+fi
+
+if [ $# -eq 3 ]
+then
+ DELAY=$3
+else
+ DELAY=.2
+fi
+
+. /etc/systemconfig
+
+
+LOCKFILE=/tmp/lirclock
+export PATH=/bin:/usr/bin:/usr/local/bin
+
+TRANSMITTER=$1
+#get remote name from system config
+tname="HostTransmitproto_$TRANSMITTER"
+REMOTE_NAME=${!tname}
+if [ x$REMOTE_NAME = "xnone" ]
+then
+  echo "Please define Transmitters in /etc/systemconfig"
+  exit 1
+fi
+
+cmd="$2"
+
+
+while [ -f $LOCKFILE ]
+do
+  echo "Waiting for change channel lock file..."
+  sleep .1
+done
+
+touch $LOCKFILE
+
+irsend SET_TRANSMITTERS $TRANSMITTER
+sleep .15
+case $cmd in
+    [0-9]*)
+    for digit in $(echo $2 | sed -e 's/./& /g'); do
+        irsend SEND_ONCE $REMOTE_NAME $digit
+        sleep $DELAY
+    done
+    ;;
+
+    *)
+        irsend SEND_ONCE $REMOTE_NAME $cmd
+        ;;
+esac
+rm -f /tmp/lirclock
\ No newline at end of file
diff --git a/abs/core/LinHES-system/change_channel_wrapper.sh b/abs/core/LinHES-system/change_channel_wrapper.sh
new file mode 100755
index 0000000..c84529a
--- /dev/null
+++ b/abs/core/LinHES-system/change_channel_wrapper.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/LH/bin/change_channel.sh $@ &
diff --git a/abs/core/LinHES-system/set_windowmanager.sh b/abs/core/LinHES-system/set_windowmanager.sh
index 75c4cee..b159fbf 100644
--- a/abs/core/LinHES-system/set_windowmanager.sh
+++ b/abs/core/LinHES-system/set_windowmanager.sh
@@ -22,9 +22,8 @@ function set_wm(){
 
         default)
             outmsg "default/fluxbox"
-            outline="fluxbox"
+            outline="default"
             echo "" > /etc/X11/WINDOWMANAGER
-            exit 0
             ;;
 
         enlightenment)
@@ -113,6 +112,11 @@ fi
 
 set_wm
 
+if [ x$outline = "xdefault" ]
+then
+    exit 0
+fi
+
 WM_CHECK=`echo $outline|cut -d" " -f1 |tr -dc '[:alnum:]'`
 which $WM_CHECK 2>/dev/null
 rc=$?
-- 
cgit v0.12

