#!/bin/sh
### BEGIN INIT INFO
# Provides:          setup_lo
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Tune local oscilator 
# Description:       This start-up script tune local oscilator to defined frequency.
### END INIT INFO

# Author: Jakub Kakona <kaklik@mlab.cz>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.

#cd ~/programy/usbsoftrock
#./usbsoftrock -s 10 calibrate
#./usbsoftrock -m 2 set freq 20.000

PATH=/sbin:/bin

. /lib/lsb/init-functions

freq=142.997918

case "$1" in
  start|required-start)
        "usbsoftrock -m 2 set freq $freq"
        ;;
  restart|reload|force-reload)
        echo "Re-tunning the local oscilator" >&2
        "usbsoftrock -m 2 set freq 20.000"
        wait 1
        "usbsoftrock -m 2 set freq $freq"
        exit 3
        ;;
  stop|required-stop)
        # No-op
        ;;
  *)
        echo "Error: argument '$1' not supported" >&2
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac