Update evdev.py

This commit is contained in:
chrys87 2016-09-27 16:21:23 +02:00 committed by GitHub
parent cdf1c00434
commit b3281ccdee

View File

@ -31,19 +31,20 @@ class driver():
for fd in r: for fd in r:
event = self.iDevices[fd].read_one() event = self.iDevices[fd].read_one()
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.code != 0:
return self.env['runtime']['inputDriver'].mapEvent(event) return self.env['runtime']['inputDriver'].mapEvent(event)
return None return None
def writeEventBuffer(self): def writeEventBuffer(self):
for iDevice, uDevice, event in self.env['input']['eventBuffer']: for iDevice, uDevice, event in self.env['input']['eventBuffer']:
self.writeUInput(uDevice, event) self.writeUInput(uDevice, event)
uDevice.syn()
def clearEventBuffer(self): def clearEventBuffer(self):
del self.env['input']['eventBuffer'][:] del self.env['input']['eventBuffer'][:]
def writeUInput(self, uDevice, event): def writeUInput(self, uDevice, event):
uDevice.write_event(event) uDevice.write_event(event)
uDevice.syn()
def getInputDevices(self): def getInputDevices(self):
# 3 pos absolute # 3 pos absolute
@ -62,7 +63,7 @@ class driver():
return None return None
mEvent = inputEvent.inputEvent mEvent = inputEvent.inputEvent
try: try:
mEvent['EventName'] = evdev.ecodes.keys[event.code].upper() mEvent['EventName'] = evdev.ecodes.keys[event.code]
mEvent['EventValue'] = event.code mEvent['EventValue'] = event.code
mEvent['EventSec'] = event.sec mEvent['EventSec'] = event.sec
mEvent['EventUsec'] = event.usec mEvent['EventUsec'] = event.usec