mirror of https://github.com/tuhiproject/tuhi.git
wacom: rename a function to make it more obvious
We're not checking for data here, we're taking the next message. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>pull/149/head
parent
075fae13f9
commit
eacc03b6ea
|
@ -485,12 +485,12 @@ class WacomProtocolLowLevelComm(GObject.Object):
|
||||||
self.fw_logger.nordic.send(data)
|
self.fw_logger.nordic.send(data)
|
||||||
chrc.write_value(data)
|
chrc.write_value(data)
|
||||||
|
|
||||||
def check_nordic_incoming(self):
|
def pop_next_message(self):
|
||||||
answer = self.nordic_answer
|
answer = self.nordic_answer
|
||||||
length = answer[1]
|
length = answer[1]
|
||||||
args = answer[2:]
|
args = answer[2:]
|
||||||
if length > len(args):
|
if length > len(args):
|
||||||
raise WacomException(f'error while processing answer, should get an answer of size {length} instead of {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)
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ class WacomProtocolLowLevelComm(GObject.Object):
|
||||||
# timeout
|
# timeout
|
||||||
raise WacomTimeoutException(f'{self.device.name}: Timeout while reading data')
|
raise WacomTimeoutException(f'{self.device.name}: Timeout while reading data')
|
||||||
|
|
||||||
data = self.check_nordic_incoming()
|
data = self.pop_next_message()
|
||||||
|
|
||||||
# logger.debug(f'received {data.opcode:02x} / {data.length:02x} / {b2hex(bytes(data))}')
|
# logger.debug(f'received {data.opcode:02x} / {data.length:02x} / {b2hex(bytes(data))}')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue