diff --git a/src/fenrir/inputDriver/evdevDriver.py b/src/fenrir/inputDriver/evdevDriver.py index e32c7d14..c3c35c5e 100644 --- a/src/fenrir/inputDriver/evdevDriver.py +++ b/src/fenrir/inputDriver/evdevDriver.py @@ -70,23 +70,52 @@ class driver(inputDriver): return time.time() def plugInputDeviceWatchdogTimer(self, active): time.sleep(2.5) - return time.time() + return time.time() + def inputWatchdog(self,active , eventQueue): while active.value: r, w, x = select(self.iDevices, [], [], 0.5) for fd in r: event = None try: - event = self.iDevices[fd].read_one() - currMapEvent = self.mapEvent(event) - self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event]) - eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent}) + event = self.iDevices[fd].read_one() except: self.removeDevice(fd) - + foreward = False + while(event): + self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event]) + if event.type == evdev.events.EV_KEY: + if event.code != 0: + print(1) + currMapEvent = self.mapEvent(event) + if not currMapEvent: + print(2) + foreward = True + event = self.iDevices[fd].read_one() + continue + if not isinstance(currMapEvent['EventName'], str): + print(3) + foreward = True + event = self.iDevices[fd].read_one() + continue + if not foreward: + print(4) + if currMapEvent['EventState'] in [0,1,2]: + print(5) + eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent}) + print(currMapEvent) + print(6) + else: + print(7) + if not event.type in [0,1,4]: + foreward = True + event = self.iDevices[fd].read_one() + if foreward: + print('hmmm') + self.writeEventBuffer() + self.clearEventBuffer() def handleInputEvent(self, event): if not event: - print('skip') return if foreward: self.writeEventBuffer()