fix devcie detection

This commit is contained in:
chrys 2017-09-25 20:42:53 +02:00
parent aa1fc75e5c
commit a427ccd130
2 changed files with 7 additions and 6 deletions

View File

@ -44,7 +44,7 @@ class eventManager():
elif event['Type'] == fenrirEventType.BrailleInput: elif event['Type'] == fenrirEventType.BrailleInput:
pass pass
elif event['Type'] == fenrirEventType.PlugInputDevice: elif event['Type'] == fenrirEventType.PlugInputDevice:
#self.env['runtime']['fenrirManager'].handlePlugInputDevice(event) self.env['runtime']['fenrirManager'].handlePlugInputDevice(event)
pass pass
elif event['Type'] == fenrirEventType.BrailleFlush: elif event['Type'] == fenrirEventType.BrailleFlush:
pass pass

View File

@ -64,6 +64,8 @@ class driver():
while active.value == 1: while active.value == 1:
devices = monitor.poll(2) devices = monitor.poll(2)
if devices: if devices:
while monitor.poll(0.05):
time.sleep(0.01)
eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None}) eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None})
return time.time() return time.time()
def plugInputDeviceWatchdogTimer(self, active): def plugInputDeviceWatchdogTimer(self, active):
@ -82,8 +84,7 @@ class driver():
while r == []: while r == []:
if active.value == 0: if active.value == 0:
return return
deviceFd = list(params['dev']) r, w, x = select(list(params['dev']), [], [], 0.3)
r, w, x = select(deviceFd, [], [], 2)
self.watchDog.value = 0 self.watchDog.value = 0
except: except:
pass pass
@ -145,7 +146,6 @@ class driver():
return return
uDevice.write_event(event) uDevice.write_event(event)
uDevice.syn() uDevice.syn()
time.sleep(0.00001)
def updateInputDevices(self, force = False, init = False): def updateInputDevices(self, force = False, init = False):
if init: if init:
@ -202,6 +202,7 @@ class driver():
self.env['runtime']['debug'].writeDebugOut("Skip Inputdevice : " + deviceFile +' ' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut("Skip Inputdevice : " + deviceFile +' ' + str(e),debug.debugLevel.ERROR)
self.iDeviceNo = len(evdev.list_devices()) self.iDeviceNo = len(evdev.list_devices())
self.updateMPiDevicesFD() self.updateMPiDevicesFD()
print(list(self.iDevicesFD))
def updateMPiDevicesFD(self): def updateMPiDevicesFD(self):
for fd in self.iDevices: for fd in self.iDevices:
if not fd in self.iDevicesFD: if not fd in self.iDevicesFD: