do not always grab on startup

This commit is contained in:
chrys 2018-05-16 23:40:36 +02:00
parent b5850abeed
commit d4a4605d6b

View File

@ -194,12 +194,15 @@ class driver(inputDriver):
self.updateMPiDevicesFD() self.updateMPiDevicesFD()
def updateMPiDevicesFD(self): def updateMPiDevicesFD(self):
for fd in self.iDevices: try:
if not fd in self.iDevicesFD: for fd in self.iDevices:
self.iDevicesFD.append(fd) if not fd in self.iDevicesFD:
for fd in self.iDevicesFD: self.iDevicesFD.append(fd)
if not fd in self.iDevices: for fd in self.iDevicesFD:
self.iDevicesFD.remove(fd) if not fd in self.iDevices:
self.iDevicesFD.remove(fd)
except:
pass
def mapEvent(self, event): def mapEvent(self, event):
if not self._initialized: if not self._initialized:
return None return None
@ -275,9 +278,10 @@ class driver(inputDriver):
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: init Uinput not possible: ' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: init Uinput not possible: ' + str(e),debug.debugLevel.ERROR)
return return
def addDevice(self, newDevice): def addDevice(self, newDevice):
self.iDevices[newDevice.fd] = newDevice self.iDevices[newDevice.fd] = newDevice
self.gDevices[newDevice.fd] = False
self.createUInputDev(newDevice.fd) self.createUInputDev(newDevice.fd)
self.grabDevice(newDevice.fd) #self.grabDevice(newDevice.fd)
def grabDevice(self, fd): def grabDevice(self, fd):
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
return return
@ -340,6 +344,5 @@ class driver(inputDriver):
self.removeDevice(fd) self.removeDevice(fd)
self.iDevices.clear() self.iDevices.clear()
self.uDevices.clear() self.uDevices.clear()
self.gDevices.clear()
self.iDeviceNo = 0 self.iDeviceNo = 0