Make sure all except statements are no longer empty, should help a lot with debugging.
This commit is contained in:
@ -126,7 +126,8 @@ class driver(inputDriver):
|
||||
|
||||
try:
|
||||
event = device.read_one()
|
||||
except:
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver handleInputEvent: Error reading event: ' + str(e), debug.debugLevel.ERROR)
|
||||
self.removeDevice(fd)
|
||||
continue
|
||||
while(event):
|
||||
@ -166,8 +167,8 @@ class driver(inputDriver):
|
||||
if uDevice:
|
||||
if self.gDevices[iDevice.fd]:
|
||||
self.writeUInput(uDevice, event)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver writeEventBuffer: Error writing event: ' + str(e), debug.debugLevel.ERROR)
|
||||
|
||||
def writeUInput(self, uDevice, event):
|
||||
if not self._initialized:
|
||||
@ -211,14 +212,16 @@ class driver(inputDriver):
|
||||
try:
|
||||
with open(deviceFile) as f:
|
||||
pass
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver updateInputDevices: Error opening device file: ' + str(e), debug.debugLevel.ERROR)
|
||||
continue
|
||||
# 3 pos absolute
|
||||
# 2 pos relative
|
||||
# 1 Keys
|
||||
try:
|
||||
currDevice = evdev.InputDevice(deviceFile)
|
||||
except:
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver createDeviceType: Error creating device: ' + str(e), debug.debugLevel.ERROR)
|
||||
continue
|
||||
try:
|
||||
# FIX: Check if attributes exist before accessing them
|
||||
@ -228,8 +231,8 @@ class driver(inputDriver):
|
||||
continue
|
||||
if hasattr(currDevice, 'name') and currDevice.name and 'BRLTTY' in currDevice.name.upper():
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver: Error checking device capabilities: ' + str(e), debug.debugLevel.ERROR)
|
||||
cap = currDevice.capabilities()
|
||||
if mode in ['ALL', 'NOMICE']:
|
||||
if eventType.EV_KEY in cap:
|
||||
@ -257,8 +260,8 @@ class driver(inputDriver):
|
||||
try:
|
||||
device_name = currDevice.name if hasattr(currDevice, 'name') else "unknown"
|
||||
self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile + ' ' + device_name + ' ' + str(e), debug.debugLevel.INFO)
|
||||
except:
|
||||
self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile + ' ' + str(e), debug.debugLevel.INFO)
|
||||
except Exception as ex:
|
||||
self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile + ' ' + str(ex), debug.debugLevel.INFO)
|
||||
self.iDeviceNo = len(evdev.list_devices())
|
||||
self.updateMPiDevicesFD()
|
||||
|
||||
@ -270,8 +273,8 @@ class driver(inputDriver):
|
||||
for fd in self.iDevicesFD:
|
||||
if not fd in self.iDevices:
|
||||
self.iDevicesFD.remove(fd)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver updateMPiDevicesFD: Error updating device file descriptors: ' + str(e), debug.debugLevel.ERROR)
|
||||
|
||||
def mapEvent(self, event):
|
||||
if not self._initialized:
|
||||
@ -294,7 +297,7 @@ class driver(inputDriver):
|
||||
mEvent['EventState'] = event.value
|
||||
mEvent['EventType'] = event.type
|
||||
return mEvent
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
return None
|
||||
|
||||
def getLedState(self, led=0):
|
||||
@ -379,16 +382,16 @@ class driver(inputDriver):
|
||||
# if it doesnt work clean up
|
||||
try:
|
||||
del(self.iDevices[newDevice.fd])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error removing iDevice: ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
del(self.uDevices[newDevice.fd])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error removing uDevice: ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
del(self.gDevices[newDevice.fd])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver addDevice: Error cleaning up gDevice: ' + str(e), debug.debugLevel.ERROR)
|
||||
|
||||
def grabDevice(self, fd):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||
@ -447,33 +450,33 @@ class driver(inputDriver):
|
||||
with self._deviceLock:
|
||||
try:
|
||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd) + ' ' + str(self.iDevices[fd]), debug.debugLevel.INFO)
|
||||
except:
|
||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd), debug.debugLevel.INFO)
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd) + ' Error: ' + str(e), debug.debugLevel.INFO)
|
||||
self.clearEventBuffer()
|
||||
try:
|
||||
self.ungrabDevice(fd)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error ungrabbing device ' + str(fd) + ': ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
self.iDevices[fd].close()
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error closing iDevice ' + str(fd) + ': ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
self.uDevices[fd].close()
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error closing uDevice ' + str(fd) + ': ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
del(self.iDevices[fd])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error deleting iDevice ' + str(fd) + ': ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
del(self.uDevices[fd])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error deleting uDevice ' + str(fd) + ': ' + str(e), debug.debugLevel.ERROR)
|
||||
try:
|
||||
del(self.gDevices[fd])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver removeDevice: Error deleting gDevice ' + str(fd) + ': ' + str(e), debug.debugLevel.ERROR)
|
||||
self.updateMPiDevicesFD()
|
||||
|
||||
def hasIDevices(self):
|
||||
@ -491,8 +494,8 @@ class driver(inputDriver):
|
||||
try:
|
||||
self.UInputinject.write(e.EV_KEY, e.ecodes[key], state)
|
||||
self.UInputinject.syn()
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('evdevDriver sendKey: Error sending key ' + str(key) + ': ' + str(e), debug.debugLevel.ERROR)
|
||||
|
||||
def removeAllDevices(self):
|
||||
if not self.hasIDevices():
|
||||
|
Reference in New Issue
Block a user