Skip to content

Fix NHS serial framing for embedded packet markers - #3597

Open
Challado wants to merge 5 commits into
networkupstools:masterfrom
Challado:fix/nhs-ser-length-framing
Open

Fix NHS serial framing for embedded packet markers#3597
Challado wants to merge 5 commits into
networkupstools:masterfrom
Challado:fix/nhs-ser-length-framing

Conversation

@Challado

Copy link
Copy Markdown

Summary

  • make NHS serial packet framing honor the total length declared in byte 1, allowing 0xFF and 0xFE inside packet payloads
  • preserve partial packet state across normal serial-read timeouts and validate packet length and end marker before dispatch
  • add compatibility initialization fallback and optional model description override
  • retain per-model protocol metadata and bypass alarm behavior, and correct input voltage minimum/maximum publication
  • document the driver changes in NEWS.adoc

Testing

Hardware validation is requested from the reporter of #3592, who supplied captures demonstrating valid 18-byte and 50-byte HWINFO frames containing 0xFF in the payload.

Fixes #3592

Honor the packet length declared at byte 1 so embedded 0xFF and 0xFE payload bytes do not restart or truncate valid frames. Preserve partial packet state across serial-read timeouts and validate the declared length and final marker before dispatch.

Add the compatibility initialization request, model description override, protocol metadata and per-model bypass alarm behavior. Correct the published input voltage extrema and document the changes.

Signed-off-by: Lucas Bocchi <lucas.bocchi@gmail.com>
@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit 07f929c is temporarily available: NUT-tarballs-PR-3597.zip.

Initialize protocol and bypass metadata explicitly for every known model so Clang's missing-field check remains clean. Add a documented defensive default to the initialization selector and teach the documentation spell checker the hexadecimal xFE token.

Signed-off-by: Lucas Bocchi <lucas.bocchi@gmail.com>
Check the HWINFO checksum in its interpreter and publish the documented lower-case battery charger states. Log already-known HWINFO packets quietly and expose rejected frames through raw packet debugging.

Credit the packet captures and follow-up analysis contributed in issue networkupstools#3592 directly beside the affected code and in the release notes.

Suggested-by: Free Churro <freechurrosnet@gmail.com>
Signed-off-by: Lucas Bocchi <lucas.bocchi@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5157-master completed (commit 2ba23fbcdb by @Challado)

Signed-off-by: Lucas Bocchi <lucas.bocchi@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5158-master completed (commit e5671c0355 by @Challado)

Pass the packet data, byte count and serial descriptor directly to the helper. Keep serial validation, reopening, write checks and diagnostics inside the helper so the initialization calls are easier to read.

Signed-off-by: Lucas Bocchi <lucas.bocchi@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5159-master completed (commit e3c2ed0f4d by @Challado)

@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5162-master completed (commit f2bb41152b by @Challado)

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.

nhs_ser: unconditional 0xFF resync discards HWINFO packets that contain 0xFF in the payload (Premium PDV Senoidal 1500VA)

2 participants