fix instance issue

This commit is contained in:
chrys 2018-05-14 20:03:39 +02:00
parent 670afb5c58
commit 79cc8ef13d
2 changed files with 8 additions and 12 deletions

View File

@ -49,12 +49,10 @@ class screenManager():
if self.toggleDeviceGrab: if self.toggleDeviceGrab:
if self.env['runtime']['inputManager'].noKeyPressed(): if self.env['runtime']['inputManager'].noKeyPressed():
if self.getCurrScreenIgnored(): if self.getCurrScreenIgnored():
print('ungrab')
self.env['runtime']['inputManager'].ungrabAllDevices() self.env['runtime']['inputManager'].ungrabAllDevices()
self.env['runtime']['outputManager'].interruptOutput() self.env['runtime']['outputManager'].interruptOutput()
else: else:
self.env['runtime']['inputManager'].grabAllDevices() self.env['runtime']['inputManager'].grabAllDevices()
print('grab')
self.toggleDeviceGrab = False self.toggleDeviceGrab = False
def handleScreenUpdate(self, eventData): def handleScreenUpdate(self, eventData):

View File

@ -177,19 +177,16 @@ class driver(inputDriver):
self.env['runtime']['debug'].writeDebugOut('Device Skipped (< 60 keys):' + currDevice.name,debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut('Device Skipped (< 60 keys):' + currDevice.name,debug.debugLevel.INFO)
continue continue
if mode == 'ALL': if mode == 'ALL':
self.iDevices[currDevice.fd] = currDevice self.addDevice(currDevice)
self.addDevice(currDevice.fd)
self.env['runtime']['debug'].writeDebugOut('Device added (ALL):' + self.iDevices[currDevice.fd].name, debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut('Device added (ALL):' + self.iDevices[currDevice.fd].name, debug.debugLevel.INFO)
elif mode == 'NOMICE': elif mode == 'NOMICE':
if not ((eventType.EV_REL in cap) or (eventType.EV_ABS in cap)): if not ((eventType.EV_REL in cap) or (eventType.EV_ABS in cap)):
self.iDevices[currDevice.fd] = currDevice self.addDevice(currDevice)
self.addDevice(currDevice.fd)
self.env['runtime']['debug'].writeDebugOut('Device added (NOMICE):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut('Device added (NOMICE):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO)
else: else:
self.env['runtime']['debug'].writeDebugOut('Device Skipped (NOMICE):' + currDevice.name,debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut('Device Skipped (NOMICE):' + currDevice.name,debug.debugLevel.INFO)
elif currDevice.name.upper() in mode.split(','): elif currDevice.name.upper() in mode.split(','):
self.iDevices[currDevice.fd] = currDevice self.addDevice(currDevice)
self.addDevice(currDevice.fd)
self.env['runtime']['debug'].writeDebugOut('Device added (Name):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut('Device added (Name):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO)
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile +' ' + currDevice.name +' '+ str(e),debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile +' ' + currDevice.name +' '+ str(e),debug.debugLevel.INFO)
@ -259,7 +256,7 @@ class driver(inputDriver):
test = self.uDevices[fd] test = self.uDevices[fd]
return return
except KeyError: except KeyError:
pass self.uDevices[fd] = None
if self.uDevices[fd] != None: if self.uDevices[fd] != None:
return return
try: try:
@ -277,7 +274,8 @@ class driver(inputDriver):
except Exception as e: except Exception as e:
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, fd): def addDevice(self, newDevice, fd):
self.iDevices[newDevice.fd] = newDevice
self.createUInputDev(fd) self.createUInputDev(fd)
self.grabDevice(fd) self.grabDevice(fd)
def grabDevice(self, fd): def grabDevice(self, fd):
@ -292,8 +290,8 @@ class driver(inputDriver):
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
return return
try: try:
self.gDevices[fd] = False
self.iDevices[fd].ungrab() self.iDevices[fd].ungrab()
self.gDevices[fd] = False
except: except:
pass pass
def removeDevice(self,fd): def removeDevice(self,fd):
@ -322,7 +320,7 @@ class driver(inputDriver):
del(self.gDevices[fd]) del(self.gDevices[fd])
except: except:
pass pass
self.MPiDevicesFD() self.updateMPiDevicesFD()
def hasIDevices(self): def hasIDevices(self):
if not self._initialized: if not self._initialized: