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