Guard evdev uinput setup
This commit is contained in:
@@ -4,5 +4,5 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
version = "2026.02.15"
|
||||
version = "2026.03.04"
|
||||
code_name = "testing"
|
||||
|
||||
@@ -68,7 +68,9 @@ class driver(inputDriver):
|
||||
self.gDevices = {}
|
||||
self.iDeviceNo = 0
|
||||
self.watch_dog = Value(c_bool, True)
|
||||
self.UInputinject = UInput()
|
||||
self.UInputinject = (
|
||||
UInput() if _evdevAvailable and "UInput" in globals() else None
|
||||
)
|
||||
self._deviceLock = threading.Lock()
|
||||
|
||||
def initialize(self, environment):
|
||||
@@ -634,6 +636,8 @@ class driver(inputDriver):
|
||||
self.uDevices[fd] = None
|
||||
if self.uDevices[fd] is not None:
|
||||
return
|
||||
if "UInput" not in globals():
|
||||
return
|
||||
try:
|
||||
self.uDevices[fd] = UInput.from_device(
|
||||
self.iDevices[fd], name="fenrir-uinput", phys="fenrir-uinput"
|
||||
@@ -936,6 +940,8 @@ class driver(inputDriver):
|
||||
"""
|
||||
if not self._initialized:
|
||||
return
|
||||
if self.UInputinject is None:
|
||||
return
|
||||
try:
|
||||
self.UInputinject.write(e.EV_KEY, e.ecodes[key], state)
|
||||
self.UInputinject.syn()
|
||||
|
||||
Reference in New Issue
Block a user