From 4662da3b823b5d66385eedf27514f7d8a4117e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Mon, 16 Oct 2023 21:35:02 +0100 Subject: [PATCH] Mi Band 8: Fix chunked receive decryption --- .../service/devices/xiaomi/XiaomiCharacteristic.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiCharacteristic.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiCharacteristic.java index 6cb652056..68c41c9f9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiCharacteristic.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiCharacteristic.java @@ -148,6 +148,9 @@ public class XiaomiCharacteristic { } else { handler.handle(chunkBuffer.toByteArray()); } + + currentChunk = 0; + chunkBuffer.reset(); } } else { // Not a chunk / single-packet @@ -162,6 +165,8 @@ public class XiaomiCharacteristic { return; } numChunks = buf.getShort(); + currentChunk = 0; + chunkBuffer.reset(); LOG.debug("Got chunked start request for {} chunks", numChunks); sendChunkStartAck(); return;