fix command handling
This commit is contained in:
parent
35fb684627
commit
1c274a7c11
@ -71,6 +71,7 @@ class driver(inputDriver):
|
|||||||
def plugInputDeviceWatchdogTimer(self, active):
|
def plugInputDeviceWatchdogTimer(self, active):
|
||||||
time.sleep(2.5)
|
time.sleep(2.5)
|
||||||
return time.time()
|
return time.time()
|
||||||
|
|
||||||
def inputWatchdog(self,active , eventQueue):
|
def inputWatchdog(self,active , eventQueue):
|
||||||
while active.value:
|
while active.value:
|
||||||
r, w, x = select(self.iDevices, [], [], 0.5)
|
r, w, x = select(self.iDevices, [], [], 0.5)
|
||||||
@ -78,15 +79,43 @@ class driver(inputDriver):
|
|||||||
event = None
|
event = None
|
||||||
try:
|
try:
|
||||||
event = self.iDevices[fd].read_one()
|
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})
|
|
||||||
except:
|
except:
|
||||||
self.removeDevice(fd)
|
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):
|
def handleInputEvent(self, event):
|
||||||
if not event:
|
if not event:
|
||||||
print('skip')
|
|
||||||
return
|
return
|
||||||
if foreward:
|
if foreward:
|
||||||
self.writeEventBuffer()
|
self.writeEventBuffer()
|
||||||
|
Loading…
Reference in New Issue
Block a user