Closed Hurricos closed 2 years ago
There's an app for that: #8
OK, that's really odd. I didn't notice that PR, but I did manage to come up with a patch --
diff --git a/src/main.c b/src/main.c
index 0310f67..d09c55e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -126,15 +126,19 @@ static void load_port_config(struct uci_context *uci, struct uci_section *s)
static void load_global_config(struct uci_context *uci, struct uci_section *s)
{
- const char *budget, *guardband;
+ const char *budget, *guardband, *port_count;
budget = uci_lookup_option_string(uci, s, "budget");
guardband = uci_lookup_option_string(uci, s, "guard");
+ port_count = uci_lookup_option_string(uci, s, "port_count");
config.budget = budget ? strtof(budget, NULL) : 31.0;
config.budget_guard = config.budget / 10;
if (guardband)
config.budget_guard = strtof(guardband, NULL);
+ config.port_count = port_count ? strtoul(port_count, NULL, 0) : 8;
+ if (config.port_count > MAX_PORT)
+ config.port_count = MAX_PORT;
}
static void
``
"port_count" is redundant if you have a bunch of ports,each with a unique, monotonically increasing ID.
"port_count" is redundant if you have a bunch of ports,each with a unique, monotonically increasing ID.
Yep, I can see how just pulling the max might be better.
I won't claim my approach is better. That's in the eye of the beer-holder. I will only claim it's a lower SLOC count and doesn't need modifications to the config file :stuck_out_tongue:
With #8 merged, this is fixed.
This issue is explicitly mentioned by @mrnuke here.
You can see the effect of this on e.g.
ubus call poe info
after first start here.Here is the output of
realtek-poe -d
demonstrating this: https://paste.c-net.org/LockupDebate