Update evdevDriver.py

This commit is contained in:
chrys87 2018-05-18 11:49:43 +02:00 committed by GitHub
parent 6a10d7b50c
commit 0ee55d1ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,22 +142,29 @@ class driver(inputDriver):
uDevice.write_event(event) uDevice.write_event(event)
uDevice.syn() uDevice.syn()
def updateInputDevices(self, force = False, init = False): def updateInputDevices(self, newDevices = None, init = False):
if init: if init:
self.removeAllDevices() 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: if len(deviceFileList) == self.iDeviceNo:
return return
mode = self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper() mode = self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper()
iDevicesFiles = [] iDevicesFiles = []
for device in self.iDevices: for device in self.iDevices:
iDevicesFiles.append(self.iDevices[device].fn) iDevicesFiles.append(self.iDevices[device].fn)
if len(iDevicesFiles) == len(deviceFileList):
return
eventType = evdev.events eventType = evdev.events
for deviceFile in deviceFileList: for deviceFile in deviceFileList:
try: try:
if not deviceFile:
continue
if deviceFile == '':
continue
if deviceFile in iDevicesFiles: if deviceFile in iDevicesFiles:
continue continue
try: try: