From 0ee55d1edeb3e26ba2db2411a23fd0baa138b5f3 Mon Sep 17 00:00:00 2001 From: chrys87 Date: Fri, 18 May 2018 11:49:43 +0200 Subject: [PATCH] Update evdevDriver.py --- .../inputDriver/evdevDriver.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/fenrirscreenreader/inputDriver/evdevDriver.py b/src/fenrirscreenreader/inputDriver/evdevDriver.py index f71c56d6..44202feb 100644 --- a/src/fenrirscreenreader/inputDriver/evdevDriver.py +++ b/src/fenrirscreenreader/inputDriver/evdevDriver.py @@ -142,22 +142,29 @@ class driver(inputDriver): uDevice.write_event(event) uDevice.syn() - def updateInputDevices(self, force = False, init = False): + def updateInputDevices(self, newDevices = None, init = False): if init: self.removeAllDevices() - deviceFileList = evdev.list_devices() - if not force and False: + + print(newDevices) + if newDevices and not init: + deviceFileList = newDevices + else: + deviceFileList = evdev.list_devices() if len(deviceFileList) == self.iDeviceNo: - return + return mode = self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper() iDevicesFiles = [] for device in self.iDevices: iDevicesFiles.append(self.iDevices[device].fn) - if len(iDevicesFiles) == len(deviceFileList): - return + eventType = evdev.events for deviceFile in deviceFileList: try: + if not deviceFile: + continue + if deviceFile == '': + continue if deviceFile in iDevicesFiles: continue try: