From 05a1984ab1e9dd03e2f58d7cd91f964a97dceac8 Mon Sep 17 00:00:00 2001 From: sago35 Date: Sun, 5 Nov 2023 12:27:15 +0900 Subject: [PATCH] Add support for JSON without LZMA compression --- src/main/python/protocol/keyboard_comm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/python/protocol/keyboard_comm.py b/src/main/python/protocol/keyboard_comm.py index 4351faac8f..d15369a31d 100644 --- a/src/main/python/protocol/keyboard_comm.py +++ b/src/main/python/protocol/keyboard_comm.py @@ -139,7 +139,12 @@ def reload_layout(self, sideload_json=None): block += 1 sz -= MSG_LEN - payload = json.loads(lzma.decompress(payload)) + try: + payload = lzma.decompress(payload) + except lzma.LZMAError: + payload = payload.decode() + + payload = json.loads(payload) self.check_protocol_version()