User:AndrewAllison

From MythTV Official Wiki
Jump to: navigation, search

Hardware

Asus M4A77TD motherboard
AMD Phenom II X4 965 Processor
nVidia Corporation NV44 [GeForce 6200 TurboCache
Hauppaupe HVR-950
Hauppauge 150
Hauppauge 500 
Pinnacle Systems, Inc. Remote Kit Infrared Transceiver

Standard Files

Because these files are spread out everywhere, I usually get a mismatched set :-(
/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
key_buffer = 16M
table_cache = 128
sort_buffer_size = 2M
myisam_sort_buffer_size = 8M
query_cache_size = 16M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


/etc/lirc/lircd.conf
#
#
# contributed by Andrew Allison
#
# brand:         PCTV (Hauppauge) USB MCE Remote
# model no. of remote control: RRS9002-8601FC
# devices being controlled by this remote: Pinnacle IR Receiver / Blaster
#
begin remote
 name  pctv.usb.remote
 bits           13
 flags RC6|CONST_LENGTH
 eps            30
 aeps          100
 header       2694   840
 one           471   413
 zero          471   413
 pre_data_bits   24
 pre_data       0x1BFF83
 gap          105342
 min_repeat      2 
#  suppress_repeat 2
#  uncomment to suppress unwanted repeats
 toggle_bit_mask 0x8000
 rc6_mask    0x100000000
     begin codes
         KEY_POWER                0x13
         KEY_PAUSE                0x037FF07BE7
         KEY_RECORD               0x037FF07BE8
         KEY_STOP                 0x037FF07BE6
         KEY_REWIND               0x037FF07BEA
         KEY_PLAY                 0x037FF07BE9
         KEY_FORWARD              0x037FF07BEB
         KEY_FRAMEBACK            0x037FF07BE4
         KEY_FRAMEFORWARD         0x037FF07BE5
         KEY_BACK                 0x1BDC
         KEY_INFO                 0x1BF0
         KEY_LEFT                 0x1BDF
         KEY_RIGHT                0x1BDE
         KEY_OK                   0x037FF07BDD
         KEY_UP                   0x1BE1
         KEY_DOWN                 0x1BE0
         KEY_VOLUMEUP             0x037FF07BEF
         KEY_VOLUMEDOWN           0x037FF07BEE
         KEY_RESSTART             0x1BF2
         KEY_CHANNELDOWN          0x037FF07BEC
         KEY_CHANNELUP            0x037FF07BED
         KEY_MUTE                 0x1BF1
         KEY_SWITCHVIDEOMODE      0x1BB7
         KEY_EPG                  0x1BD9
         KEY_TV                   0x1BDA
         KEY_VIDEO                0x1BDB
         KEY_1                    0x1BFE
         KEY_2                    0x1BFD
         KEY_3                    0x1BFC
         KEY_4                    0x1BFB
         KEY_5                    0x1BFA
         KEY_6                    0x1BF9
         KEY_7                    0x1BF8
         KEY_8                    0x1BF7
         KEY_9                    0x1BF6
         KEY_0                    0x1BFF
         KEY_CLEAR                0x037FF07BF5
         KEY_ENTER                0x037FF07BF4
         KEY_RED                  0x037FF07BA4
         KEY_GREEN                0x037FF07BA3
         KEY_YELLOW               0x037FF07BA2
         KEY_BLUE                 0x037FF07BA1
         KEY_NUMERIC_STAR         0x037FF07BE2
         KEY_NUMERIC_POUND        0x037FF07BE3
         KEY_SUBTITLE             0x037FF07BA5
     end codes
end remote


/home/mythtv/.lircrc


# lircrc config file for the Microsoft Media Center Edition Remote, model 1039
#
# @url       $URL$
# @date      $Date: 2008-03-08 23:30:22 -0500 (Sat, 08 Mar 2008) $
# @version   $Revision: 16474 $
# @author    $Author: kormoc $
#
# This file is intended to complement the lircd.conf.mceusb file included with
# lirc 0.8 and above.
#
# Save this file in ~/.mythtv/lircrc
#
# You will also need to make a few changes to the MythTV key bindings and jump
# points as follows.
#
# Jump Points:
#
#   TV Recording Playback:      Alt+R
#   Program Guide:      Alt+G
#   Live TV:    Alt+P
#   MythVideo -> The MythVideo default view:    Alt+V
#   Main Menu:  Alt+Home
#
# Key Bindings:
#
#   TV Playback -> CHANNELDOWN:  Down,PgDown
#   TV Playback -> CHANNELUP:    Up,PgUp
#   TV Playback -> JUMPRWND:     Shift+PgUp
#   TV Playback -> JUMPFFWD:     Shift+PgDown
#
#
# Program Navigation
#
#
begin
   prog   = mythtv
   button = Home
   config = Alt+Home
   repeat = 2
end
begin
    prog   = mythtv
    button = RecTV
    config = Alt+R
   repeat = 2
end
begin
    prog   = mythtv
    button = KEY_EPG
    config = Alt+G
   repeat = 2
end
begin
    prog   = mythtv
    button = KEY_TV
    config = Alt+P
   repeat = 2
end
begin
    prog   = mythtv
    button = KEY_VIDEO
    config = Alt+V
   repeat = 2
end
#
# Menu Navigation
#
begin
   prog   = mythtv
   button = KEY_BACK
   config = Esc
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_OK
   config = Space
   repeat = 2
end
begin
   prog   = mythtv
   button = More
   config = I
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_LEFT
   config = Left
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_RIGHT
   config = Right
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_UP
   config = Up
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_DOWN
   config = Down
   repeat = 2
end
# TV Control
#
begin
   prog   = mythtv
   button = KEY_VOLUMEDOWN
   config = F10
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_VOLUMEUP
   config = F11
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_MUTE
   config = F9
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_CHANNELDOWN
   config = PgDown
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_CHANNELUP
   config = PgUp
   repeat = 2
end
#
# Video Navigation
#
begin
  prog   = mythtv
  button = KEY_PLAY
  config = P
   repeat = 2
end
begin
  prog   = mythtv
  button = KEY_PAUSE
  config = P
  repeat = 2
end
begin
  prog   = mythtv
  button = KEY_STOP
  config = Esc
   repeat = 2
end
begin
  prog   = mythtv
  button = KEY_FORWARD
  config = >
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_REWIND
   config = <
   repeat = 2
end
begin
  prog   = mythtv
  button = KEY_FRAMEBACK
  config = Q
  repeat = 2
end
begin
   prog   = mythtv
   button = KEY_FRAMEFORWARD
   config = Z
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_RECORD
   config = R
   repeat = 2
end
#
#
# Miscellaneous
#
#
# M for Menu
begin
   prog   = mythtv
   button = KEY_INFO
   config = M
   repeat = 2
end
begin
   prog   = mythtv
   button = Hash
   config = M
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_CLEAR
   config = Esc
   repeat = 2
end
#begin
#    prog   = mythtv
#    button = Enter
#    config = Space
#end
#
# Numbers
#
begin
   prog   = mythtv
   button = KEY_0
   config = 0
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_1
   config = 1
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_2
   config = 2
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_3
   config = 3
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_4
   config = 4
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_5
   config = 5
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_6
   config = 6
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_7
   config = 7
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_8
   config = 8
   repeat = 2
end
begin
   prog   = mythtv
   button = KEY_9
   config = 9
   repeat = 2
end
begin
   remote = pctv.usb.remote
   prog = irexec
   button = KEY_BLUE
   config = /home/mythtv/start_myth.sh &
   repeat = 0
   delay = 0
end


My Backup script

date= date -I
nice -n 19 mysqldump -u  --password= --extended-insert --no-create-db --add-drop-table --database mythconverg  > `date -I`_myth_backup_data.sql
nice -n 19 mysqldump -u  --password= --extended-insert --database mythconverg  > `date -I`_myth_complete_backup_data.sql
nice -n 19 gzip `date -I`_myth_backup_data.sql
nice -n 19 gzip `date -I`_myth_complete_backup_data.sql
chmod 777 `date -I`_myth_backup_data.sql.gz
chmod 777 `date -I`_myth_complete_backup_data.sql.gz
mv `date -I`_myth_backup_data.sql.gz /storage1/Database/ 
mv `date -I`_myth_complete_backup_data.sql.gz /storage1/Database/

My Restore

mysql -u root -p < myth_complete_backup_data.sql

Setting Atrpms.repo

[atrpms]
name=Fedora Core $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/f$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
enabled=1
gpgcheck=1

Setting up Autologin

/etc/gdm/custom
# GDM configuration storage
[daemon]
TimedLoginEnable=true
TimedLogin=mythtv
TimedLoginDelay=5
[security]
[xdmcp]
[greeter]
[chooser]
[debug]

Crontab


MAILTO="andrew.allison@gmail.com"
#min hour day month Sun=0 Sat=6
1    3    *   *     *  /home/mythtv/backup-mysql.sh
1    4    1   *     *  /home/mythtv/optimize-myth-db.sh
1    1    16  *     *  /storage2/mirror-canvec.sh

/etc/rc.local


#!/bin/sh
mount /dev/sdc1 /storage1
mount /dev/sdd1 /storage2
mount /dev/sdb1 /storage3

modprobe -r ir_rc6_decoder
modprobe -r rc_rc6_mce
modprobe -r ir_rc5_decoder

echo lirc > /sys/class/rc/rc0/protocols

#command v4l2-ctl -d /dev/video3 --list-ctrl
v4l2-ctl -d /dev/video3 --set-ctrl volume=24

/bin/mythbackend --daemon  --loglevel info
/bin/mythjobqueue --daemon --loglevel info


Mythtv->Setup-General

LIRC daemon socket    /var/run/lirc/lircd

Notes on Fedora 15 Install

Section "Device"
       Identifier  "Videocard0"
       Driver      "nouveau"
EndSection
Section "Monitor"
      Identifier   "TV"
      HorizSync    30-50
      VertRefresh  60.0
EndSection
Section "Screen"
      Identifier   "Screen0"
      Device       "Videocard0"
      Monitor      "TV"
      DefaultDepth 24
EndSection

Screen Lockup / Shuddering Video

Add to grub boot the system with the noapic kernel parameter. 
nouveau.tv_norm=NTSC-M noapic


Using the default nouveau video driver GeForce 6200 SVideo

        Add boot option to grub.conf nouveau.tv_norm=NTSC-M 

kernel /vmlinuz-2.6.40.6-0.fc15.x86_64 ro root=UUID=4b78f456-a78b-4f2b-b4b6-392bd5a2b215 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us nouveau.tv_norm=NTSC-M quiet initrd /initramfs-2.6.40.6-0.fc15.x86_64.img

Installing MS Core Fonts

yum install rpm-build cabextract ttmkfdir wget
wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
rpmbuild -ba msttcorefonts-2.0-1.spec
yum install --nogpgcheck /root/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm


Useful Links

http://blog.grantgoodyear.org/2010_05_01_archive.html

Notes

Crash in MythNews

2012-01-01 10:26:35.859302 I  MythUIWebBrowser: Loading css from - file:///usr/local/share/mythtv/themes/default/htmls/mythbrowser.css
2012-01-01 10:26:35.866052 I  MythUIWebBrowser: enabling plugins
** (process:7422): DEBUG: NP_Initialize
** (process:7422): DEBUG: NP_Initialize succeeded
** (process:7422): DEBUG: NP_Initialize
** (process:7422): DEBUG: NP_Initialize succeeded
/builddir/build/BUILD/icedtea-web-1.0.6/plugin/icedteanp/IcedTeaNPPlugin.cc:2016: thread 0x2793a60: Error: Invalid plugin function table.
** (<unknown>:7422): DEBUG: NP_Initialize
** (<unknown>:7422): DEBUG: NP_Initialize succeeded
** (<unknown>:7422): DEBUG: NP_Initialize
** (<unknown>:7422): DEBUG: NP_Initialize succeeded
Solution
   Remove all files in .mythtv/MythNews
SQL Profiling script
Please remember to put the password for your admin user at the point marked XXX.
The script waits for the SQL load to get over 75% then starts to dump
a file called sqlload'timestamp' to your Desktop, it stops when the
load falls back below 75%.
If a few users could run it for testing it would be useful, it ONLY
starts to dump when load is > 75%
#!/bin/sh
FILENOW=`date +%a"."%b%d"."%H":"%M":"%S`
COUNT="0"
cd ~/Desktop
LOADOUTPUT="sqlload@""$FILENOW"
touch "$LOADOUTPUT"
SQLLOAD="0"
while [ "$SQLLOAD" -le 75 ] ; do
SQLLOAD=`top -b -n 1 | grep mysqld | awk -F " " '{ print $9 }'`
done;
while [ "$SQLLOAD" -ge 75 ]; do
mysql -uroot -pXXXADDYOURPASSWORDHEREXXX -e"SHOW full processlist;" >>
"$LOADOUTPUT"
NEWNOW=`date +%a"."%b%d"."%H":"%M":"%S`
echo -e "**************\n\n\n$NEWNOW\n\n\n Next Pass" >> "$LOADOUTPUT"
COUNT=`echo "$COUNT + 1" | bc`
echo "Count $COUNT  sqlload $SQLLOAD"
sleep 1
SQLLOAD=`top -b -n 1 | grep mysqld | awk -F " " '{ print $9 }'`
done
echo "Glitch finished at $NEWNOW, end of Run" >> "$LOADOUTPUT"

_______________________________________________

UDEV

KERNEL=="video[0-9]", DRIVERS=="ivtv", ATTRS{subsystem_device}=="0x8801",  SYMLINK+="PVR150-0"
KERNEL=="video[0-9]", DRIVERS=="ivtv", ATTRS{subsystem_device}=="0xe807",  SYMLINK+="PVR150-1"
KERNEL=="video[0-9]", DRIVERS=="ivtv", ATTRS{subsystem_device}=="0xe817",  SYMLINK+="PVR150-2"
DRIVERS=="em28xx", SYMLINK+="HVR950-0"
#KERNEL=="dvb0.frontend0", DRIVERS=="em28xx", SYMLINK+="HVR950-0"
#KERNEL=="video[0-9]", DRIVERS=="cx18", SYMLINK+="HVR1600-1"
#KERNEL=="video[0-9]*", DRIVERS=="cx18", ATTRS{subsystem_device}=="0x8389",  SYMLINK+="HVR1600-1"


Fedora 16 Service Configuration

chkconfig --list
systemctl enable mysqld.service
systemctl enable mythbackend.service
systemctl enable mythjobqueue.service

ssmtp

Fedora 19 requires the TLS_CA_File option
root=email address
MailHub=smtp.gmail.com:587
AuthUser=email address
AuthPass=password
UseSTARTTLS=YES
UseTLS=YES
FromLineOverride=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

Note about HVR2250 from mailing list

The modules for the HVR-2250 card work properly only when loaded in the 
correct stack order. Unfortunately, due to some weird set of conditions, 
that does not happen. I had some recordings where the sound is very 
'muddy' and muffled. I have not had that since I started forcing the 
correct load order: that is, *I* do it, by a script.
One weird bit is that you have to 'unstack' the modules in the correct 
(wrong) order.
Here is the chunk of script from my rc.local file which gets called at 
the end of bootup. 
# These steps are required to install the modules in the correct order
modprobe -r tda18271
modprobe -r s5h1411
modprobe -r saa7164
modprobe -r s5h1411
modprobe -r tda18271
modprobe -r s5h1411
echo "  Ignore FATAL error messages above if next lines are empty"
lsmod | grep tad18271
lsmod | grep s5h1411
lsmod | grep saa7164
echo "  No output means modules were properly unloaded"
modprobe  tda18271
modprobe  s5h1411
modprobe  saa7164
echo "  Modules re-loaded in proper order"
The *ANALOG* module is the saa7164 and must be last.
THEN and only THEN, you can restart myth.
So the script kills any existing myth programs, and restarts the service:
result=`ps -ae | grep mythbackend`
out=`echo $result | awk '{ print $4}'`
if [ "$out" = "mythbackend" ] ; then
     killall mythbackend
     killall mythlogserver
     killall mythcommflag
     killall mythfrontend
     rm -f /run/mythtv/backend.pid
     echo "Killed existing processes"
#    echo "Now ready to start mythbackend, with 
/lib/systemd/system/mythbackend.service;"
fi
#/usr/bin/systemctl status mysqld.service
/usr/bin/systemctl start mythbackend.service
/usr/bin/systemctl status mythbackend.service
Geoff


Antenna Rotor Script

I use this rotor controller with my Tivo, and I've created an lircd.conf file for this. I guess I never sent it in. It's attached. irrecord did 
afairly good job, but I looked up the specs for the chip and made the values accurate. I also added a command called noop which does nothing, but will
turn it on if it isn't. It acts as a discrete on.
I also wrote a bash script, attached which can take advantage of every function the controller is capable of. for example rotor -c 22 turns to the 
direction stored for channel 22. Hopefully it all makes sense. If you have questions or modifications to the script, I'd be very interested in them.
Best of luck with your project. I had a lot of fun with mine. Hope I didn't do too much of it for you already.
Joel Ebel
potuncle-+T8c/Xf75frU2QLv0tUyrdBPR1lH4CV8@xxxxxxxxxxxxxxxx wrote:
I am hoping to use the following IR remote controlled antenna rotor with
MythTV: http://www.starkelectronic.com/cmmatv.htm (first item on the
page). My goal will be for MythTV to, via LIRC, send an IR command to the
rotor controller whenever the channel is changed so that the antenna
points in the direction optimal for that channel.
Expectedly, I do not see an existing lircd.conf for this remote, so I
assume I have to create one myself. Has anybody used LIRC with this rotor
controller? If so, it would be great if I could get a copy of your
lircd.conf so I only have to build an IR receiver for my computer. Also,
if I have to create my own lircd.conf, what are my chances of irrecord
sucessfully creating one for me?
I don't mean to sound like a n00b, but I have not tinkered with LIRC much
in the past.
Thanks,
Jason
pl
# Please make this file available to others
# by sending it to <lirc-yJlpgWQrpSkOIzVOb1FTxg@xxxxxxxxxxxxxxxx>
#
# this config file was automatically generated
# using lirc-0.6.6(serial) on Sat Oct 25 10:20:22 2003
#
# contributed by Joel Ebel
#
# brand: Channel Master
# model no. of remote control: 9537
# devices being controlled by this remote:
# Bundled with Channel Master 9521A Antenna Rotor
# Compatible with many other Channel Master rotators
# 9500, 9510(A), 9512, 9513, 9515(A), Radio Shack 15-1225
#
begin remote
name Channel_Master_9537
bits 32
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 9000 4500
one 563 1688
zero 563 563
ptrail 563
repeat 9000 2250
gap 108000
toggle_bit 0
duty_cycle 33
frequency 38000
begin codes
POWER 0x0000000035CA38C7
UP 0x0000000035CA08F7
DOWN 0x0000000035CA8877
1 0x0000000035CA807F
2 0x0000000035CA40BF
3 0x0000000035CAC03F
4 0x0000000035CA20DF
5 0x0000000035CAA05F
6 0x0000000035CA609F
7 0x0000000035CAE01F
8 0x0000000035CA10EF
9 0x0000000035CA906F
0 0x0000000035CA00FF
noop 0x0000000035CA18E7
# This last code is not on the remote, but it can be sent to the
# controller to turn it on. However, if it is on, it will not
# turn it off. I send this before sending other commands to
# ensure the controller is on.
#
end codes
end remote
#!/bin/bash
usage() {
echo "usage: $0 [OPTION]
-c channel Turn to specified channel
-d direction Turn to specified direction
--up Rotate clockwise
--down Rotate counter-clockwise
-s Synchronize antenna
-p channel Program channel to current direction
--power Toggle power
--on Turn controller on
--off Turn controller off
--status Display status on controller
-a [on off] Turn autosync on(reset) or off
-t [on off] Turn 8 minute timeout on or off
--reset Delete all memories and reset controller
"
}
send() {
/usr/local/bin/irsend SEND_ONCE rotor noop $1 noop $2 noop $3 noop $4 noop $5
echo noop $1 noop $2 noop $3 noop $4 noop $5
}
channel() {
CHANNEL=`echo $1 | sed 's/^0*\([0-9]\+\)$/\1/'`
if [ $CHANNEL -ge 1 -a $CHANNEL -le 69 ] 2> /dev/null ; then
echo "Turning to Channel $CHANNEL"
send $(($CHANNEL/10)) $(($CHANNEL%10))
else
echo "ERROR: Channel must be an integer between 1 and 69 inclusive"
fi
}
direction() {
DIRECTION=`echo $1 | sed 's/^0*\([0-9]\+\)$/\1/'`
if [ $DIRECTION -ge 0 -a $DIRECTION -le 360 ] 2> /dev/null ; then
echo "Turning to $DIRECTION Degrees"
send $(($DIRECTION/100)) $((DIRECTION%100/10)) $(($DIRECTION%10))
else
echo "ERROR: Direction must be an integer between 0 and 360 inclusive"
fi
}
up() {
echo "Beginning clockwise rotation, Press enter to stop"
send
/usr/local/bin/irsend SEND_START rotor up
read
/usr/local/bin/irsend SEND_STOP rotor up
}
down() {
echo "Beginning counter-clockwise rotation, Press enter to stop"
send
/usr/local/bin/irsend SEND_START rotor down
read
/usr/local/bin/irsend SEND_STOP rotor down
}
sync() {
echo "Synchronizing Antenna"
send 0 0 down
}
status() {
echo Displaying Status on Controller
send 9 9 up
}
power() {
echo Toggling unit power
/usr/local/bin/irsend SEND_ONCE rotor power
}
on() {
echo Powering unit on
send
}
off() {
echo Powering unit off
/usr/local/bin/irsend SEND_ONCE rotor noop power
}
reset() {
echo "Are you sure you want to delete all memories and reset the controller?
Type Yes if you are sure."
read RESET
if [ "$RESET" = "Yes" ]; then
echo "Resetting controller!"
send 9 1 down
else
echo "NOT resetting controller"
fi
}
autosync() {
case $1 in
on)
echo "Turning on/resetting autosync"
send 9 8 up
;;
off)
echo "Turning off autosync"
send 9 8 down
;;
*) usage;;
esac
}
timeout() {
case $1 in
on)
echo "Turning on 8 minute timeout"
send 9 7 up
;;
off)
echo "Turning off timeout"
send 9 7 down
;;
*) usage;;
esac
}
program() {
CHANNEL=`echo $1 | sed 's/^0*\([0-9]\+\)$/\1/'`
if [ $CHANNEL -ge 1 -a $CHANNEL -le 69 ]; then
echo "Programming Channel $CHANNEL"
send $(($CHANNEL/10)) $(($CHANNEL%10)) up $(($CHANNEL/10)) $(($CHANNEL%10))
else
echo "ERROR: Channel must be an integer between 1 and 69 inclusive"
fi
}
case $# in
1) case $1 in
-s) sync;;
--up) up;;
--down) down;;
--status) status;;
--power) power;;
--on) on;;
--off) off;;
--reset) reset;;
*) usage;;
esac;;
2) case $1 in
-c) channel $2;;
-d) direction $2;;
-p) program $2;;
-a) autosync $2;;
-t) timeout $2;;
*) usage;;
esac;;
*) usage;;
esac