Merge branch 'bleed'
This commit is contained in:
commit
4e14b4aa9d
@ -12,4 +12,7 @@ Restart=always
|
||||
#User=fenrirscreenreader
|
||||
|
||||
[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
|
||||
|
@ -22,7 +22,7 @@ def main():
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 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, chdir=fenrirPath)
|
||||
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.start()
|
||||
|
||||
|
@ -16,6 +16,6 @@ class command():
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
self.env['runtime']['inputManager'].updateInputDevices()
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -166,6 +166,7 @@ class fenrirManager():
|
||||
#print('handleScreenUpdate:',time.time() - startTime)
|
||||
|
||||
def handlePlugInputDevice(self, event):
|
||||
self.environment['runtime']['inputManager'].updateInputDevices()
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onPlugInputDevice', force=True)
|
||||
|
||||
def handleHeartBeat(self, event):
|
||||
|
@ -282,6 +282,9 @@ class settingsManager():
|
||||
environment['runtime']['commandManager'] = commandManager.commandManager()
|
||||
environment['runtime']['commandManager'].initialize(environment)
|
||||
|
||||
environment['runtime']['helpManager'] = helpManager.helpManager()
|
||||
environment['runtime']['helpManager'].initialize(environment)
|
||||
|
||||
environment['runtime']['byteManager'] = byteManager.byteManager()
|
||||
environment['runtime']['byteManager'].initialize(environment)
|
||||
|
||||
@ -313,8 +316,6 @@ class settingsManager():
|
||||
environment['runtime']['cursorManager'].initialize(environment)
|
||||
environment['runtime']['applicationManager'] = applicationManager.applicationManager()
|
||||
environment['runtime']['applicationManager'].initialize(environment)
|
||||
environment['runtime']['helpManager'] = helpManager.helpManager()
|
||||
environment['runtime']['helpManager'].initialize(environment)
|
||||
environment['runtime']['headLineManager'] = headLineManager.headLineManager()
|
||||
environment['runtime']['headLineManager'].initialize(environment)
|
||||
environment['runtime']['tableManager'] = tableManager.tableManager()
|
||||
|
@ -54,8 +54,8 @@ class driver(inputDriver):
|
||||
self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR)
|
||||
return
|
||||
self.updateInputDevices()
|
||||
#if _udevAvailable:
|
||||
# self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
|
||||
if _udevAvailable:
|
||||
self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
|
||||
#else:
|
||||
# self.env['runtime']['processManager'].addSimpleEventThread(fenrirEventType.PlugInputDevice, self.plugInputDeviceWatchdogTimer)
|
||||
self.env['runtime']['processManager'].addCustomEventThread(self.inputWatchdog)
|
||||
@ -65,10 +65,16 @@ class driver(inputDriver):
|
||||
monitor.filter_by(subsystem='input')
|
||||
monitor.start()
|
||||
while active.value:
|
||||
devices = monitor.poll(2)
|
||||
if devices:
|
||||
while monitor.poll(1):
|
||||
validDevice = False
|
||||
device = 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
|
||||
if validDevice:
|
||||
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None})
|
||||
return time.time()
|
||||
def plugInputDeviceWatchdogTimer(self, active):
|
||||
@ -78,7 +84,7 @@ class driver(inputDriver):
|
||||
def inputWatchdog(self,active , eventQueue):
|
||||
try:
|
||||
while active.value:
|
||||
r, w, x = select(self.iDevices, [], [], 0.5)
|
||||
r, w, x = select(self.iDevices, [], [], 0.7)
|
||||
for fd in r:
|
||||
event = None
|
||||
foreward = False
|
||||
@ -165,6 +171,8 @@ class driver(inputDriver):
|
||||
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():
|
||||
continue
|
||||
cap = currDevice.capabilities()
|
||||
@ -194,12 +202,15 @@ class driver(inputDriver):
|
||||
self.updateMPiDevicesFD()
|
||||
|
||||
def updateMPiDevicesFD(self):
|
||||
for fd in self.iDevices:
|
||||
if not fd in self.iDevicesFD:
|
||||
self.iDevicesFD.append(fd)
|
||||
for fd in self.iDevicesFD:
|
||||
if not fd in self.iDevices:
|
||||
self.iDevicesFD.remove(fd)
|
||||
try:
|
||||
for fd in self.iDevices:
|
||||
if not fd in self.iDevicesFD:
|
||||
self.iDevicesFD.append(fd)
|
||||
for fd in self.iDevicesFD:
|
||||
if not fd in self.iDevices:
|
||||
self.iDevicesFD.remove(fd)
|
||||
except:
|
||||
pass
|
||||
def mapEvent(self, event):
|
||||
if not self._initialized:
|
||||
return None
|
||||
@ -243,11 +254,13 @@ class driver(inputDriver):
|
||||
return
|
||||
for fd in self.iDevices:
|
||||
self.grabDevice(fd)
|
||||
|
||||
def ungrabAllDevices(self):
|
||||
if not self._initialized:
|
||||
return
|
||||
for fd in self.iDevices:
|
||||
self.ungrabDevice(fd)
|
||||
|
||||
def createUInputDev(self, fd):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||
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)
|
||||
return
|
||||
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.gDevices[newDevice.fd] = False
|
||||
self.createUInputDev(newDevice.fd)
|
||||
self.grabDevice(newDevice.fd)
|
||||
def grabDevice(self, fd):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||
return
|
||||
@ -295,7 +309,7 @@ class driver(inputDriver):
|
||||
except:
|
||||
pass
|
||||
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()
|
||||
try:
|
||||
self.ungrabDevice(fd)
|
||||
@ -340,6 +354,5 @@ class driver(inputDriver):
|
||||
self.removeDevice(fd)
|
||||
self.iDevices.clear()
|
||||
self.uDevices.clear()
|
||||
self.gDevices.clear()
|
||||
self.iDeviceNo = 0
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user