add compat for older evdev versions.
This commit is contained in:
parent
958faa34fd
commit
7c71ebd451
@ -162,6 +162,27 @@ class driver():
|
|||||||
def grabDevices(self):
|
def grabDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return None
|
return None
|
||||||
|
try:
|
||||||
|
for fd in self.iDevices:
|
||||||
|
try:
|
||||||
|
self.uDevices[fd] = UInput.from_device(self.iDevices[fd].fn)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: compat fallback: ' + str(e),debug.debugLevel.ERROR)
|
||||||
|
dev = self.iDevices[fd]
|
||||||
|
cap = dev.capabilities()
|
||||||
|
del cap[0]
|
||||||
|
self.uDevices[fd] = UInput(
|
||||||
|
cap,
|
||||||
|
dev.name,
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: init Uinput not possible: ' + str(e),debug.debugLevel.ERROR)
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
self.iDevices[fd].grab()
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
||||||
# leve the old code until the new one is better tested
|
# leve the old code until the new one is better tested
|
||||||
# for fd in self.iDevices:
|
# for fd in self.iDevices:
|
||||||
# dev = self.iDevices[fd]
|
# dev = self.iDevices[fd]
|
||||||
@ -175,14 +196,10 @@ class driver():
|
|||||||
# #dev.version,
|
# #dev.version,
|
||||||
# #dev.info.bustype,
|
# #dev.info.bustype,
|
||||||
# #'/dev/uinput'
|
# #'/dev/uinput'
|
||||||
# )
|
# )
|
||||||
# dev.grab()
|
# dev.grab()
|
||||||
for fd in self.iDevices:
|
|
||||||
try:
|
|
||||||
self.uDevices[fd] = UInput.from_device(self.iDevices[fd].fn)
|
|
||||||
self.iDevices[fd].grab()
|
|
||||||
except Exception as e:
|
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
|
||||||
def releaseDevices(self):
|
def releaseDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user