Disable stdin input by default and add ability to disable EVDEV input

This commit is contained in:
Tera << 8 2025-06-10 21:19:02 -04:00
parent 15afe89aff
commit 21a377707f
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
4 changed files with 53 additions and 37 deletions

View file

@ -1,4 +1,4 @@
# ## Config options ### ### Config options ###
include(CMakeDependentOption) include(CMakeDependentOption)
include(EnumOption) include(EnumOption)
@ -29,6 +29,8 @@ set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \$
# DRM build options # DRM build options
option(ENABLE_WAYLAND_DRM_LEASING "Enables DRM leasing in the DRM backend via the Wayland desktop" OFF) option(ENABLE_WAYLAND_DRM_LEASING "Enables DRM leasing in the DRM backend via the Wayland desktop" OFF)
option(DISABLE_EVDEV_INPUT "Disable evdev input in the DRM backend" OFF)
option(SUPPORT_SSH_KEYBOARD_RPI "Support using keyboard input from stdin" ON)
include(ParseConfigHeader) include(ParseConfigHeader)

View file

@ -103,6 +103,14 @@ elseif ("${PLATFORM}" MATCHES "DRM")
list(APPEND LIBS_PRIVATE ${WAYLAND_CLIENT}) list(APPEND LIBS_PRIVATE ${WAYLAND_CLIENT})
endif () endif ()
if (DISABLE_EVDEV_INPUT)
add_definitions(-DDISABLE_EVDEV_INPUT)
endif ()
if (SUPPORT_SSH_KEYBOARD_RPI)
add_definitions(-DSUPPORT_SSH_KEYBOARD_RPI)
endif ()
elseif ("${PLATFORM}" MATCHES "SDL") elseif ("${PLATFORM}" MATCHES "SDL")
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL") set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")

View file

@ -50,7 +50,7 @@
// Mouse gestures are directly mapped like touches and processed by gestures system // Mouse gestures are directly mapped like touches and processed by gestures system
#define SUPPORT_MOUSE_GESTURES 1 #define SUPPORT_MOUSE_GESTURES 1
// Reconfigure standard input to receive key inputs, works with SSH connection. // Reconfigure standard input to receive key inputs, works with SSH connection.
#define SUPPORT_SSH_KEYBOARD_RPI 1 #define SUPPORT_SSH_KEYBOARD_RPI 0
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions. // Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often. // However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
#define SUPPORT_WINMM_HIGHRES_TIMER 1 #define SUPPORT_WINMM_HIGHRES_TIMER 1

View file

@ -1639,6 +1639,7 @@ static void ProcessKeyboard(void)
// this means mouse, keyboard or gamepad devices // this means mouse, keyboard or gamepad devices
static void InitEvdevInput(void) static void InitEvdevInput(void)
{ {
#if !defined(DISABLE_EVDEV_INPUT)
char path[MAX_FILEPATH_LENGTH] = { 0 }; char path[MAX_FILEPATH_LENGTH] = { 0 };
DIR *directory = NULL; DIR *directory = NULL;
struct dirent *entity = NULL; struct dirent *entity = NULL;
@ -1679,6 +1680,11 @@ static void InitEvdevInput(void)
closedir(directory); closedir(directory);
} }
else TRACELOG(LOG_WARNING, "INPUT: Failed to open linux event directory: %s", DEFAULT_EVDEV_PATH); else TRACELOG(LOG_WARNING, "INPUT: Failed to open linux event directory: %s", DEFAULT_EVDEV_PATH);
#else
TRACELOG(LOG_INFO, "INPUT: Not doing evdev input configuration as it's disabled");
platform.keyboardFd = -1;
platform.mouseFd = -1;
#endif
} }
// Identifies a input device and configures it for use if appropriate // Identifies a input device and configures it for use if appropriate