summaryrefslogtreecommitdiff
path: root/recipes-connectivity/hostapd/files/setchan
blob: ceae0cf264d410fd5bb41d6d6f090ee0d8b94113 (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
#!/bin/bash
echo 'Old Channel'
egrep '^channel=|^hw_mode=' /var/config/hostapd.conf
CHAN=$1
if ! [[ $CHAN =~ ^[0-9]+$ ]] ; then
	echo channel must be an integer
fi
if ((CHAN < 15)) ; then
	HW='g'
else
	HW='a'
fi

sed -i "s/^channel=.*/channel=${CHAN}/" /var/config/hostapd.conf 
sed -i "s/^hw_mode=.*/hw_mode=${HW}/" /var/config/hostapd.conf

/etc/init.d/bt-pan stop
/etc/init.d/bluetooth stop
/etc/init.d/hostapd stop
/etc/init.d/rs9113 stop
/etc/init.d/rs9113 start
/etc/init.d/bluetooth start
/etc/init.d/bt-pan start
/etc/init.d/hostapd start