Update evdevDriver.py
This commit is contained in:
parent
e30a703491
commit
cff16dea93
@ -48,16 +48,19 @@ class driver(inputDriver):
|
|||||||
self.env['runtime']['inputManager'].setShortcutType('KEY')
|
self.env['runtime']['inputManager'].setShortcutType('KEY')
|
||||||
global _evdevAvailable
|
global _evdevAvailable
|
||||||
global _udevAvailable
|
global _udevAvailable
|
||||||
self._initialized = _evdevAvailable
|
self._initialized = _evdevAvailable and _udevAvailable
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
global _evdevAvailableError
|
global _evdevAvailableError
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR)
|
global _udevAvailableError
|
||||||
|
currError = ' '
|
||||||
|
if not _evdevAvailable:
|
||||||
|
currError += _evdevAvailableError
|
||||||
|
if not _udevAvailable:
|
||||||
|
currError += ' ' + _udevAvailableError
|
||||||
|
self.env['runtime']['debug'].writeDebugOut('InputDriver:' + currError, debug.debugLevel.ERROR)
|
||||||
return
|
return
|
||||||
|
|
||||||
if _udevAvailable:
|
self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
|
||||||
self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
|
|
||||||
#else:
|
|
||||||
# self.env['runtime']['processManager'].addSimpleEventThread(fenrirEventType.PlugInputDevice, self.plugInputDeviceWatchdogTimer)
|
|
||||||
self.env['runtime']['processManager'].addCustomEventThread(self.inputWatchdog)
|
self.env['runtime']['processManager'].addCustomEventThread(self.inputWatchdog)
|
||||||
def plugInputDeviceWatchdogUdev(self,active , eventQueue):
|
def plugInputDeviceWatchdogUdev(self,active , eventQueue):
|
||||||
context = pyudev.Context()
|
context = pyudev.Context()
|
||||||
@ -72,9 +75,12 @@ class driver(inputDriver):
|
|||||||
if not '/sys/devices/virtual/input/' in device.sys_path:
|
if not '/sys/devices/virtual/input/' in device.sys_path:
|
||||||
if device.device_node:
|
if device.device_node:
|
||||||
validDevices.append(str(device.device_node))
|
validDevices.append(str(device.device_node))
|
||||||
device = monitor.poll(0.1)
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
try:
|
||||||
|
device = monitor.poll(0.1)
|
||||||
|
except:
|
||||||
|
device = None
|
||||||
if validDevices:
|
if validDevices:
|
||||||
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":validDevices})
|
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":validDevices})
|
||||||
return time.time()
|
return time.time()
|
||||||
|
Loading…
Reference in New Issue
Block a user