summaryrefslogtreecommitdiff
path: root/gsm-receiver/src/python/capture.sh
blob: ef205d8872d2a5ff39339cc002888f157b666201 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh

if [ $1"x" = x ]; then
	echo "./capture.sh <freq> [duration==10] [decim==112] [gain==52]"
	echo "Example: ./capture.sh 940.4M"
	exit 1
fi
FREQ=$1

DURATION=$2
if [ $2"x" = x ]; then
	DURATION=10
fi
DECIM=$3
if [ $3"x" = x ]; then
	DECIM=112
fi

GAIN=$4
if [ $4"x" = x ]; then
	GAIN=52
fi


USRP_PROG=usrp_rx_cfile.py
while :; do
	which "$USRP_PROG"
	if [ $? -eq 0 ]; then
		break
	fi
	USRP_PROG=/usr/share/gnuradio/usrp/usrp_rx_cfile.py
	which "$USRP_PROG"
	if [ $? -eq 0 ]; then
		break
	fi

	echo "ERROR: usrp_rx_cfile.py not found. Make sure it's in your PATH!"
	exit 1
done

FILE="capture_${FREQ}_${DECIM}.cfile"
samples=`expr 64000000 / $DECIM '*' $DURATION`
echo "Capturing for $DURATION seconds to $FILE ($samples samples)"
$USRP_PROG -g $GAIN -d "$DECIM" -f "$FREQ" -N $samples $FILE

personal git repositories of Harald Welte. Your mileage may vary