wacom: print an error if our device is more than 5 mins out

This commit is contained in:
Peter Hutterer 2018-02-15 15:26:20 +10:00
parent 09bfe44dd7
commit 155a11104c
1 changed files with 4 additions and 1 deletions

View File

@ -408,7 +408,10 @@ class WacomProtocolBase(WacomProtocolLowLevelComm):
expected_opcode=0xbd) expected_opcode=0xbd)
ts = self.time_from_bytes(data) ts = self.time_from_bytes(data)
logger.debug(f'b6 returned time: UTC {time.strftime("%y%m%d%H%M%S", ts)}') logger.debug(f'b6 returned time: UTC {time.strftime("%y%m%d%H%M%S", ts)}')
# FIXME: check if data matches self.current_time
tdelta = time.mktime(time.gmtime()) - time.mktime(ts)
if abs(tdelta) > 300:
logger.error(f'device time is out by more than 5 minutes')
def get_battery_info(self): def get_battery_info(self):
data = self.send_nordic_command_sync(command=0xb9, data = self.send_nordic_command_sync(command=0xb9,