Update evdevDriver.py
This commit is contained in:
parent
2bd742e9ff
commit
f11c9eed3c
@ -36,7 +36,7 @@ class driver():
|
||||
def __init__(self):
|
||||
self._manager = multiprocessing.Manager()
|
||||
self.iDevices = {}
|
||||
self.iDevicesFD = None
|
||||
self.iDevicesFD = self._manager.list()
|
||||
self.uDevices = {}
|
||||
self.iDeviceNo = 0
|
||||
self._initialized = False
|
||||
@ -78,9 +78,9 @@ class driver():
|
||||
def shutdown(self):
|
||||
if not self._initialized:
|
||||
return
|
||||
def inputWatchdog(self,active , iDevicesFD):
|
||||
def inputWatchdog(self,active , params):
|
||||
deviceFd = []
|
||||
for fd in iDevicesFD['dev']:
|
||||
for fd in params['dev']:
|
||||
deviceFd.append(fd)
|
||||
while self.watchDog.value == 0:
|
||||
if active.value == 0:
|
||||
@ -200,13 +200,15 @@ class driver():
|
||||
self.env['runtime']['debug'].writeDebugOut('Device added (Name):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO)
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut("Skip Inputdevice : " + deviceFile +' ' + str(e),debug.debugLevel.ERROR)
|
||||
self.iDevicesFD = multiprocessing.Array('i', len(self.iDevices))
|
||||
i = 0
|
||||
for fd in self.iDevices:
|
||||
self.iDevicesFD[i] = fd
|
||||
i +=1
|
||||
self.updateMPiDevicesFD()
|
||||
self.iDeviceNo = len(evdev.list_devices())
|
||||
|
||||
def updateMPiDevicesFD(self):
|
||||
for fd in self.iDevices:
|
||||
if not fd in self.iDevicesFD:
|
||||
self.iDevicesFD.append(fd)
|
||||
for fd in self.iDevicesFD:
|
||||
if not fd in self.iDevices:
|
||||
self.iDevicesFD.remove(fd)
|
||||
def mapEvent(self, event):
|
||||
if not self._initialized:
|
||||
return None
|
||||
@ -296,11 +298,8 @@ class driver():
|
||||
del(self.uDevices[fd])
|
||||
except:
|
||||
pass
|
||||
self.iDevicesFD = multiprocessing.Array('i', len(self.iDevices))
|
||||
i = 0
|
||||
for fd in self.iDevices:
|
||||
self.iDevicesFD[i] = fd
|
||||
i +=1
|
||||
self.updateMPiDevicesFD()
|
||||
|
||||
def hasIDevices(self):
|
||||
if not self._initialized:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user