fix crash for mute key

This commit is contained in:
chrys 2018-09-07 23:01:32 +02:00
parent 8614e19b25
commit 427f63d0d5

View File

@ -106,16 +106,16 @@ class driver(inputDriver):
if event.code != 0: if event.code != 0:
currMapEvent = self.mapEvent(event) currMapEvent = self.mapEvent(event)
if not currMapEvent: if not currMapEvent:
continue continue
if not isinstance(currMapEvent['EventName'], str): if not isinstance(currMapEvent['EventName'], str):
continue continue
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:
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 not foundKeyInSequence: if not foundKeyInSequence:
if foreward and not eventFired: if foreward and not eventFired:
@ -237,7 +237,14 @@ class driver(inputDriver):
return None return None
mEvent = inputData.inputEvent mEvent = inputData.inputEvent
try: try:
# mute is a list = ['KEY_MIN_INTERESTING', 'KEY_MUTE']
mEvent['EventName'] = evdev.ecodes.keys[event.code] mEvent['EventName'] = evdev.ecodes.keys[event.code]
if isinstance(mEvent['EventName'], list):
if len(mEvent['EventName']) > 0:
mEvent['EventName'] = mEvent['EventName'][0]
if isinstance(mEvent['EventName'], list):
if len(mEvent['EventName']) > 0:
mEvent['EventName'] = mEvent['EventName'][0]
mEvent['EventValue'] = event.code mEvent['EventValue'] = event.code
mEvent['EventSec'] = event.sec mEvent['EventSec'] = event.sec
mEvent['EventUsec'] = event.usec mEvent['EventUsec'] = event.usec