You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
907 B

#!/bin/sh
set -e -u
SCRIPTNAME=termux-infrared-transmit
show_usage () {
echo "Usage: $SCRIPTNAME -f frequency pattern"
echo "Transmit an infrared pattern. The pattern is specified in comma-separated on/off intervals, such as '20,50,20,30'. Only patterns shorter than 2 seconds will be transmitted."
echo ""
echo " -f frequency IR carrier frequency in Hertz"
echo ""
exit 0
}
FREQUENCY=""
while getopts :hf: option
do
case "$option" in
h) show_usage;;
f) FREQUENCY="--ei frequency $OPTARG";;
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
esac
done
shift $(($OPTIND-1))
if [ -z "$FREQUENCY" ]; then echo "$SCRIPTNAME: No frequency specified"; exit 1; fi
if [ $# -lt 1 ]; then echo "$SCRIPTNAME: too few arguments"; exit 1; fi
if [ $# -gt 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
@TERMUX_API@ InfraredTransmit $FREQUENCY --eia pattern $1