From 7aa4314c3d9159552e09b9463aefb905182634fe Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 23 Jan 2018 14:44:01 +1000 Subject: [PATCH] wacom: use .format instead of hex to generate the timestring hex() skips leading zeroes, so 180123 turns into 18, 12, 3 --- tuhi/wacom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index f0799fb..0f007f5 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -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