Hurricos / realtek-poe

5 stars 10 forks source link

realtek-poe: Get port count from config, not system status packet #8

Closed mrnuke closed 2 years ago

mrnuke commented 2 years ago

The initial assumption that there are eight PoE ports is not always valid. This assumption was corrected with the receipt of the first status packet, but that is too late. When this packet arrives, the initial config will have already happened. Thys ports above 8 do not get configured. One might dare call this a race condition.

Use the config file to determine the port count. Remove the assumption that the system has eight ports. It is not problematic if the config has more ports than the sytem. The MCU will respond with all f's to commands for invalid ports.

The case where the system has more ports than the config is not handled. It doesn't have to be. The "poe info" command only sends data for configred ports that are enabled. There's no point in probing anything more.

Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com

Hurricos commented 2 years ago

Works for me on my ZyXEL GS1900-24HPv1.

Tested-by: Martin Kennedy hurricos@gmail.com (not gonna bother adding that to the commits, though).