Rev 3284 Rev 3347
1 #!/bin/sh 1 #!/bin/sh
2 ### BEGIN INIT INFO 2 ### BEGIN INIT INFO
3 # Provides: setup_lo 3 # Provides: setup_lo
4 # Required-Start: $network $remote_fs $syslog 4 # Required-Start: $network $remote_fs $syslog
5 # Required-Stop: $network $remote_fs $syslog 5 # Required-Stop: $network $remote_fs $syslog
6 # Default-Start: 2 3 4 5 6 # Default-Start: 2 3 4 5
7 # Default-Stop: 0 1 6 7 # Default-Stop: 0 1 6
8 # Short-Description: Tune local oscilator 8 # Short-Description: Tune local oscilator
9 # Description: This start-up script tune local oscilator to defined frequency. 9 # Description: This start-up script tune local oscilator to defined frequency.
10 ### END INIT INFO 10 ### END INIT INFO
11   11  
12 # Author: Jakub Kakona <kaklik@mlab.cz> 12 # Author: Jakub Kakona <kaklik@mlab.cz>
13 # 13 #
14 # Please remove the "Author" lines above and replace them 14 # Please remove the "Author" lines above and replace them
15 # with your own name if you copy and modify this script. 15 # with your own name if you copy and modify this script.
16   16  
17 #cd ~/programy/usbsoftrock -  
18 #./usbsoftrock -s 10 calibrate -  
19 #./usbsoftrock -m 2 set freq 20.000 -  
20   17  
21 PATH=/sbin:/bin:/usr/local/bin/ 18 PATH=/sbin:/usr/local/bin:/bin:/usr/bin
-   19 DESC="Usb softrock local oscillator tunning script"
-   20 NAME=usbsoftrock
-   21 DAEMON=/usr/sbin/$NAME
-   22 DAEMON_ARGS=""
-   23 PIDFILE=/var/run/$NAME.pid
-   24 SCRIPTNAME=/etc/init.d/$NAME
22   25  
-   26 # Exit if the package is not installed
-   27 if [ -x "$DAEMON" ]
-   28 then echo "usbsoftrock not installed. Nothing to done"
-   29 exit 0
-   30 fi
-   31  
-   32 # Read configuration variable file if it is present
-   33 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
-   34  
-   35 # Load the VERBOSE setting and other rcS variables
-   36 . /lib/init/vars.sh
-   37  
-   38 # Define LSB log_* functions.
-   39 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
-   40 # and status_of_proc is working.
23 . /lib/lsb/init-functions 41 . /lib/lsb/init-functions
24   42  
-   43  
25 freq=142.997918 44 freq=142.997918
26   45  
27 case "$1" in 46 case "$1" in
28 start) 47 start)
29 "usbsoftrock -m 2 set freq $freq" 48 usbsoftrock -m 2 set freq $freq
30 ;; 49 ;;
31 restart|reload|force-reload) 50 restart|reload|force-reload)
32 echo "Re-tunning the local oscilator" >&2 51 echo "Re-tunning the local oscilator" >&2
33 usbsoftrock -m 2 set freq 20.000 52 usbsoftrock -v -m 2 set freq 20.000
34 wait 1 53 wait 1
35 usbsoftrock -m 2 set freq $freq 54 usbsoftrock -v -m 2 set freq $freq
36 exit 3 55 exit 3
37 ;; 56 ;;
38 stop) 57 stop)
39 # No-op -  
-   58 echo "Local oscillator is tuned to `usbsoftrock getfreq | grep Frequency` "
40 ;; 59 ;;
41 *) 60 *)
42 echo "Error: argument '$1' not supported" >&2 61 echo "Error: argument '$1' not supported" >&2
43 echo "Usage: $0 start|stop" >&2 62 echo "Usage: $0 start|stop" >&2
44 exit 3 63 exit 3
45 ;; 64 ;;
46 esac 65 esac
47   66  
48   67