wifi-sentinel: make the switchport configurable, as it differs

This commit is contained in:
Vasil Kolev 2019-10-29 15:47:41 +02:00 committed by root
parent df0e5bceee
commit dc022f9e55
6 changed files with 55 additions and 5 deletions

View File

@ -1,11 +1,36 @@
#!/bin/sh #!/bin/sh
. /lib/functions/network.sh . /lib/functions/network.sh
p=$(uci get wifi-sentinel.@wifi-sentinel[0].packets)
if [ -z "$p" ]; then
PACKETS='3' PACKETS='3'
else
PACKETS="$p"
fi
p=$(uci get wifi-sentinel.@wifi-sentinel[0].interval)
if [ -z "$p" ]; then
INTERVAL='10' INTERVAL='10'
STATUS='unknown' else
INTERVAL="$p"
fi
p=$(uci get wifi-sentinel.@wifi-sentinel[0].network)
if [ -z "$p" ]; then
NETWORK='management' NETWORK='management'
PORT='1' else
NETWORK="$p"
fi
p=$(uci get wifi-sentinel.@wifi-sentinel[0].switchport)
if [ -z "$p" ]; then
PORT=1
else
PORT="$p"
fi
STATUS='unknown'
lightsoff() lightsoff()
{ {
@ -27,7 +52,7 @@ lightson()
port_check() port_check()
{ {
LINK=`swconfig dev switch0 port 1 show | awk '/link/ {print $3}'` LINK=`swconfig dev switch0 port $PORT show | awk '/link/ {print $3}'`
if [ "$LINK" = 'link:up' ]; then if [ "$LINK" = 'link:up' ]; then
return 0 return 0
else else

View File

@ -3,3 +3,4 @@ config wifi-sentinel
option packets 3 option packets 3
option interval 10 option interval 10
option network 'management' option network 'management'
option switchport '1'

View File

@ -0,0 +1,6 @@
config wifi-sentinel
option packets 3
option interval 10
option network 'management'
option switchport '2'

View File

@ -0,0 +1,6 @@
config wifi-sentinel
option packets 3
option interval 10
option network 'management'
option switchport '1'

View File

@ -0,0 +1,6 @@
config wifi-sentinel
option packets 3
option interval 10
option network 'management'
option switchport '1'

View File

@ -0,0 +1,6 @@
config wifi-sentinel
option packets 3
option interval 10
option network 'management'
option switchport '1'