diff options
author | James Meyer <james.meyer@operamail.com> | 2012-10-09 21:26:53 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-10-09 21:26:53 (GMT) |
commit | 4dbdf15b3b556cbf566b7a4cd77b712a4ad79991 (patch) | |
tree | ccc520d4e529f754ee186869a93f9b4428b98610 /abs/core/LinHES-system/change_channel.sh | |
parent | 009095477733a629bbbbc1151b7fc968850c6e7b (diff) | |
download | linhes_pkgbuild-4dbdf15b3b556cbf566b7a4cd77b712a4ad79991.zip linhes_pkgbuild-4dbdf15b3b556cbf566b7a4cd77b712a4ad79991.tar.gz linhes_pkgbuild-4dbdf15b3b556cbf566b7a4cd77b712a4ad79991.tar.bz2 |
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
Diffstat (limited to 'abs/core/LinHES-system/change_channel.sh')
-rwxr-xr-x | abs/core/LinHES-system/change_channel.sh | 71 |
1 files changed, 71 insertions, 0 deletions
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 |