From 116589d28de4230af9c1ffbf5237cb51af2df7b6 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 14 Aug 2019 12:10:27 +1000 Subject: [PATCH] wacom: pen data first four bytes are the internal file format Signed-off-by: Peter Hutterer --- tuhi/wacom.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 80f71af..679d1ff 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -815,12 +815,11 @@ class WacomProtocolBase(WacomProtocolLowLevelComm): return v, dv, is_rel def parse_pen_data_prefix(self, data): - expected_prefix = b'\x62\x38\x62\x74' + file_format = b'\x62\x38\x62\x74' prefix = data[:4] offset = len(prefix) - # not sure if we really need this check - if bytes(prefix) != expected_prefix: - logger.debug(f'Expected pen data prefix {expected_prefix} but got {prefix}') + if bytes(prefix) != file_format: + logger.debug(f'Unsupported file format {prefix} (require {file_format})') return False, 0 return True, offset @@ -1065,12 +1064,11 @@ class WacomProtocolIntuosPro(WacomProtocolSlate): return time.gmtime(seconds) def parse_pen_data_prefix(self, data): - expected_prefix = b'\x67\x82\x69\x65' + file_format = b'\x67\x82\x69\x65' prefix = data[:4] offset = len(prefix) - # not sure if we really need this check - if bytes(prefix) != expected_prefix: - logger.debug(f'Expected pen data prefix {expected_prefix} but got {prefix}') + if bytes(prefix) != file_format: + logger.debug(f'Unsupported file format {prefix} (require {file_format})') return False, 0 # This is the time the button was pressed after drawing, i.e. the