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

Mathias Kresin dev at kresin.me
Sun May 14 07:24:15 PDT 2017


13.05.2017 20:09, Sven Roederer:
> 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?

Yes you did. The gpio-export,output value is wrong. It has to be either 
0 or 1, similar to the values set for the gpio_switch config in 
/e/c/system.

To make it as easy as possible for people to help, please paste your 
patch next time into the e-mail body of your reply.

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

Oh indeed, reload_config does the job. I wasn't aware of this little helper.

As I already wrote the last time, I'll leave it up to you to add what 
you are the opinion is the best for the use case. I just wanted to 
ensure that is wasn't added because of lack of knowledge about the 
alternatives.

Mathias



More information about the Lede-dev mailing list