make new device detection work
This commit is contained in:
parent
27c5075b23
commit
6981145a8c
@ -70,8 +70,9 @@ class driver(inputDriver):
|
|||||||
while device:
|
while device:
|
||||||
try:
|
try:
|
||||||
if not '/sys/devices/virtual/input/' in device.sys_path:
|
if not '/sys/devices/virtual/input/' in device.sys_path:
|
||||||
validDevices.append(str(device.device_path))
|
if device.device_node:
|
||||||
device = monitor.poll(0.2)
|
validDevices.append(str(device.device_node))
|
||||||
|
device = monitor.poll(0.1)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if validDevices:
|
if validDevices:
|
||||||
@ -146,7 +147,6 @@ class driver(inputDriver):
|
|||||||
if init:
|
if init:
|
||||||
self.removeAllDevices()
|
self.removeAllDevices()
|
||||||
|
|
||||||
print(newDevices)
|
|
||||||
deviceFileList = None
|
deviceFileList = None
|
||||||
|
|
||||||
if newDevices and not init:
|
if newDevices and not init:
|
||||||
@ -173,6 +173,7 @@ class driver(inputDriver):
|
|||||||
continue
|
continue
|
||||||
if deviceFile in iDevicesFiles:
|
if deviceFile in iDevicesFiles:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
open(deviceFile)
|
open(deviceFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -181,13 +182,22 @@ class driver(inputDriver):
|
|||||||
# 3 pos absolute
|
# 3 pos absolute
|
||||||
# 2 pos relative
|
# 2 pos relative
|
||||||
# 1 Keys
|
# 1 Keys
|
||||||
currDevice = evdev.InputDevice(deviceFile)
|
|
||||||
if currDevice.name.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
try:
|
||||||
continue
|
currDevice = evdev.InputDevice(deviceFile)
|
||||||
if currDevice.phys.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
except:
|
||||||
continue
|
|
||||||
if 'BRLTTY' in currDevice.name.upper():
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
if currDevice.name.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
||||||
|
continue
|
||||||
|
if currDevice.phys.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']:
|
||||||
|
continue
|
||||||
|
if 'BRLTTY' in currDevice.name.upper():
|
||||||
|
continue
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
cap = currDevice.capabilities()
|
cap = currDevice.capabilities()
|
||||||
if mode in ['ALL','NOMICE']:
|
if mode in ['ALL','NOMICE']:
|
||||||
if eventType.EV_KEY in cap:
|
if eventType.EV_KEY in cap:
|
||||||
@ -213,6 +223,7 @@ class driver(inputDriver):
|
|||||||
self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile +' ' + currDevice.name +' '+ str(e),debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile +' ' + currDevice.name +' '+ str(e),debug.debugLevel.INFO)
|
||||||
self.iDeviceNo = len(evdev.list_devices())
|
self.iDeviceNo = len(evdev.list_devices())
|
||||||
self.updateMPiDevicesFD()
|
self.updateMPiDevicesFD()
|
||||||
|
|
||||||
def updateMPiDevicesFD(self):
|
def updateMPiDevicesFD(self):
|
||||||
try:
|
try:
|
||||||
for fd in self.iDevices:
|
for fd in self.iDevices:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user