[LEDE-DEV] [PATCH 2/3] ramips-mt7621: add GPIO-config for Ubiquiti-EdgeRouterX(-SFP)

Sven Roederer devel-sven at geroedel.de
Sat May 13 11:09:46 PDT 2017


On Montag, 8. Mai 2017 08:23:50 CEST Mathias Kresin wrote:
> 07.05.2017 23:24, Sven Roederer:
> > On Sonntag, 7. Mai 2017 12:25:39 CEST you wrote:
> >> Just an opinion: being able to disable/enable PoE for each port is really
> >> useful when you want to remotely reboot a device plugged into your PoE
> >> switch/router.  Most PoE-capable devices expose this option with the
> >> stock
> >> firmware.
> >> 
> >> Does your approach with the gpio-export node allow to change the state of
> >> the GPIO at runtime? (i.e. probably from userspace)
> > 
> > Baptiste,
> > 
> > right, that's the point I'm also looking for. To have da clean way of
> > controlling the state of the PoE-voltage (24V passive PoE) for the ports.
> > As it's passive PoE there might be a big risk that having the power
> > enabled
> > all the time might cause some problems.
> > 
> > When defining in dts I don't see them in uci or even in /sys/class/gpio.
> > So via "board.d/03_gpio_switches" seems the best way to bring them to
> > userspace for user-interaction.
> 
> If you use the gpio-export node in the device tree source file, the gpio
> pin should appear at /sys/class/gpio/. Most likely you have done
> something wrong. Could it be that you used exactly the same gpio pin
> number as you have it in your 03_gpio_export file? You need to decrement
> the gpio pin number by the gpio base as it is done for all gpios in the dts.
> 
> Correct me if I'm wrong, but as far I can see (and confirmed by testing
> it) the exported gpio in UCI doesn't have any benefit for your restart
> usecase. If I change the gpio value via uci and restart
> /etc/init.d/system the gpio value is still the same. Means, the value is
> only set during the actual export (on boot).
> 
> Mathias

Mathias,

for the "gpio in dts" I used this branch https://github.com/SvenRoederer/lede-project-source/commits/ERX-SFP_gpio-in-dts --> see the last 2 commits. Code 
only changed for ERX for this test.
Did I miss something?

You are correct, that this uci-config only gets applied on boot. but changing 
uci and calling "reload-config" will do the "magic".

Sven



More information about the Lede-dev mailing list