[modules/brightness] Add safe guards for glob
This commit is contained in:
parent
38e31d8c5e
commit
67e7dcbbaa
1 changed files with 4 additions and 1 deletions
|
@ -35,7 +35,10 @@ class Module(bumblebee.engine.Module):
|
||||||
"xbacklight -{}%".format(step))
|
"xbacklight -{}%".format(step))
|
||||||
|
|
||||||
def find_device(self, device_path):
|
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):
|
def register_cmd(self, engine, upCmd, downCmd):
|
||||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP, cmd=upCmd)
|
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP, cmd=upCmd)
|
||||||
|
|
Loading…
Reference in a new issue