forked from open-sdr/openwifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
csi_fuzzer.sh
executable file
·61 lines (48 loc) · 1.28 KB
/
csi_fuzzer.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Author: Xianjun Jiao
# SPDX-FileCopyrightText: 2021 UGent
# SPDX-License-Identifier: AGPL-3.0-or-later
if [ "$#" -lt 4 ]; then
echo "You must enter 4 arguments: c1_rot90_en c1_raw(-64 to 63) c2_rot90_en c2_raw(-64 to 63)"
exit 1
fi
c1_rot90_en=$1
c1_raw=$2
c2_rot90_en=$3
c2_raw=$4
if (($c1_rot90_en != 0)) && (($c1_rot90_en != 1)); then
echo "c1_rot90_en must be 0 or 1!"
exit 1
fi
if (($c1_raw < -64)) || (($c1_raw > 63)); then
echo "c1_raw must be -64 to 63!"
exit 1
fi
if (($c2_rot90_en != 0)) && (($c2_rot90_en != 1)); then
echo "c2_rot90_en must be 0 or 1!"
exit 1
fi
if (($c2_raw < -64)) || (($c2_raw > 63)); then
echo "c2_raw must be -64 to 63!"
exit 1
fi
if (($c1_raw < 0)); then
unsigned_c1=$(expr 128 + $c1_raw)
# echo $unsigned_c1
else
unsigned_c1=$c1_raw
fi
if (($c2_raw < 0)); then
unsigned_c2=$(expr 128 + $c2_raw)
# echo $unsigned_c2
else
unsigned_c2=$c2_raw
fi
# echo $c1_rot90_en
# echo $unsigned_c1
# echo $c2_rot90_en
# echo $unsigned_c2
unsigned_dec_combined=$(($unsigned_c1 + 512 * $c1_rot90_en + 1024 * $unsigned_c2 + 524288 * $c2_rot90_en))
# echo $unsigned_dec_combined
echo "./sdrctl dev sdr0 set reg tx_intf 5 $unsigned_dec_combined"
./sdrctl dev sdr0 set reg tx_intf 5 $unsigned_dec_combined