fix devcie detection
This commit is contained in:
parent
aa1fc75e5c
commit
a427ccd130
@ -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
|
||||||
|
@ -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
|
||||||
@ -144,8 +145,7 @@ class driver():
|
|||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
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:
|
||||||
@ -201,7 +201,8 @@ class driver():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user