[FIX] hw_scanner: avoid flooding logs

When no devices are connected, avoid errors
No such file or directory: '/dev/input/by-id/'
This commit is contained in:
Martin Trigaux 2017-05-24 17:02:28 +02:00
parent 722017ca83
commit 7b0440d3f8
No known key found for this signature in database
GPG Key ID: 7B0E288E7C0F83A7
1 changed files with 3 additions and 0 deletions

View File

@ -122,6 +122,9 @@ class Scanner(Thread):
if not evdev:
return None
if not os.path.isdir(self.input_dir):
return None
new_devices = [device for device in listdir(self.input_dir)
if join(self.input_dir, device) not in [dev.evdev.fn for dev in self.open_devices]]
scanners = [device for device in new_devices