wacom: pen data first four bytes are the internal file format

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-08-14 12:10:27 +10:00 committed by Benjamin Tissoires
parent f742779c1a
commit 116589d28d
1 changed files with 6 additions and 8 deletions

View File

@ -815,12 +815,11 @@ class WacomProtocolBase(WacomProtocolLowLevelComm):
return v, dv, is_rel return v, dv, is_rel
def parse_pen_data_prefix(self, data): def parse_pen_data_prefix(self, data):
expected_prefix = b'\x62\x38\x62\x74' file_format = b'\x62\x38\x62\x74'
prefix = data[:4] prefix = data[:4]
offset = len(prefix) offset = len(prefix)
# not sure if we really need this check if bytes(prefix) != file_format:
if bytes(prefix) != expected_prefix: logger.debug(f'Unsupported file format {prefix} (require {file_format})')
logger.debug(f'Expected pen data prefix {expected_prefix} but got {prefix}')
return False, 0 return False, 0
return True, offset return True, offset
@ -1065,12 +1064,11 @@ class WacomProtocolIntuosPro(WacomProtocolSlate):
return time.gmtime(seconds) return time.gmtime(seconds)
def parse_pen_data_prefix(self, data): def parse_pen_data_prefix(self, data):
expected_prefix = b'\x67\x82\x69\x65' file_format = b'\x67\x82\x69\x65'
prefix = data[:4] prefix = data[:4]
offset = len(prefix) offset = len(prefix)
# not sure if we really need this check if bytes(prefix) != file_format:
if bytes(prefix) != expected_prefix: logger.debug(f'Unsupported file format {prefix} (require {file_format})')
logger.debug(f'Expected pen data prefix {expected_prefix} but got {prefix}')
return False, 0 return False, 0
# This is the time the button was pressed after drawing, i.e. the # This is the time the button was pressed after drawing, i.e. the