Fix MJ-18: NACK unsupported partial-update (0x76) and buzzer (0x77) commands#7
Open
balloob wants to merge 1 commit into
Open
Fix MJ-18: NACK unsupported partial-update (0x76) and buzzer (0x77) commands#7balloob wants to merge 1 commit into
balloob wants to merge 1 commit into
Conversation
…ommands
The BLE client can send partial-update (0x76) and buzzer (0x77) commands
that the Silabs firmware does not implement. Both fell through the dispatch
switch's default case, which only printed "unknown cmd" and returned nothing.
The client then blocked waiting for an ACK until its timeout expired.
Reply to both opcodes with a NACK frame {0xFF, cmd_low, 0x07, 0x00} so the
client fails fast: for 0x76 this matches parse_nack() and triggers a clean
fallback to a full upload; for 0x77 validate_ack_response() rejects it
immediately as a non-ACK. Genuinely unknown opcodes keep the existing
default (print + drop). Behavior for internal/no-response opcodes is
unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The BLE client can send partial-update (
0x76) and buzzer (0x77) commands that the Silabs firmware does not implement. Both fell through the dispatchswitchdefaultcase inopendisplay_pipe.c, which only printedunknown cmdand returned nothing. The client then blocked waiting for an ACK until its timeout expired (finding MJ-18).Fix
Reply to both opcodes with a NACK frame
{0xFF, cmd_low, 0x07, 0x00}so the client fails fast instead of hanging:0x76(partial-update start): the frame matches the client'sparse_nack()({0xFF, opcode, err, 0x00}), so it logs the rejection and cleanly falls back to a full upload. Error code0x07corresponds to the client'sERR_PARTIAL_UNSUPPORTED.0x77(buzzer): the client only callsvalidate_ack_response(), which rejects0xFF77immediately as a non-ACK (InvalidResponseError).Genuinely unknown opcodes keep the existing
defaultbehavior (print + drop). Behavior for internal/no-response opcodes is unchanged. Scope is limited to{0x76, 0x77}.Verification
arm-none-eabi-gcc/slc) was available in the working environment, so the full firmware image was not built.opendisplay_protocol.hwas host syntax-checked standalone (self-contained, only depends onstdint.h) and the newswitchcases were syntax-checked in an isolated stub withgcc -std=c11 -fsyntax-only -Wall -Wextra— both clean.py-opendisplaycode:parse_nack(bytes([0xFF,0x76,0x07,0x00])) == (0x76, 0x07)(fallback to full upload) andvalidate_ack_response(bytes([0xFF,0x77,0x07,0x00]), BUZZER_ACTIVATE)raisesInvalidResponseError.Companion
An nRF firmware PR addresses the same MJ-18 finding on that platform. The separate nonce/replay-protection and config-parser fixes are out of scope here.
🤖 Generated with Claude Code
https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR
Companion PR: OpenDisplay/Firmware_NRF#2 (same MJ-18 fix, nRF side). Note: nRF uses err code
0x01vs this PR's0x07(ERR_PARTIAL_UNSUPPORTED) — both work;0x07is the semantically-correct code.