Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ubus call poe sendframe a little more user-friendy #40

Merged
merged 2 commits into from
Dec 26, 2024

Conversation

mrnuke
Copy link
Collaborator

@mrnuke mrnuke commented Sep 21, 2024

No description provided.

@mrnuke mrnuke force-pushed the mrnuke-senframe-send-it branch from 387fec6 to 45ffe35 Compare September 21, 2024 17:17
The sendframe command intermittently fails with an error message,
despite the command being successfully sent and acknowledged by the
PoE controller:

    "Command failed: Parsing message data failed"

mcu_queue_cmd() returns the number of bytes written, or a negative
error code. Whith an active command queue, the frame is queued up
instead being sent right away. The return code is 0, which corresponds
to UBUS_STATUS_OK. No error.

However, when the queue is empty, the frame is sent right away, with
a return code of 12. While this still means success, it also means
UBUS_STATUS_PARSE_ERROR.

Since realtek-poe operates in the linux error code space, not
UBUS_STATUS_* space, the error codes are not interchangeable. So go
ahead and properly translate the return to the correct ubus code.

Lesson learned: don't mix your error codes. It's not a good recipe.

Signed-off-by: Alexandru Gagniuc <[email protected]>
The broadcom dialect has commands for firmware update and recovery. It
can also erase the device firmware. This makes exposing raw frames via
the "sendframe" command potentially dangerous.

To reduce the risk of causing damage, only enable the "sendframe"
command when debug mode, `-d`, is enabled.

Signed-off-by: Alexandru Gagniuc <[email protected]>
@mrnuke mrnuke force-pushed the mrnuke-senframe-send-it branch from 45ffe35 to fa3ca0a Compare December 16, 2024 13:40
@mrnuke mrnuke requested a review from Hurricos December 16, 2024 13:40
@Hurricos Hurricos merged commit bb56ae5 into realtek-poe Dec 26, 2024
1 check passed
@Hurricos
Copy link
Owner

LGTM.

@mrnuke mrnuke deleted the mrnuke-senframe-send-it branch December 26, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants