Skip to content

Commit 3da0dd2

Browse files
authored
Merge pull request #7 from balloob/fix/nack-unsupported-commands
Fix MJ-18: NACK unsupported partial-update (0x76) and buzzer (0x77) commands
2 parents 23529b9 + 1f9d598 commit 3da0dd2

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

opendisplay_pipe.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,17 @@ static void dispatch(uint8_t connection, uint16_t cmd, const uint8_t *payload, u
11561156
case CMD_DIRECT_WRITE_END:
11571157
handle_direct_write_end(connection, payload, payload_len);
11581158
break;
1159+
case CMD_DIRECT_WRITE_PARTIAL_START:
1160+
case CMD_BUZZER_ACTIVATE: {
1161+
/* Not implemented on Silabs, but the client sends these and blocks
1162+
* waiting for a reply. Emit a NACK so it fails fast instead of timing
1163+
* out: {0xFF, cmd_low, err, 0x00} matches the client's parse_nack()
1164+
* (0x76 falls back to a full upload; 0x77 raises promptly). Error code
1165+
* 0x07 = "unsupported" (ERR_PARTIAL_UNSUPPORTED on the client). */
1166+
uint8_t nack[] = { 0xFFu, (uint8_t)(cmd & 0xFFu), 0x07u, 0x00u };
1167+
pipe_send(connection, nack, sizeof(nack));
1168+
break;
1169+
}
11591170
default:
11601171
printf("[OD] unknown cmd 0x%04X\r\n", (unsigned)cmd);
11611172
break;

opendisplay_protocol.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#define CMD_DIRECT_WRITE_END 0x0072u
1414
#define CMD_LED_ACTIVATE 0x0073u
1515
#define CMD_LED_STOP 0x0075u
16+
/* Client-visible but unimplemented on Silabs; dispatch NACKs them (see dispatch()) */
17+
#define CMD_DIRECT_WRITE_PARTIAL_START 0x0076u
18+
#define CMD_BUZZER_ACTIVATE 0x0077u
1619
/* NFC: sub byte0 0=read, 1=write (+rec_type,len16,payload), 0x10/0x11/0x12=chunked write; rec_type OD_NFC_REC_* */
1720
#define CMD_NFC_ENDPOINT 0x0082u
1821
#define CMD_REBOOT 0x000Fu

0 commit comments

Comments
 (0)