improve device detection

This commit is contained in:
Chrys
2018-04-01 14:36:06 +02:00
parent 01acd81e7b
commit f32de79204
4 changed files with 5 additions and 7 deletions

View File

@ -52,6 +52,7 @@ class driver(inputDriver):
global _evdevAvailableError
self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR)
return
self.updateInputDevices()
if _udevAvailable:
self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
else:
@ -61,14 +62,12 @@ class driver(inputDriver):
context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by(subsystem='input')
# wait until start process finished
time.sleep(8)
monitor.start()
while active.value:
devices = monitor.poll(2)
if devices:
while monitor.poll(0.2):
time.sleep(0.1)
time.sleep(0.2)
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None})
return time.time()
def plugInputDeviceWatchdogTimer(self, active):