From 4f2a61065fadcc7e1760d5e75514f4698823b4e8 Mon Sep 17 00:00:00 2001 From: trustthegoose <193519572+trustthegoose@users.noreply.github.com> Date: Sat, 17 Oct 2026 11:25:35 -0400 Subject: [PATCH] suunto_nautic: skip another app's subscription notifications in the /Data stream The Suunto app on the same phone holds subscriptions whose pushed values arrive as 0x01 notifications with sequence number 0, like our stream chunks (one seen on handle F0 BF 06 with a 4-byte payload). The stream loop took them as chunks and failed the stream with "Unexpected chunk size". Skip notifications whose handle isn't the stream's, comparing without the slot byte (chunks carry slot F0, the GET reply slot 00). --- src/suunto_nautic.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/suunto_nautic.c b/src/suunto_nautic.c index 9dcb78f..5c1e033 100644 --- a/src/suunto_nautic.c +++ b/src/suunto_nautic.c @@ -633,6 +633,16 @@ suunto_nautic_stream (suunto_nautic_device_t *device, const char *path, dc_buffe break; } + // Another app's subscriptions (the Suunto app holds several) push + // their values on the same link, as notifications with the same + // opcode and sequence number as our chunks but a different handle. + // Compare without the slot byte: our chunks carry the handle with + // slot F0, the GET reply with slot 00. + if (chunk_len >= 3 && (array_uint24_le (chunk) & ~0xFFu) != (handle & ~0xFFu)) { + DEBUG (abstract->context, "Skipping a notification for another subscription (%06x).", array_uint24_le (chunk)); + continue; + } + if (chunk_len < CHUNK_DATA) { ERROR (abstract->context, "Unexpected chunk size (" DC_PRINTF_SIZE ").", chunk_len); status = DC_STATUS_PROTOCOL;