wacom: fetch the battery state during register

Any decent UI will want to know this given the device is online right now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
pull/146/head
Peter Hutterer 2019-07-14 18:08:03 +10:00 committed by Benjamin Tissoires
parent f488d4e130
commit 05fd213940
1 changed files with 6 additions and 0 deletions

View File

@ -939,6 +939,12 @@ class WacomProtocolSlate(WacomProtocolSpark):
fw_high = self.get_firmware_version(0)
fw_low = self.get_firmware_version(1)
logger.info(f'firmware is {fw_high}-{fw_low}')
battery, charging = self.get_battery_info()
if charging:
logger.debug(f'device is plugged in and charged at {battery}%')
else:
logger.debug(f'device is discharging: {battery}%')
self.emit('battery-status', battery, charging)
def retrieve_data(self):
try: