forked from freifunk-franken/firmware
fff-support: Update PoE passthrough code
This implements an upgrade safe solution for the PoE passthrough on multiple devices. Since LEDE already provides the relevant settings, a check whether those are in place enables both identification of affected devices and automatic deactivation if parameters are changed. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
This commit is contained in:
parent
39d147da8d
commit
84432f7bbf
|
@ -23,3 +23,8 @@ uci -q set "simple-tc.example.limit_ingress=${traffic_in}"
|
||||||
uci -q set "simple-tc.example.limit_egress=${traffic_out}"
|
uci -q set "simple-tc.example.limit_egress=${traffic_out}"
|
||||||
|
|
||||||
uci -q commit
|
uci -q commit
|
||||||
|
|
||||||
|
poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
|
||||||
|
if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then
|
||||||
|
/usr/lib/fff-support/activate_poe_passthrough.sh
|
||||||
|
fi
|
||||||
|
|
|
@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
|
||||||
CATEGORY:=Freifunk
|
CATEGORY:=Freifunk
|
||||||
TITLE:=Freifunk-Franken Support Scripts
|
TITLE:=Freifunk-Franken Support Scripts
|
||||||
URL:=http://www.freifunk-franken.de
|
URL:=http://www.freifunk-franken.de
|
||||||
DEPENDS:=+@BUSYBOX_CONFIG_ASH
|
DEPENDS:=+@BUSYBOX_CONFIG_ASH +fff-config
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/description
|
define Package/$(PKG_NAME)/description
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# This enables PoE passthrough so it is persistent through reboots,
|
||||||
|
# but reset after firmware upgrade
|
||||||
|
|
||||||
|
if uci -q get "system.poe_passthrough" > /dev/null ; then
|
||||||
|
uci -q set "system.poe_passthrough.value=1"
|
||||||
|
uci -q commit system
|
||||||
|
/etc/init.d/gpio_switch restart
|
||||||
|
fi
|
|
@ -1,5 +0,0 @@
|
||||||
if [ "$(cat /var/sysinfo/model)" = "TP-Link CPE210 v1.1" ] ; then
|
|
||||||
echo 20 > /sys/class/gpio/export
|
|
||||||
echo out > /sys/class/gpio/gpio20/direction
|
|
||||||
echo 1 > /sys/class/gpio/gpio20/value
|
|
||||||
fi
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# This disables PoE passthrough permanently
|
||||||
|
|
||||||
|
uci -q set "fff.poe_passthrough=fff"
|
||||||
|
uci -q set "fff.poe_passthrough.active=0"
|
||||||
|
uci -q commit fff
|
||||||
|
|
||||||
|
if uci -q get "system.poe_passthrough" > /dev/null ; then
|
||||||
|
uci -q set "system.poe_passthrough.value=0"
|
||||||
|
uci -q commit system
|
||||||
|
/etc/init.d/gpio_switch restart
|
||||||
|
fi
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# This enables PoE passthrough permanently, so it is persistent
|
||||||
|
# during firmware upgrades
|
||||||
|
|
||||||
|
uci -q set "fff.poe_passthrough=fff"
|
||||||
|
uci -q set "fff.poe_passthrough.active=1"
|
||||||
|
uci -q commit fff
|
||||||
|
|
||||||
|
/usr/lib/fff-support/activate_poe_passthrough.sh
|
Loading…
Reference in New Issue