Hurricos / realtek-poe

5 stars 10 forks source link

realtek-poe daemon reload interrupts power to PoE sinks #5

Closed mrnuke closed 2 years ago

mrnuke commented 2 years ago

Summarry

It has been reported in this OpenWRT forum post that realtek-poe behavior is really annoying. PoE devices lose power whenever realtek-poe is started or restarted.

This is undesireable for two reasons:

  1. It's annoying
  2. Crashes in realtek-poe will shut down PoE devices.

Technical details

The following two lines in poe_initial_setup() cause the power to PoE ports to be cut off when realtek-poe is started:

https://github.com/Hurricos/realtek-poe/blob/db485c85b2c6c997049b81c44a3c0d6d57d1728c/src/main.c#L712-L713

Course of action

On my engenius-ews2910p with 22.10 firmware, the MCU does not care about the state of the ports. It will happily accept a "set global power budget" command and apply it dynamically.

If so, then we could simply remove the calls in question, and everything should work,

Hurricos commented 2 years ago

From https://github.com/Hurricos/realtek-poe/pull/6#issuecomment-1166650607:

The gpio-hogdefinition looks fine to me. I wonder if u-boot is forcing the GPIO low.

I can watch the line. I'm worried that OpenWrt is setting it low. Let me attempt to invoke a reboot from the OEM FW.

mrnuke commented 2 years ago

There's a difference between a system reboot and a daemon restart. This issue is focused on shutting down and restarting realtek poe. For example:

/etc/init.d/poe restart

On a system reboot we really don't have that much control. If the bootloader decides to reset the PoE MCU, or disable the poe-enable line, there is little we can do to prevent that. Only in the event that the bootloader, and gpio-restart hardware do not touch the PSEs, do we have the power to not cut power.

mrnuke commented 2 years ago

With #6 I will be removing the call to poe_cmd_global_power_budget{}. That only leaves poe_cmd_global_port_enable(0); which I think should just be removed as well.

walterav1984 commented 2 years ago

This seems to be fixed for the CI22 realtek-poe package release, as in no interruption for a currently PoE powered device while changing /etc/config/poe and doing a /etc/init.d/poe reload or ubus call poe reload and powering on a other PoE device. Have to test extensive "disabling" and "enabling" in /etc/config/poe yet though.

mrnuke commented 2 years ago

/etc/init.d/poe reload Does not stop the daemon, but /etc/init.d/poe restart does.

Hurricos commented 2 years ago

Issue fixed by b1e21d6c1e6bebd07321ce9045f8865f2c338a80.

walterav1984 commented 2 years ago

Besides the non-interupted PoE ubus call poe reload or /etc/init.d/poe reload I can also confirm that even /etc/init.d/poe restart won't interupt PoE power anymore on already powered on PoE devices with package CI29.