From 5cd0a1dd67e97f4e20309fac9d20da22214d1159 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 7 Sep 2018 23:16:30 +0200 Subject: [PATCH] dont endless loop on mapping issues in evdev --- src/fenrirscreenreader/inputDriver/evdevDriver.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/fenrirscreenreader/inputDriver/evdevDriver.py b/src/fenrirscreenreader/inputDriver/evdevDriver.py index 6e9439ef..c8a8b69f 100644 --- a/src/fenrirscreenreader/inputDriver/evdevDriver.py +++ b/src/fenrirscreenreader/inputDriver/evdevDriver.py @@ -92,10 +92,10 @@ class driver(inputDriver): event = None foundKeyInSequence = False foreward = False - eventFired = False - for fd in r: + eventFired = False + for fd in r: try: - event = self.iDevices[fd].read_one() + event = self.iDevices[fd].read_one() except: self.removeDevice(fd) while(event): @@ -106,8 +106,10 @@ class driver(inputDriver): if event.code != 0: currMapEvent = self.mapEvent(event) if not currMapEvent: + event = self.iDevices[fd].read_one() continue if not isinstance(currMapEvent['EventName'], str): + event = self.iDevices[fd].read_one() continue if currMapEvent['EventState'] in [0,1,2]: eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent.copy()}) @@ -116,7 +118,7 @@ class driver(inputDriver): if event.type in [2,3]: foreward = True - event = self.iDevices[fd].read_one() + event = self.iDevices[fd].read_one() if not foundKeyInSequence: if foreward and not eventFired: self.writeEventBuffer()