retry grabbing
This commit is contained in:
parent
c50b64b2f1
commit
ca5ce66f31
@ -36,10 +36,12 @@ class inputDriver():
|
|||||||
return
|
return
|
||||||
def grabAllDevices(self):
|
def grabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
return True
|
||||||
def ungrabAllDevices(self):
|
def ungrabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
return True
|
||||||
def hasIDevices(self):
|
def hasIDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return False
|
return False
|
||||||
|
@ -57,11 +57,13 @@ class inputManager():
|
|||||||
if not self.noKeyPressed():
|
if not self.noKeyPressed():
|
||||||
return
|
return
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
|
self.executeDeviceGrab = False
|
||||||
return
|
return
|
||||||
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
||||||
self.ungrabAllDevices()
|
if self.ungrabAllDevices():
|
||||||
|
self.executeDeviceGrab = False
|
||||||
else:
|
else:
|
||||||
self.grabAllDevices()
|
if self.grabAllDevices():
|
||||||
self.executeDeviceGrab = False
|
self.executeDeviceGrab = False
|
||||||
def sendKeys(self, keyMacro):
|
def sendKeys(self, keyMacro):
|
||||||
for e in keyMacro:
|
for e in keyMacro:
|
||||||
@ -143,15 +145,17 @@ class inputManager():
|
|||||||
def grabAllDevices(self):
|
def grabAllDevices(self):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['inputDriver'].grabAllDevices()
|
return self.env['runtime']['inputDriver'].grabAllDevices()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
return False
|
||||||
|
return True
|
||||||
def ungrabAllDevices(self):
|
def ungrabAllDevices(self):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['inputDriver'].ungrabAllDevices()
|
return self.env['runtime']['inputDriver'].ungrabAllDevices()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
return False
|
||||||
|
return True
|
||||||
def handlePlugInputDevice(self, eventData):
|
def handlePlugInputDevice(self, eventData):
|
||||||
for deviceEntry in eventData:
|
for deviceEntry in eventData:
|
||||||
self.env['runtime']['inputManager'].updateInputDevices(deviceEntry['device'])
|
self.env['runtime']['inputManager'].updateInputDevices(deviceEntry['device'])
|
||||||
|
@ -48,7 +48,6 @@ class screenManager():
|
|||||||
self.env['runtime']['screenDriver'].getSessionInformation()
|
self.env['runtime']['screenDriver'].getSessionInformation()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
||||||
def isCurrScreenIgnoredChanged(self):
|
def isCurrScreenIgnoredChanged(self):
|
||||||
@ -60,16 +59,13 @@ class screenManager():
|
|||||||
if self.isCurrScreenIgnoredChanged():
|
if self.isCurrScreenIgnoredChanged():
|
||||||
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
||||||
self.env['runtime']['inputManager'].handleDeviceGrab()
|
self.env['runtime']['inputManager'].handleDeviceGrab()
|
||||||
|
|
||||||
if self.isScreenChange():
|
if self.isScreenChange():
|
||||||
self.changeBrailleScreen()
|
self.changeBrailleScreen()
|
||||||
|
|
||||||
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
||||||
self.update(eventData, 'onScreenChange')
|
self.update(eventData, 'onScreenChange')
|
||||||
self.env['screen']['lastScreenUpdate'] = time.time()
|
self.env['screen']['lastScreenUpdate'] = time.time()
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].interruptOutput()
|
self.env['runtime']['outputManager'].interruptOutput()
|
||||||
|
|
||||||
def handleScreenUpdate(self, eventData):
|
def handleScreenUpdate(self, eventData):
|
||||||
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
||||||
self.updateScreenIgnored()
|
self.updateScreenIgnored()
|
||||||
|
@ -281,16 +281,18 @@ class driver(inputDriver):
|
|||||||
self.iDevices[i].set_led(led , 1)
|
self.iDevices[i].set_led(led , 1)
|
||||||
def grabAllDevices(self):
|
def grabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
ok = True
|
||||||
for fd in self.iDevices:
|
for fd in self.iDevices:
|
||||||
self.grabDevice(fd)
|
ok = ok and self.grabDevice(fd)
|
||||||
|
return ok
|
||||||
def ungrabAllDevices(self):
|
def ungrabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
ok = True
|
||||||
for fd in self.iDevices:
|
for fd in self.iDevices:
|
||||||
self.ungrabDevice(fd)
|
ok = ok and self.ungrabDevice(fd)
|
||||||
|
return ok
|
||||||
def createUInputDev(self, fd):
|
def createUInputDev(self, fd):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
self.uDevices[fd] = None
|
self.uDevices[fd] = None
|
||||||
@ -324,7 +326,7 @@ class driver(inputDriver):
|
|||||||
self.createUInputDev(newDevice.fd)
|
self.createUInputDev(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 True
|
||||||
try:
|
try:
|
||||||
self.iDevices[fd].grab()
|
self.iDevices[fd].grab()
|
||||||
self.gDevices[fd] = True
|
self.gDevices[fd] = True
|
||||||
@ -333,15 +335,20 @@ class driver(inputDriver):
|
|||||||
self.gDevices[fd] = True
|
self.gDevices[fd] = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
def ungrabDevice(self,fd):
|
def ungrabDevice(self,fd):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
return
|
return True
|
||||||
try:
|
try:
|
||||||
self.gDevices[fd] = False
|
|
||||||
self.iDevices[fd].ungrab()
|
self.iDevices[fd].ungrab()
|
||||||
|
self.gDevices[fd] = False
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: ungrab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: ungrab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
||||||
except:
|
except IOError:
|
||||||
pass
|
self.gDevices[fd] = False
|
||||||
|
except Exception as e:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
def removeDevice(self,fd):
|
def removeDevice(self,fd):
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd) + ' ' +str(self.iDevices[fd]),debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd) + ' ' +str(self.iDevices[fd]),debug.debugLevel.INFO)
|
||||||
self.clearEventBuffer()
|
self.clearEventBuffer()
|
||||||
|
Loading…
Reference in New Issue
Block a user