fire event for plug only once

This commit is contained in:
chrys 2018-05-17 00:24:57 +02:00
parent 6c7278350f
commit 6bd8e96b5a

View File

@ -71,12 +71,11 @@ class driver(inputDriver):
try: try:
if not '/sys/devices/virtual/input/' in device.sys_path: if not '/sys/devices/virtual/input/' in device.sys_path:
validDevice = True validDevice = True
device = monitor.poll(0.7) device = monitor.poll(0.5)
except: except:
pass pass
if validDevice: if validDevice:
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None}) eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None})
print('fired',device)
return time.time() return time.time()
def plugInputDeviceWatchdogTimer(self, active): def plugInputDeviceWatchdogTimer(self, active):
time.sleep(10) time.sleep(10)
@ -256,11 +255,13 @@ class driver(inputDriver):
return return
for fd in self.iDevices: for fd in self.iDevices:
self.grabDevice(fd) self.grabDevice(fd)
def ungrabAllDevices(self): def ungrabAllDevices(self):
if not self._initialized: if not self._initialized:
return return
for fd in self.iDevices: for fd in self.iDevices:
self.ungrabDevice(fd) self.ungrabDevice(fd)
def createUInputDev(self, fd): def createUInputDev(self, fd):
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
self.uDevices[fd] = None self.uDevices[fd] = None