Merge branch 'bleed'

This commit is contained in:
chrys 2018-05-17 20:25:26 +02:00
commit 4e14b4aa9d
6 changed files with 42 additions and 24 deletions

View File

@ -12,4 +12,7 @@ Restart=always
#User=fenrirscreenreader #User=fenrirscreenreader
[Install] [Install]
WantedBy=sound.target # start as early as possible in boot process
#WantedBy=sound.target
# start as soon the login prompt is available
WantedBy=getty.target

View File

@ -22,7 +22,7 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
# for debug in foreground # for debug in foreground
#daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, foreground=True,chdir=os.path.dirname(os.path.realpath(fenrirVersion.__file__))) daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, foreground=True,chdir=fenrirPath)
daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, chdir=fenrirPath) #daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, chdir=fenrirPath)
daemon.start() daemon.start()

View File

@ -16,6 +16,6 @@ class command():
def getDescription(self): def getDescription(self):
return 'No description found' return 'No description found'
def run(self): def run(self):
self.env['runtime']['inputManager'].updateInputDevices() pass
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -166,6 +166,7 @@ class fenrirManager():
#print('handleScreenUpdate:',time.time() - startTime) #print('handleScreenUpdate:',time.time() - startTime)
def handlePlugInputDevice(self, event): def handlePlugInputDevice(self, event):
self.environment['runtime']['inputManager'].updateInputDevices()
self.environment['runtime']['commandManager'].executeDefaultTrigger('onPlugInputDevice', force=True) self.environment['runtime']['commandManager'].executeDefaultTrigger('onPlugInputDevice', force=True)
def handleHeartBeat(self, event): def handleHeartBeat(self, event):

View File

@ -282,6 +282,9 @@ class settingsManager():
environment['runtime']['commandManager'] = commandManager.commandManager() environment['runtime']['commandManager'] = commandManager.commandManager()
environment['runtime']['commandManager'].initialize(environment) environment['runtime']['commandManager'].initialize(environment)
environment['runtime']['helpManager'] = helpManager.helpManager()
environment['runtime']['helpManager'].initialize(environment)
environment['runtime']['byteManager'] = byteManager.byteManager() environment['runtime']['byteManager'] = byteManager.byteManager()
environment['runtime']['byteManager'].initialize(environment) environment['runtime']['byteManager'].initialize(environment)
@ -313,8 +316,6 @@ class settingsManager():
environment['runtime']['cursorManager'].initialize(environment) environment['runtime']['cursorManager'].initialize(environment)
environment['runtime']['applicationManager'] = applicationManager.applicationManager() environment['runtime']['applicationManager'] = applicationManager.applicationManager()
environment['runtime']['applicationManager'].initialize(environment) environment['runtime']['applicationManager'].initialize(environment)
environment['runtime']['helpManager'] = helpManager.helpManager()
environment['runtime']['helpManager'].initialize(environment)
environment['runtime']['headLineManager'] = headLineManager.headLineManager() environment['runtime']['headLineManager'] = headLineManager.headLineManager()
environment['runtime']['headLineManager'].initialize(environment) environment['runtime']['headLineManager'].initialize(environment)
environment['runtime']['tableManager'] = tableManager.tableManager() environment['runtime']['tableManager'] = tableManager.tableManager()

View File

