3278 |
kaklik |
1 |
#!/bin/sh |
|
|
2 |
### BEGIN INIT INFO |
3279 |
kaklik |
3 |
# Provides: setup_lo |
3281 |
kaklik |
4 |
# Required-Start: $network $remote_fs $syslog |
|
|
5 |
# Required-Stop: $network $remote_fs $syslog |
3278 |
kaklik |
6 |
# Default-Start: 2 3 4 5 |
|
|
7 |
# Default-Stop: 0 1 6 |
3279 |
kaklik |
8 |
# Short-Description: Tune local oscilator |
|
|
9 |
# Description: This start-up script tune local oscilator to defined frequency. |
3278 |
kaklik |
10 |
### END INIT INFO |
|
|
11 |
|
3279 |
kaklik |
12 |
# Author: Jakub Kakona <kaklik@mlab.cz> |
3278 |
kaklik |
13 |
# |
|
|
14 |
# Please remove the "Author" lines above and replace them |
|
|
15 |
# with your own name if you copy and modify this script. |
|
|
16 |
|
|
|
17 |
|
3347 |
kaklik |
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 |
3278 |
kaklik |
25 |
|
3347 |
kaklik |
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. |
3278 |
kaklik |
41 |
. /lib/lsb/init-functions |
|
|
42 |
|
3347 |
kaklik |
43 |
|
3278 |
kaklik |
44 |
freq=142.997918 |
|
|
45 |
|
|
|
46 |
case "$1" in |
3281 |
kaklik |
47 |
start) |
3347 |
kaklik |
48 |
usbsoftrock -m 2 set freq $freq |
3278 |
kaklik |
49 |
;; |
|
|
50 |
restart|reload|force-reload) |
|
|
51 |
echo "Re-tunning the local oscilator" >&2 |
3347 |
kaklik |
52 |
usbsoftrock -v -m 2 set freq 20.000 |
3278 |
kaklik |
53 |
wait 1 |
3347 |
kaklik |
54 |
usbsoftrock -v -m 2 set freq $freq |
3278 |
kaklik |
55 |
exit 3 |
|
|
56 |
;; |
3281 |
kaklik |
57 |
stop) |
3347 |
kaklik |
58 |
echo "Local oscillator is tuned to `usbsoftrock getfreq | grep Frequency` " |
3278 |
kaklik |
59 |
;; |
|
|
60 |
*) |
|
|
61 |
echo "Error: argument '$1' not supported" >&2 |
|
|
62 |
echo "Usage: $0 start|stop" >&2 |
|
|
63 |
exit 3 |
|
|
64 |
;; |
|
|
65 |
esac |
|
|
66 |
|
|
|
67 |
|