From 67e7dcbbaa5a9486a90d1b1e7f367f7797a1948c Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Tue, 24 Dec 2019 14:07:02 +0100 Subject: [PATCH] [modules/brightness] Add safe guards for glob --- bumblebee/modules/brightness.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/brightness.py b/bumblebee/modules/brightness.py index 22790d0..729d05d 100644 --- a/bumblebee/modules/brightness.py +++ b/bumblebee/modules/brightness.py @@ -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)