improve error handling
This commit is contained in:
parent
23edc5eaa7
commit
ce4da1834f
@ -62,9 +62,11 @@ class inputManager():
|
|||||||
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
||||||
if self.ungrabAllDevices():
|
if self.ungrabAllDevices():
|
||||||
self.executeDeviceGrab = False
|
self.executeDeviceGrab = False
|
||||||
|
print('ungrabbed')
|
||||||
else:
|
else:
|
||||||
if self.grabAllDevices():
|
if self.grabAllDevices():
|
||||||
self.executeDeviceGrab = False
|
self.executeDeviceGrab = False
|
||||||
|
print('grabbed')
|
||||||
def sendKeys(self, keyMacro):
|
def sendKeys(self, keyMacro):
|
||||||
for e in keyMacro:
|
for e in keyMacro:
|
||||||
key = ''
|
key = ''
|
||||||
|
@ -321,9 +321,24 @@ class driver(inputDriver):
|
|||||||
return
|
return
|
||||||
def addDevice(self, newDevice):
|
def addDevice(self, newDevice):
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device added: ' + str(newDevice.fd) + ' ' +str(newDevice),debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device added: ' + str(newDevice.fd) + ' ' +str(newDevice),debug.debugLevel.INFO)
|
||||||
self.iDevices[newDevice.fd] = newDevice
|
try:
|
||||||
self.gDevices[newDevice.fd] = False
|
self.iDevices[newDevice.fd] = newDevice
|
||||||
self.createUInputDev(newDevice.fd)
|
self.createUInputDev(newDevice.fd)
|
||||||
|
self.gDevices[newDevice.fd] = False
|
||||||
|
except:
|
||||||
|
# if it doesnt work clean up
|
||||||
|
try:
|
||||||
|
del(self.iDevices[newDevice.fd])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
del(self.uDevices[newDevice.fd])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
del(self.gDevices[newDevice.fd])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
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 True
|
return True
|
||||||
@ -333,7 +348,7 @@ class driver(inputDriver):
|
|||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
||||||
except IOError:
|
except IOError:
|
||||||
self.gDevices[fd] = True
|
self.gDevices[fd] = True
|
||||||
self.removeDevice(fd)
|
#self.removeDevice(fd)
|
||||||
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 False
|
||||||
@ -347,7 +362,7 @@ class driver(inputDriver):
|
|||||||
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 IOError:
|
except IOError:
|
||||||
self.gDevices[fd] = False
|
self.gDevices[fd] = False
|
||||||
self.removeDevice(fd)
|
#self.removeDevice(fd)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user