Merge branch 'bleed'
This commit is contained in:
commit
1968e436eb
1459
logs/fenrir.log
Normal file
1459
logs/fenrir.log
Normal file
File diff suppressed because one or more lines are too long
@ -16,6 +16,7 @@ class command():
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
self.env['runtime']['inputManager'].updateInputDevices()
|
||||
pass
|
||||
#self.env['runtime']['inputManager'].updateInputDevices()
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -166,6 +166,7 @@ class fenrirManager():
|
||||
#print('handleScreenUpdate:',time.time() - startTime)
|
||||
|
||||
def handlePlugInputDevice(self, event):
|
||||
self.environment['runtime']['inputManager'].handlePlugInputDevice(event['Data'])
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onPlugInputDevice', force=True)
|
||||
|
||||
def handleHeartBeat(self, event):
|
||||
|
@ -136,10 +136,12 @@ class inputManager():
|
||||
self.env['runtime']['inputDriver'].ungrabAllDevices()
|
||||
except Exception as e:
|
||||
pass
|
||||
def handlePlugInputDevice(self, eventData):
|
||||
self.env['runtime']['inputManager'].updateInputDevices(eventData)
|
||||
|
||||
def updateInputDevices(self):
|
||||
def updateInputDevices(self, newDevice = None):
|
||||
try:
|
||||
self.env['runtime']['inputDriver'].updateInputDevices()
|
||||
self.env['runtime']['inputDriver'].updateInputDevices(newDevice)
|
||||
except:
|
||||
pass
|
||||
self.handleDeviceGrab(True)
|
||||
|
@ -136,16 +136,19 @@ class screenManager():
|
||||
newScreenText.split('\n'))
|
||||
diffList = list(diff)
|
||||
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'newLinePause') and not typing:
|
||||
if not typing:
|
||||
self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')
|
||||
else:
|
||||
self.env['screen']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+')
|
||||
self.env['screen']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-')
|
||||
|
||||
# track highlighted
|
||||
if self.env['screen']['oldContentAttrib'] != self.env['screen']['newContentAttrib']:
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
|
||||
self.env['screen']['newAttribDelta'], self.env['screen']['newCursorAttrib'] = screen_utils.trackHighlights(self.env['screen']['oldContentAttrib'], self.env['screen']['newContentAttrib'], self.env['screen']['newContentText'], self.env['screen']['columns'])
|
||||
try:
|
||||
if self.env['screen']['oldContentAttrib'] != self.env['screen']['newContentAttrib']:
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
|
||||
self.env['screen']['newAttribDelta'], self.env['screen']['newCursorAttrib'] = screen_utils.trackHighlights(self.env['screen']['oldContentAttrib'], self.env['screen']['newContentAttrib'], self.env['screen']['newContentText'], self.env['screen']['columns'])
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('screenManager:update:highlight: ' + str(e),debug.debugLevel.ERROR)
|
||||
|
||||
def formatAttributes(self, attribute, attributeFormatString = None):
|
||||
if not attributeFormatString:
|
||||
|
@ -65,21 +65,22 @@ class driver(inputDriver):
|
||||
monitor.filter_by(subsystem='input')
|
||||
monitor.start()
|
||||
while active.value:
|
||||
validDevice = False
|
||||
validDevices = []
|
||||
device = monitor.poll(1)
|
||||
while device:
|
||||
try:
|
||||
if not '/sys/devices/virtual/input/' in device.sys_path:
|
||||
validDevice = True
|
||||
device = monitor.poll(0.5)
|
||||
if device.device_node:
|
||||
validDevices.append(str(device.device_node))
|
||||
device = monitor.poll(0.1)
|
||||
except:
|
||||
pass
|
||||
if validDevice:
|
||||
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None})
|
||||
if validDevices:
|
||||
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":validDevices})
|
||||
return time.time()
|
||||
def plugInputDeviceWatchdogTimer(self, active):
|
||||
time.sleep(10)
|
||||
return time.time()
|
||||
return None
|
||||
|
||||
def inputWatchdog(self,active , eventQueue):
|
||||
try:
|
||||
@ -142,24 +143,38 @@ class driver(inputDriver):
|
||||
uDevice.write_event(event)
|
||||
uDevice.syn()
|
||||
|
||||
def updateInputDevices(self, force = False, init = False):
|
||||
def updateInputDevices(self, newDevices = None, init = False):
|
||||
if init:
|
||||
self.removeAllDevices()
|
||||
deviceFileList = evdev.list_devices()
|
||||
if not force and False:
|
||||
|
||||
deviceFileList = None
|
||||
|
||||
if newDevices and not init:
|
||||
deviceFileList = newDevices
|
||||
else:
|
||||
deviceFileList = evdev.list_devices()
|
||||
if len(deviceFileList) == self.iDeviceNo:
|
||||
return
|
||||
if not deviceFileList:
|
||||
return
|
||||
|
||||
mode = self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper()
|
||||
|
||||
iDevicesFiles = []
|
||||
for device in self.iDevices:
|
||||
iDevicesFiles.append(self.iDevices[device].fn)
|
||||
if len(iDevicesFiles) == len(deviceFileList):
|
||||
return
|
||||
|
||||
eventType = evdev.events
|
||||
for deviceFile in deviceFileList:
|
||||
try:
|
||||
self.env['runtime']['debug'].writeDebugOut('loop start',debug.debugLevel.ERROR)
|
||||
if not deviceFile:
|
||||
continue
|
||||
if deviceFile == '':
|
||||
continue
|
||||
if deviceFile in iDevicesFiles:
|
||||
continue
|
||||
self.env['runtime']['debug'].writeDebugOut('open(deviceFile)',debug.debugLevel.ERROR)
|
||||
try:
|
||||
open(deviceFile)
|
||||
except Exception as e:
|
||||
@ -168,16 +183,28 @@ class driver(inputDriver):
|
||||
# 3 pos absolute
|
||||
# 2 pos relative
|
||||
# 1 Keys
|
||||
currDevice = evdev.InputDevice(deviceFile)
|
||||
if currDevice.name.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
||||
continue
|
||||
if currDevice.phys.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
||||
continue
|
||||
if 'BRLTTY' in currDevice.name.upper():
|
||||
self.env['runtime']['debug'].writeDebugOut('currDevice = evdev.InputDevice(deviceFile)',debug.debugLevel.ERROR)
|
||||
try:
|
||||
currDevice = evdev.InputDevice(deviceFile)
|
||||
except:
|
||||
continue
|
||||
self.env['runtime']['debug'].writeDebugOut('naming',debug.debugLevel.ERROR)
|
||||
try:
|
||||
if currDevice.name.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
||||
continue
|
||||
if currDevice.phys.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
||||
continue
|
||||
if 'BRLTTY' in currDevice.name.upper():
|
||||
continue
|
||||
self.env['runtime']['debug'].writeDebugOut('loaded name:'+ str(currDevice.name),debug.debugLevel.ERROR)
|
||||
except:
|
||||
pass
|
||||
self.env['runtime']['debug'].writeDebugOut('cap = currDevice.capabilities()',debug.debugLevel.ERROR)
|
||||
cap = currDevice.capabilities()
|
||||
self.env['runtime']['debug'].writeDebugOut('cap = currDevice.capabilities() fin',debug.debugLevel.ERROR)
|
||||
if mode in ['ALL','NOMICE']:
|
||||
if eventType.EV_KEY in cap:
|
||||
self.env['runtime']['debug'].writeDebugOut('eventType.EV_KEY in cap NoOfCaps: '+ str(cap) ,debug.debugLevel.ERROR)
|
||||
if 116 in cap[eventType.EV_KEY] and len(cap[eventType.EV_KEY]) < 10:
|
||||
self.env['runtime']['debug'].writeDebugOut('Device Skipped (has 116):' + currDevice.name,debug.debugLevel.INFO)
|
||||
continue
|
||||
@ -193,13 +220,17 @@ class driver(inputDriver):
|
||||
self.env['runtime']['debug'].writeDebugOut('Device added (NOMICE):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO)
|
||||
else:
|
||||
self.env['runtime']['debug'].writeDebugOut('Device Skipped (NOMICE):' + currDevice.name,debug.debugLevel.INFO)
|
||||
else:
|
||||
self.env['runtime']['debug'].writeDebugOut('Device Skipped (no EV_KEY):' + currDevice.name,debug.debugLevel.INFO)
|
||||
elif currDevice.name.upper() in mode.split(','):
|
||||
self.addDevice(currDevice)
|
||||
self.env['runtime']['debug'].writeDebugOut('Device added (Name):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO)
|
||||
self.env['runtime']['debug'].writeDebugOut('loop end',debug.debugLevel.ERROR)
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile +' ' + currDevice.name +' '+ str(e),debug.debugLevel.INFO)
|
||||
self.iDeviceNo = len(evdev.list_devices())
|
||||
self.updateMPiDevicesFD()
|
||||
|
||||
def updateMPiDevicesFD(self):
|
||||
try:
|
||||
for fd in self.iDevices:
|
||||
|
@ -10,6 +10,7 @@ from fenrirscreenreader.core.inputDriver import inputDriver
|
||||
|
||||
class driver(inputDriver):
|
||||
def __init__(self):
|
||||
self._isInitialized = False
|
||||
inputDriver.__init__(self)
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
Loading…
Reference in New Issue
Block a user