Merge branch 'master' into processing
This commit is contained in:
commit
6c7277ec12
@ -16,7 +16,6 @@ class command():
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
if not self.env['runtime']['screenManager'].isSuspendingScreen(): # remove if all works
|
||||
self.env['runtime']['inputManager'].updateInputDevices()
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -163,7 +163,8 @@ class commandManager():
|
||||
self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + newScript ,debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
def executeDefaultTrigger(self, trigger):
|
||||
def executeDefaultTrigger(self, trigger, force=False):
|
||||
if not force:
|
||||
if self.env['runtime']['screenManager'].isSuspendingScreen():
|
||||
return
|
||||
for command in sorted(self.env['commands'][trigger]):
|
||||
|
@ -61,7 +61,7 @@ class eventManager():
|
||||
elif event['Type'] == fenrirEventType.BrailleInput:
|
||||
pass
|
||||
elif event['Type'] == fenrirEventType.PlugInputDevice:
|
||||
pass
|
||||
self.env['runtime']['fenrirManager'].handlePlugInputDevice(event)
|
||||
elif event['Type'] == fenrirEventType.BrailleFlush:
|
||||
pass
|
||||
elif event['Type'] == fenrirEventType.ScreenChanged:
|
||||
|
@ -113,10 +113,10 @@ class fenrirManager():
|
||||
#print('handleScreenUpdate:',time.time() - startTime)
|
||||
|
||||
def handlePlugInputDevice(self, event):
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('PlugInputDevice')
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onPlugInputDevice', force=True)
|
||||
|
||||
def handleHeartBeat(self, event):
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onHeartBeat')
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onHeartBeat',force=True)
|
||||
#self.environment['runtime']['outputManager'].brailleText(flush=False)
|
||||
|
||||
def detectCommand(self):
|
||||
|
@ -36,7 +36,7 @@ class driver():
|
||||
def __init__(self):
|
||||
self._manager = multiprocessing.Manager()
|
||||
self.iDevices = {}
|
||||
self.iDevicesFD = None
|
||||
self.iDevicesFD = self._manager.list()
|
||||
self.uDevices = {}
|
||||
self.iDeviceNo = 0
|
||||
self._initialized = False
|
||||
@ -64,9 +64,6 @@ class driver():
|
||||
while active:
|
||||
devices = monitor.poll(2)
|
||||
if devices:
|
||||
for device in devices:
|
||||
if not active:
|
||||
return
|
||||
print('drin')
|
||||
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":''})
|
||||
|
||||
@ -78,23 +75,25 @@ class driver():
|
||||
def shutdown(self):
|
||||
if not self._initialized:
|
||||
return
|
||||
def inputWatchdog(self,active , iDevicesFD):
|
||||
def inputWatchdog(self,active , params):
|
||||
deviceFd = []
|
||||
for fd in iDevicesFD['dev']:
|
||||
deviceFd.append(fd)
|
||||
print('WD:',params['dev'],self.watchDog.value == 0)
|
||||
while self.watchDog.value == 0:
|
||||
if active.value == 0:
|
||||
return
|
||||
r = []
|
||||
while r == []:
|
||||
deviceFd = list(params['dev'])
|
||||
r, w, x = select(deviceFd, [], [], 2)
|
||||
print('select',r, w, x)
|
||||
self.watchDog.value = 0
|
||||
def getInputEvent(self):
|
||||
if not self.hasIDevices():
|
||||
self.watchDog.value = 1
|
||||
return None
|
||||
event = None
|
||||
r, w, x = select(self.iDevices, [], [], 0.0001)
|
||||
r, w, x = select(self.iDevices, [], [], 0.00001)
|
||||
print(self.iDevices,'read',r, w, x)
|
||||
if r != []:
|
||||
for fd in r:
|
||||
try:
|
||||
@ -153,7 +152,7 @@ class driver():
|
||||
if init:
|
||||
self.removeAllDevices()
|
||||
deviceFileList = evdev.list_devices()
|
||||
if not force:
|
||||
if not force and False:
|
||||
if len(deviceFileList) == self.iDeviceNo:
|
||||
return
|
||||
mode = self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper()
|
||||
@ -200,13 +199,15 @@ class driver():
|
||||
self.env['runtime']['debug'].writeDebugOut('Device added (Name):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO)
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut("Skip Inputdevice : " + deviceFile +' ' + str(e),debug.debugLevel.ERROR)
|
||||
self.iDevicesFD = multiprocessing.Array('i', len(self.iDevices))
|
||||
i = 0
|
||||
for fd in self.iDevices:
|
||||
self.iDevicesFD[i] = fd
|
||||
i +=1
|
||||
self.iDeviceNo = len(evdev.list_devices())
|
||||
|
||||
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)
|
||||
def mapEvent(self, event):
|
||||
if not self._initialized:
|
||||
return None
|
||||
@ -296,11 +297,8 @@ class driver():
|
||||
del(self.uDevices[fd])
|
||||
except:
|
||||
pass
|
||||
self.iDevicesFD = multiprocessing.Array('i', len(self.iDevices))
|
||||
i = 0
|
||||
for fd in self.iDevices:
|
||||
self.iDevicesFD[i] = fd
|
||||
i +=1
|
||||
self.updateMPiDevicesFD()
|
||||
|
||||
def hasIDevices(self):
|
||||
if not self._initialized:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user