wacom: use .format instead of hex to generate the timestring

hex() skips leading zeroes, so 180123 turns into 18, 12, 3
pull/15/head
Peter Hutterer 2018-01-23 14:44:01 +10:00
parent 790f2337dc
commit 7aa4314c3d
1 changed files with 2 additions and 2 deletions

View File

@ -368,7 +368,7 @@ class WacomDevice(GObject.Object):
expected_opcode=0xcf)
# logger.debug(f'cc returned {data} ')
count = int.from_bytes(data[0:4], byteorder='little')
str_timestamp = ''.join([hex(d)[2:] for d in data[4:]])
str_timestamp = ''.join(['{:02x}'.format(d) for d in data[4:]])
timestamp = time.strptime(str_timestamp, "%y%m%d%H%M%S")
return count, timestamp
@ -383,7 +383,7 @@ class WacomDevice(GObject.Object):
data = self.wait_nordic_data(0xcd, 5)
# logger.debug(f'cc returned {data} ')
str_timestamp = ''.join([hex(d)[2:] for d in data])
str_timestamp = ''.join(['{:02x}'.format(d) for d in data])
timestamp = time.strptime(str_timestamp, "%y%m%d%H%M%S")
return count, timestamp