[modules/battery_all] Add logging if no battery is found

This commit is contained in:
Tobias Witek 2019-10-20 14:28:45 +02:00
parent 82154bb4a9
commit 603fc1ddc6

View file

@ -11,6 +11,7 @@ Parameters:
import os import os
import glob import glob
import logging
import bumblebee.input import bumblebee.input
import bumblebee.output import bumblebee.output
@ -29,8 +30,8 @@ class Module(bumblebee.engine.Module):
for battery in os.listdir('/sys/class/power_supply/'): for battery in os.listdir('/sys/class/power_supply/'):
if not any(i in battery for i in ['AC', 'hidpp']): if not any(i in battery for i in ['AC', 'hidpp']):
self._batteries.append("/sys/class/power_supply/" + battery) self._batteries.append("/sys/class/power_supply/" + battery)
except: except as e:
pass logging.exception("unable to detect batteries: {}".format(str(e)))
super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.capacity)) super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.capacity))