Advertisement
Guest User

Untitled

a guest
Jan 28th, 2013
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. -----------------------------------------------------------------------
  2. chchannels1.sh
  3. -----------------------------------------------------------------------
  4.  
  5. #!/bin/sh
  6. # Maintained by CommandIR Support mini at commandir.com - Comments /
  7. Suggestions Welcome.
  8. # Modified - Mark Sept 2012
  9.  
  10. LOCKFILE=/tmp/lirclock
  11. export PATH=/bin:/usr/bin:/usr/local/bin
  12. REMOTE_NAME=DCT2000
  13. TRANSMITTER=1
  14.  
  15. . /usr/local/bin/config.sh
  16.  
  17.  
  18. if [ $# -lt 1 ]
  19. then
  20. echo "IR Control Script for LIRC V2.0
  21. Includes support for CommandIR transmitter selection and lockfile.
  22.  
  23. Usage:
  24. $0 (CHANNEL_NUMBER | IR_COMMAND)
  25.  
  26. Sends an IR command or sequence of numbers using REMOTE_NAME via emitter
  27. TRANSMITTER_NUM. DELAY (in seconds) is waited between sending IR commands.
  28.  
  29. Example: Change to channel 123 using emitter $TRANSMITTER
  30. $0 123
  31. "
  32. exit 1
  33. fi
  34.  
  35.  
  36. cmd="$1"
  37.  
  38. while [ -f $LOCKFILE ]
  39. do
  40. #echo "Waiting for lock..."
  41. sleep .1
  42. done
  43.  
  44. touch $LOCKFILE
  45.  
  46. irsend SET_TRANSMITTERS $TRANSMITTER
  47.  
  48. sleep $PAUSE
  49. case $cmd in
  50. [0-9]*)
  51. for digit in $(echo $cmd | sed -e 's/./& /g'); do
  52. irsend SEND_ONCE $REMOTE_NAME $digit
  53. sleep $DELAY
  54. done
  55. ;;
  56.  
  57. *)
  58. #irsend SEND_ONCE $REMOTE_NAME $cmd
  59. ;;
  60. esac
  61.  
  62. rm $LOCKFILE
  63.  
  64.  
  65.  
  66.  
  67. -----------------------------------------------------------------------
  68. config.sh
  69. -----------------------------------------------------------------------
  70.  
  71. #!/bin/sh
  72. #
  73. # Config parameters for all channel scripts
  74. #
  75.  
  76. PAUSE=2.0
  77. DELAY=0.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement