From c32c613d8c9f85b429a4ed4d92eff71e1907a4a0 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Tue, 2 Jun 2026 21:51:49 -0500 Subject: [PATCH] Fix LK_Device::_write retry logic for partial success e.g. if we want two bytes and got one, we want to read one more, not two more --- FlashGBX/LK_Device.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FlashGBX/LK_Device.py b/FlashGBX/LK_Device.py index b1b4b38..72d6f7e 100644 --- a/FlashGBX/LK_Device.py +++ b/FlashGBX/LK_Device.py @@ -476,8 +476,8 @@ class LK_Device(ABC): hp -= 1 if hp > 0: # dprint(f"Recovery: {self.DEVICE.in_waiting} byte(s) in queue! (HP: {hp}/50)") - buffer += self.DEVICE.read(count) - + buffer += self.DEVICE.read(count - len(buffer)) + if len(buffer) != count: tb_stack = traceback.extract_stack() stack = tb_stack[len(tb_stack)-2] # caller only