mirror of https://github.com/tuhiproject/tuhi.git
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>pull/149/head
parent
eacc03b6ea
commit
96df9fc416
|
@ -492,7 +492,7 @@ class WacomProtocolLowLevelComm(GObject.Object):
|
||||||
if length > len(args):
|
if length > len(args):
|
||||||
raise WacomException(f'Invalid answer message length: expected {length}, got {len(args)}')
|
raise WacomException(f'Invalid answer message length: expected {length}, got {len(args)}')
|
||||||
self.nordic_answer = self.nordic_answer[length + 2:] # opcode + len
|
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):
|
def wait_nordic_data(self, expected_opcode, timeout=None):
|
||||||
if not self.nordic_event.acquire(timeout=timeout):
|
if not self.nordic_event.acquire(timeout=timeout):
|
||||||
|
|
Loading…
Reference in New Issue