Update evdevDriver.py
This commit is contained in:
parent
cc7caf4ec1
commit
e1696ee077
@ -88,11 +88,12 @@ 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.7)
|
r, w, x = select(self.iDevices, [], [], 0.8)
|
||||||
for fd in r:
|
event = None
|
||||||
event = None
|
foundKeyInSequence = False
|
||||||
foreward = False
|
foreward = False
|
||||||
eventFired = False
|
eventFired = False
|
||||||
|
for fd in r:
|
||||||
try:
|
try:
|
||||||
event = self.iDevices[fd].read_one()
|
event = self.iDevices[fd].read_one()
|
||||||
except:
|
except:
|
||||||
@ -100,25 +101,26 @@ class driver(inputDriver):
|
|||||||
while(event):
|
while(event):
|
||||||
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
|
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
|
||||||
if event.type == evdev.events.EV_KEY:
|
if event.type == evdev.events.EV_KEY:
|
||||||
|
if not foundKeyInSequence:
|
||||||
|
foundKeyInSequence = True
|
||||||
if event.code != 0:
|
if event.code != 0:
|
||||||
currMapEvent = self.mapEvent(event)
|
currMapEvent = self.mapEvent(event)
|
||||||
if not currMapEvent:
|
if not currMapEvent:
|
||||||
foreward = True
|
continue
|
||||||
if not isinstance(currMapEvent['EventName'], str):
|
if not isinstance(currMapEvent['EventName'], str):
|
||||||
foreward = True
|
continue
|
||||||
if not foreward or eventFired:
|
if currMapEvent['EventState'] in [0,1,2]:
|
||||||
if currMapEvent['EventState'] in [0,1,2]:
|
eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent.copy()})
|
||||||
eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent.copy()})
|
eventFired = True
|
||||||
eventFired = True
|
|
||||||
else:
|
else:
|
||||||
pass
|
|
||||||
if event.type in [2,3]:
|
if event.type in [2,3]:
|
||||||
foreward = True
|
foreward = True
|
||||||
|
|
||||||
event = self.iDevices[fd].read_one()
|
event = self.iDevices[fd].read_one()
|
||||||
if foreward and not eventFired:
|
if not foundKeyInSequence:
|
||||||
self.writeEventBuffer()
|
if foreward and not eventFired:
|
||||||
self.clearEventBuffer()
|
self.writeEventBuffer()
|
||||||
|
self.clearEventBuffer()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut("INPUT WATCHDOG CRASH: "+str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut("INPUT WATCHDOG CRASH: "+str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user