From 05fd2139400514a80f39c7fc303234b7fb1e6e2c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 14 Jul 2019 18:08:03 +1000 Subject: [PATCH] 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 --- tuhi/wacom.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 9c98292..e016872 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -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: