[modules/brightness] Add safe guards for glob

This commit is contained in:
Tobias Witek 2019-12-24 14:07:02 +01:00
parent 38e31d8c5e
commit 67e7dcbbaa

View file

@ -35,7 +35,10 @@ class Module(bumblebee.engine.Module):
"xbacklight -{}%".format(step))
def find_device(self, device_path):
return glob.glob(device_path)[0]
res = glob.glob(device_path)
if len(res) == 0:
return device_path
return res[0]
def register_cmd(self, engine, upCmd, downCmd):
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP, cmd=upCmd)