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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-08-02 11:09:02 +10:00 committed by Benjamin Tissoires
parent eacc03b6ea
commit 96df9fc416
1 changed files with 1 additions and 1 deletions

View File

@ -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):