From d73da09e266291e87a767b562e728a3a6ff3fec9 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 14 Aug 2019 11:58:37 +1000 Subject: [PATCH] protocol: 0xc7 on the spark seems to be in big-endian Signed-off-by: Peter Hutterer --- test/test_messages.py | 2 +- tuhi/protocol.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_messages.py b/test/test_messages.py index d692fab..a3f40c6 100644 --- a/test/test_messages.py +++ b/test/test_messages.py @@ -282,7 +282,7 @@ class TestProtocolAny(unittest.TestCase): self.assertEqual(request.opcode, 0xc5) self.assertEqual(request.length, 1) self.assertEqual(request[0], 0x00) - data = list(count.to_bytes(4, byteorder='little')) + data = list(count.to_bytes(4, byteorder='big')) return NordicData([0xc7, len(data)] + data) else: t = time.strftime('%y%m%d%H%M%S', time.gmtime(ts)) diff --git a/tuhi/protocol.py b/tuhi/protocol.py index d784bc0..76cb5a9 100644 --- a/tuhi/protocol.py +++ b/tuhi/protocol.py @@ -878,7 +878,7 @@ class MsgGetStrokesSpark(Msg): # This is an odd message, we have one request but one or two # replies. The 0xc7 reply is sometimes missing, unclear though when. if reply.opcode == 0xc7: - self.count = int.from_bytes(reply[0:4], byteorder='little') + self.count = int.from_bytes(reply[0:4], byteorder='big') # Re-execute the message but this time without a new request self.requires_request = False