#!/bin/bash

[ $# -ne 1 ] && echo "$0 {command}" && exit 1


send_cmd()
{
echo ${1} > "${DEV}"
}


DEV=/dev/Serial-ER130-BtoUsbIrRemocon

stty -F "${DEV}" 9600

# ER130の操作用
case "${1}" in
power)
send_cmd "022000FD0314EB";;
source)
send_cmd "022000FD0310EF";;
menu)
send_cmd "022000FD031FE0";;
info)
send_cmd "022000FD0309F6";;
left)
send_cmd "022000FD0347B8";;
up)
send_cmd "022000FD0306F9";;
right)
send_cmd "022000FD0340BF";;
down)
send_cmd "022000FD0344BB";;
ok)
send_cmd "022000FD0307F8";;
recall)
send_cmd "022000FD031DE2";;
back)
send_cmd "022000FD030DF2";;
rec)
send_cmd "022000FD0303FC";;
shot)
send_cmd "022000FD0359A6";;
play)
send_cmd "022000FD0351AE";;
pause)
send_cmd "022000FD0308F7";;
rew)
send_cmd "022000FD0358A7";;
stop)
send_cmd "022000FD030AF5";;
ff)
send_cmd "022000FD0357A8";;
page-)
send_cmd "022000FD030EF1";;
slow)
send_cmd "022000FD031EE1";;
page+)
send_cmd "022000FD031AE5";;
quality)
send_cmd "022000FD0346B9";;
disk_info)
send_cmd "022000FD031BE4";;
delete)
send_cmd "022000FD0318E7";;
f1)
send_cmd "022000FD0355AA";;
f2)
send_cmd "022000FD0350AF";;
f3)
send_cmd "022000FD0319E6";;
*)
echo "Error: Illegal command."
exit 1
;;
esac
