From 96df9fc41697851f08f0e86f47e610a4938e0125 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 2 Aug 2019 11:09:02 +1000 Subject: [PATCH] wacom: make sure we only return the data packet size we want If we have more data than our packet [1], let's not return the whole data array. Slice it to size instead. [1] this never happens with the current code, we don't work asynchronously Signed-off-by: Peter Hutterer --- tuhi/wacom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 168d906..f12d82d 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -492,7 +492,7 @@ class WacomProtocolLowLevelComm(GObject.Object): if length > len(args): raise WacomException(f'Invalid answer message length: expected {length}, got {len(args)}') self.nordic_answer = self.nordic_answer[length + 2:] # opcode + len - return NordicData(answer) + return NordicData(answer[:length + 2]) def wait_nordic_data(self, expected_opcode, timeout=None): if not self.nordic_event.acquire(timeout=timeout):