initial evdev driver
This commit is contained in:
@ -5,7 +5,7 @@ input = {
|
||||
'currInput': {},
|
||||
'prevInput': {},
|
||||
'currEvent': None,
|
||||
'firstEvent': None
|
||||
'firstEvent': None,
|
||||
'firstEvent': None,
|
||||
'currShortcutString': '',
|
||||
'consumeKey': False,
|
||||
|
@ -12,7 +12,10 @@ class inputManager():
|
||||
return environment
|
||||
def proceedInputEvent(self, environment):
|
||||
timeout = True
|
||||
environment, timeout = environment['runtime']['inputDriver'].getInput(environment)
|
||||
event = environment['runtime']['inputDriver'].getInput(environment)
|
||||
if event:
|
||||
timeout = False
|
||||
print(event)
|
||||
return environment, timeout
|
||||
|
||||
def grabDevices(self, environment):
|
||||
|
@ -29,7 +29,7 @@ class fenrir():
|
||||
self.shutdown()
|
||||
|
||||
def handleProcess(self):
|
||||
#self.environment, timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
|
||||
self.environment, timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
|
||||
timeout = True
|
||||
try:
|
||||
self.environment = self.environment['runtime']['screenManager'].update(self.environment)
|
||||
|
@ -16,38 +16,14 @@ class input():
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
def getInput(self, environment):
|
||||
|
||||
try:
|
||||
r, w, x = select(self.iDevices, [], [], environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'screen', 'screenUpdateDelay'))
|
||||
if r != []:
|
||||
timeout = False
|
||||
for fd in r:
|
||||
for event in self.iDevices[fd].read():
|
||||
if self.isFenrirKey(environment, event):
|
||||
environment['input']['consumeKey'] = not environment['input']['keyForeward'] and not environment['generalInformation']['suspend']
|
||||
if self.isConsumeKeypress(environment):
|
||||
self.writeUInput(self.uDevices[fd], event,environment)
|
||||
keyString = ''
|
||||
if self.isFenrirKey(environment, event):
|
||||
keyString = 'FENRIR'
|
||||
else:
|
||||
keyString = str(event.code)
|
||||
if event.type == evdev.ecodes.EV_KEY:
|
||||
if event.value != 0:
|
||||
environment['input']['currShortcut'][keyString] = 1 #event.value
|
||||
else:
|
||||
try:
|
||||
del(environment['input']['currShortcut'][keyString])
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Error while inputHandling",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.releaseDevices()
|
||||
time.sleep(0.01)
|
||||
|
||||
|
||||
return environment, timeout
|
||||
event = None
|
||||
r, w, x = select(self.iDevices, [], [], environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'screen', 'screenUpdateDelay'))
|
||||
print(len(list(r)))
|
||||
if r != []:
|
||||
for fd in r:
|
||||
event = self.iDevices[fd].read_one()
|
||||
return event
|
||||
return None
|
||||
|
||||
def writeUInput(self, uDevice, event,environment):
|
||||
uDevice.write_event(event)
|
||||
@ -58,8 +34,6 @@ class input():
|
||||
self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()}
|
||||
|
||||
def grabDevices(self):
|
||||
# if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'grabDevices'):
|
||||
# return
|
||||
for fd in self.iDevices:
|
||||
dev = self.iDevices[fd]
|
||||
cap = dev.capabilities()
|
||||
@ -73,7 +47,7 @@ class input():
|
||||
#dev.info.bustype,
|
||||
#'/dev/uinput'
|
||||
)
|
||||
#dev.grab()
|
||||
dev.grab()
|
||||
|
||||
def releaseDevices(self):
|
||||
for fd in self.iDevices:
|
||||
|
Reference in New Issue
Block a user