@ -54,8 +54,8 @@ class driver(inputDriver):
self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR)
return return
self.updateInputDevices() self.updateInputDevices()
#if _udevAvailable: if _udevAvailable:
# self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev) self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
#else: #else:
# self.env['runtime']['processManager'].addSimpleEventThread(fenrirEventType.PlugInputDevice, self.plugInputDeviceWatchdogTimer) # self.env['runtime']['processManager'].addSimpleEventThread(fenrirEventType.PlugInputDevice, self.plugInputDeviceWatchdogTimer)
self.env['runtime']['processManager'].addCustomEventThread(self.inputWatchdog) self.env['runtime']['processManager'].addCustomEventThread(self.inputWatchdog)
@ -65,10 +65,16 @@ class driver(inputDriver):
monitor.filter_by(subsystem='input') monitor.filter_by(subsystem='input')
monitor.start() monitor.start()
while active.value: while active.value:
devices = monitor.poll(2) validDevice = False
if devices: device = monitor.poll(1)
while monitor.poll(1): while device:
try:
if not '/sys/devices/virtual/input/' in device.sys_path:
validDevice = True
device = monitor.poll(0.5)
except:
pass pass
if validDevice:
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None}) eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None})
return time.time() return time.time()
def plugInputDeviceWatchdogTimer(self, active): def plugInputDeviceWatchdogTimer(self, active):
@ -78,7 +84,7 @@ class driver(inputDriver):
def inputWatchdog(self,active , eventQueue): def inputWatchdog(self,active , eventQueue):
try: try:
while active.value: while active.value:
r, w, x = select(self.iDevices, [], [], 0.5) r, w, x = select(self.iDevices, [], [], 0.7)
for fd in r: for fd in r:
event = None event = None
foreward = False foreward = False
@ -165,6 +171,8 @@ class driver(inputDriver):
currDevice = evdev.InputDevice(deviceFile) currDevice = evdev.InputDevice(deviceFile)
if currDevice.name.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']: if currDevice.name.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
continue continue
if currDevice.phys.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
continue
if 'BRLTTY' in currDevice.name.upper(): if 'BRLTTY' in currDevice.name.upper():
continue continue
cap = currDevice.capabilities() cap = currDevice.capabilities()
@ -194,12 +202,15 @@ class driver(inputDriver):
self.updateMPiDevicesFD() self.updateMPiDevicesFD()
def updateMPiDevicesFD(self): def updateMPiDevicesFD(self):
try:
for fd in self.iDevices: for fd in self.iDevices:
if not fd in self.iDevicesFD: if not fd in self.iDevicesFD:
self.iDevicesFD.append(fd) self.iDevicesFD.append(fd)
for fd in self.iDevicesFD: for fd in self.iDevicesFD:
if not fd in self.iDevices: if not fd in self.iDevices:
self.iDevicesFD.remove(fd) self.iDevicesFD.remove(fd)
except:
pass
def mapEvent(self, event): def mapEvent(self, event):
if not self._initialized: if not self._initialized:
return None return None
@ -243,11 +254,13 @@ class driver(inputDriver):
return return
for fd in self.iDevices: for fd in self.iDevices:
self.grabDevice(fd) self.grabDevice(fd)
def ungrabAllDevices(self): def ungrabAllDevices(self):
if not self._initialized: if not self._initialized:
return return
for fd in self.iDevices: for fd in self.iDevices:
self.ungrabDevice(fd) self.ungrabDevice(fd)
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
@ -275,9 +288,10 @@ class driver(inputDriver):
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, newDevice): def addDevice(self, newDevice):
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device added: ' + str(newDevice.fd) + ' ' +str(newDevice),debug.debugLevel.INFO)
self.iDevices[newDevice.fd] = newDevice self.iDevices[newDevice.fd] = newDevice
self.gDevices[newDevice.fd] = False
self.createUInputDev(newDevice.fd) self.createUInputDev(newDevice.fd)
self.grabDevice(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
@ -295,7 +309,7 @@ class driver(inputDriver):
except: except:
pass pass
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.ERROR) self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd) + ' ' +str(self.iDevices[fd]),debug.debugLevel.INFO)
self.clearEventBuffer() self.clearEventBuffer()
try: try:
self.ungrabDevice(fd) self.ungrabDevice(fd)
@ -340,6 +354,5 @@ class driver(inputDriver):
self.removeDevice(fd) self.removeDevice(fd)
self.iDevices.clear() self.iDevices.clear()
self.uDevices.clear() self.uDevices.clear()
self.gDevices.clear()
self.iDeviceNo = 0 self.iDeviceNo = 0