add delay to sync

This commit is contained in:
Chrys 2019-10-22 00:08:44 +02:00
parent 617942f828
commit 1bb2d35425
2 changed files with 8 additions and 11 deletions

View File

@ -53,13 +53,10 @@ class inputManager():
if force: if force:
self.setExecuteDeviceGrab() self.setExecuteDeviceGrab()
if not self.executeDeviceGrab: if not self.executeDeviceGrab:
print('1')
return return
if self.env['input']['eventBuffer'] != []: if self.env['input']['eventBuffer'] != []:
print('2', self.env['input']['eventBuffer'])
return return
if not self.noKeyPressed(): if not self.noKeyPressed():
print('3')
return return
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
self.executeDeviceGrab = False self.executeDeviceGrab = False
@ -224,7 +221,7 @@ class inputManager():
def setLastDeepestInput(self, currentDeepestInput): def setLastDeepestInput(self, currentDeepestInput):
self.lastDeepestInput = currentDeepestInput self.lastDeepestInput = currentDeepestInput
def clearLastDeepInput(self): def clearLastDeepInput(self):
self.lastDeepestInput = [] self.lastDeepestInput = []
def getLastInputTime(self): def getLastInputTime(self):
return self.lastInputTime return self.lastInputTime
def getLastDeepestInput(self): def getLastDeepestInput(self):
@ -266,7 +263,7 @@ class inputManager():
shortcut = [] shortcut = []
self.env['input']['shortcutRepeat'] = 1 self.env['input']['shortcutRepeat'] = 1
shortcut.append(self.env['input']['shortcutRepeat']) shortcut.append(self.env['input']['shortcutRepeat'])
shortcut.append(self.env['input']['currInput']) shortcut.append(self.env['input']['currInput'])
self.env['runtime']['debug'].writeDebugOut("currShortcut " + str(shortcut) ,debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut("currShortcut " + str(shortcut) ,debug.debugLevel.INFO)
return str(shortcut) return str(shortcut)

View File

@ -73,7 +73,7 @@ class driver(inputDriver):
try: try:
if currDevice.name.upper() in ['','SPEAKUP','FENRIR-UINPUT']: if currDevice.name.upper() in ['','SPEAKUP','FENRIR-UINPUT']:
ignorePlug = True ignorePlug = True
if currDevice.phys.upper() in ['','SPEAKUP']: if currDevice.phys.upper() in ['','SPEAKUP','FENRIR-UINPUT']:
ignorePlug = True ignorePlug = True
if 'BRLTTY' in currDevice.name.upper(): if 'BRLTTY' in currDevice.name.upper():
ignorePlug = True ignorePlug = True
@ -150,6 +150,7 @@ class driver(inputDriver):
if not self._initialized: if not self._initialized:
return return
uDevice.write_event(event) uDevice.write_event(event)
time.sleep(0.0000002)
uDevice.syn() uDevice.syn()
def updateInputDevices(self, newDevices = None, init = False): def updateInputDevices(self, newDevices = None, init = False):
@ -199,7 +200,7 @@ class driver(inputDriver):
try: try:
if currDevice.name.upper() in ['','SPEAKUP','FENRIR-UINPUT']: if currDevice.name.upper() in ['','SPEAKUP','FENRIR-UINPUT']:
continue continue
if currDevice.phys.upper() in ['','SPEAKUP']: if currDevice.phys.upper() in ['','SPEAKUP','FENRIR-UINPUT']:
continue continue
if 'BRLTTY' in currDevice.name.upper(): if 'BRLTTY' in currDevice.name.upper():
continue continue
@ -317,17 +318,17 @@ class driver(inputDriver):
if self.uDevices[fd] != None: if self.uDevices[fd] != None:
return return
try: try:
self.uDevices[fd] = UInput.from_device(self.iDevices[fd], name='fenrir-uinput') self.uDevices[fd] = UInput.from_device(self.iDevices[fd], name='fenrir-uinput', phys='fenrir-uinput')
except Exception as e: except Exception as e:
try: try:
print(e)
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: compat fallback: ' + str(e),debug.debugLevel.WARNING) self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: compat fallback: ' + str(e),debug.debugLevel.WARNING)
dev = self.iDevices[fd] dev = self.iDevices[fd]
cap = dev.capabilities() cap = dev.capabilities()
del cap[0] del cap[0]
self.uDevices[fd] = UInput( self.uDevices[fd] = UInput(
cap, cap,
'fenrir-uinput', name = 'fenrir-uinput',
phys = 'fenrir-uinput'
) )
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: init Uinput not possible: ' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: init Uinput not possible: ' + str(e),debug.debugLevel.ERROR)
@ -356,7 +357,6 @@ class driver(inputDriver):
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
return True return True
try: try:
print(self.iDevices[fd])
self.iDevices[fd].grab() self.iDevices[fd].grab()
self.gDevices[fd] = True self.gDevices[fd] = True
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)