[RFC PATCH v2] fff-support: Update PoE passthrough code for CPE 210
Christian Dresel
fff at chrisi01.de
Di Jul 11 15:40:40 CEST 2017
hi
um die Diskussion mal noch weiter zu "verkomplizieren" (und ich hab sie
nur überflogen und nicht richtig mit verfolgt, also verzeiht wenn ich
was Vorschlage was eh nicht tut). Meine Nanostation M2 hat ebenfalls 2
Ethernetanschlüsse. Dort ist der GPIO8 für PoE Passthrough. Ich hab mir
dazu dieses Script Snippet welches auch unter LEDE tut:
echo 8 > /sys/class/gpio/export (bringt zwar einen Fehler scheint aber
ansonsten problemlos zu laufen, evtl. ist das schon Standartmäßig
gesetzt und deshalb der Fehler, hab da nicht genauer geguckt)
echo out > /sys/class/gpio/gpio8/direction
echo 1 > /sys/class/gpio/gpio8/value
Jetzt hab ich eben mal in die /etc/config/system geguckt und
festgestellt ich könnte es wohl dort auch aktivieren:
...
config gpio_switch 'poe_passthrough'
option name 'PoE Passthrough'
option gpio_pin '8'
option value '0'
...
Einfacher und meines erachtens schöner ist es aber einfach den GPIO zu
setzen und gut. Kann man das bei der CPE nicht auch "einfach so" machen?
mfg
Christian
On 10.07.2017 15:12, Adrian Schmutzler wrote:
> This implements Tim's suggestions for a persistent PoE script
> (as far as I understood them). Please comment and inprove!
>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
> .../ar71xx/etc/uci-defaults/50-config-poe-migration | 7 +++++++
> .../ar71xx/etc/uci-defaults/98-fff-sysupgrade-poe | 7 +++++++
> .../usr/lib/fff-support/cpe210_activate_poe_passthrough.sh | 12 +++++++++---
> .../usr/lib/fff-support/cpe210_permanent_poe_passthrough.sh | 12 ++++++++++++
> 4 files changed, 35 insertions(+), 3 deletions(-)
> create mode 100644 src/packages/fff/fff-support/ar71xx/etc/uci-defaults/50-config-poe-migration
> create mode 100644 src/packages/fff/fff-support/ar71xx/etc/uci-defaults/98-fff-sysupgrade-poe
> mode change 100644 => 100755 src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_activate_poe_passthrough.sh
> create mode 100755 src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_permanent_poe_passthrough.sh
>
> diff --git a/src/packages/fff/fff-support/ar71xx/etc/uci-defaults/50-config-poe-migration b/src/packages/fff/fff-support/ar71xx/etc/uci-defaults/50-config-poe-migration
> new file mode 100644
> index 0000000..7abff58
> --- /dev/null
> +++ b/src/packages/fff/fff-support/ar71xx/etc/uci-defaults/50-config-poe-migration
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +
> +UPGRADE_poe=$(uci -q get "fff-gpio.poe_passthrough.active")
> +
> +if test -n "$UPGRADE_poe" && [ "$UPGRADE_poe" -eq "1" ] ; then
> + . /usr/lib/fff-support/cpe210_activate_poe_passthrough.sh
> +fi
> diff --git a/src/packages/fff/fff-support/ar71xx/etc/uci-defaults/98-fff-sysupgrade-poe b/src/packages/fff/fff-support/ar71xx/etc/uci-defaults/98-fff-sysupgrade-poe
> new file mode 100644
> index 0000000..2d1cc8d
> --- /dev/null
> +++ b/src/packages/fff/fff-support/ar71xx/etc/uci-defaults/98-fff-sysupgrade-poe
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +# Copyright 2017 Adrian Schmutzler
> +# License GPLv3
> +
> +cat > /etc/sysupgrade.conf <<-__EOF__
> +/etc/config/fff-gpio
> +__EOF__
> diff --git a/src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_activate_poe_passthrough.sh b/src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_activate_poe_passthrough.sh
> old mode 100644
> new mode 100755
> index cb3508f..dc3ccd0
> --- a/src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_activate_poe_passthrough.sh
> +++ b/src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_activate_poe_passthrough.sh
> @@ -1,5 +1,11 @@
> +#!/bin/sh
> +# This enables PoE passthrough and is not reset after reboot,
> +# but after firmware upgrade
> +
> 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
> + uci set system.poe_passthrough=gpio_switch
> + uci set system.poe_passthrough.name='PoE Passthrough'
> + uci set system.poe_passthrough.gpio_pin='20'
> + uci set system.poe_passthrough.value='1'
> + uci commit system
> fi
> diff --git a/src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_permanent_poe_passthrough.sh b/src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_permanent_poe_passthrough.sh
> new file mode 100755
> index 0000000..34698f6
> --- /dev/null
> +++ b/src/packages/fff/fff-support/ar71xx/usr/lib/fff-support/cpe210_permanent_poe_passthrough.sh
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +# This enables PoE passthrough permanently, so it is persistent
> +# after firmware upgrades
> +
> +if [ "$(cat /var/sysinfo/model)" = "TP-Link CPE210 v1.1" ] ; then
> + touch /etc/config/fff-gpio
> + uci set fff-gpio.poe_passthrough=poe
> + uci set fff-gpio.poe_passthrough.active=1
> + uci commit fff-gpio
> +
> + . /usr/lib/fff-support/cpe210_activate_poe_passthrough.sh
> +fi
>
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname : signature.asc
Dateityp : application/pgp-signature
Dateigröße : 819 bytes
Beschreibung: OpenPGP digital signature
URL : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20170711/dc0ae94e/attachment.sig>
Mehr Informationen über die Mailingliste franken-dev