Skip to content

hostmot2: harden Smart Serial and absolute encoder handling - #4662

Open
sleepybishop wants to merge 10 commits into
LinuxCNC:masterfrom
sleepybishop:hostmot-sserial
Open

sleepybishop wants to merge 10 commits into
LinuxCNC:masterfrom
sleepybishop:hostmot-sserial

Conversation

@sleepybishop

@sleepybishop sleepybishop commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Split from #4488 as requested. Adds Smart Serial/absolute-encoder parsing, allocation and cleanup checks, validates flash geometry, and fixes floating-point parameter comparisons, including unchanged NaNs. Setup-mode state-machine changes remain excluded.

Local builds pass. Hardware testing remains pending.

@sleepybishop
sleepybishop marked this pull request as ready for review October 10, 2026 03:17
@BsAtHome

Copy link
Copy Markdown
Contributor

Same comment on the test as in #4660.

@BsAtHome

Copy link
Copy Markdown
Contributor

This needs to be thoroughly tested on real hardware that uses the changed code-paths.

@grandixximo

Copy link
Copy Markdown
Contributor

@rene-dev when you get to the test the three branches from @hdiethelm maybe you could give a check at this as well?

chan->confs = (hm2_sserial_data_t *)rtapi_krealloc(chan->confs,
chan->num_confs * sizeof(hm2_sserial_data_t),

if (q > RTAPI_UINT8_MAX) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What guards q from being negative?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added q < 0 and kept q as long until validation.

Comment thread src/hal/drivers/mesa-hostmot2/sserial.c Outdated
Comment on lines +1682 to +1683
hal_set_ui32(inst->fault_count,
fault_count + hal_get_ui32(inst->fault_inc));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why just the line break? Terminals have been wider than 80 for the past 30 years or so?

(other places too)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the added wrapping. The remaining fault-count edits remove unused assignments.

Comment thread tests/hostmot2/sserial/README Outdated
@@ -0,0 +1,25 @@
HostMot2 Smart Serial software regression tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment on the test as the pktuart test.

@sleepybishop

sleepybishop commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Thank you, I removed the standalone harness.

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.

3 participants