Disable stdin input by default and add ability to disable EVDEV input
This commit is contained in:
parent
15afe89aff
commit
21a377707f
4 changed files with 53 additions and 37 deletions
|
@ -50,7 +50,7 @@
|
|||
// Mouse gestures are directly mapped like touches and processed by gestures system
|
||||
#define SUPPORT_MOUSE_GESTURES 1
|
||||
// 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.
|
||||
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
|
||||
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
||||
|
|
|
@ -1639,46 +1639,52 @@ static void ProcessKeyboard(void)
|
|||
// this means mouse, keyboard or gamepad devices
|
||||
static void InitEvdevInput(void)
|
||||
{
|
||||
char path[MAX_FILEPATH_LENGTH] = { 0 };
|
||||
DIR *directory = NULL;
|
||||
struct dirent *entity = NULL;
|
||||
#if !defined(DISABLE_EVDEV_INPUT)
|
||||
char path[MAX_FILEPATH_LENGTH] = { 0 };
|
||||
DIR *directory = NULL;
|
||||
struct dirent *entity = NULL;
|
||||
|
||||
// Initialise keyboard file descriptor
|
||||
platform.keyboardFd = -1;
|
||||
platform.mouseFd = -1;
|
||||
// Initialise keyboard file descriptor
|
||||
platform.keyboardFd = -1;
|
||||
platform.mouseFd = -1;
|
||||
|
||||
// Reset variables
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
|
||||
{
|
||||
CORE.Input.Touch.position[i].x = -1;
|
||||
CORE.Input.Touch.position[i].y = -1;
|
||||
}
|
||||
|
||||
// Reset keyboard key state
|
||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++)
|
||||
{
|
||||
CORE.Input.Keyboard.currentKeyState[i] = 0;
|
||||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||
}
|
||||
|
||||
// Open the linux directory of "/dev/input"
|
||||
directory = opendir(DEFAULT_EVDEV_PATH);
|
||||
|
||||
if (directory)
|
||||
{
|
||||
while ((entity = readdir(directory)) != NULL)
|
||||
// Reset variables
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
|
||||
{
|
||||
if ((strncmp("event", entity->d_name, strlen("event")) == 0) || // Search for devices named "event*"
|
||||
(strncmp("mouse", entity->d_name, strlen("mouse")) == 0)) // Search for devices named "mouse*"
|
||||
{
|
||||
sprintf(path, "%s%s", DEFAULT_EVDEV_PATH, entity->d_name);
|
||||
ConfigureEvdevDevice(path); // Configure the device if appropriate
|
||||
}
|
||||
CORE.Input.Touch.position[i].x = -1;
|
||||
CORE.Input.Touch.position[i].y = -1;
|
||||
}
|
||||
|
||||
closedir(directory);
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "INPUT: Failed to open linux event directory: %s", DEFAULT_EVDEV_PATH);
|
||||
// Reset keyboard key state
|
||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++)
|
||||
{
|
||||
CORE.Input.Keyboard.currentKeyState[i] = 0;
|
||||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||
}
|
||||
|
||||
// Open the linux directory of "/dev/input"
|
||||
directory = opendir(DEFAULT_EVDEV_PATH);
|
||||
|
||||
if (directory)
|
||||
{
|
||||
while ((entity = readdir(directory)) != NULL)
|
||||
{
|
||||
if ((strncmp("event", entity->d_name, strlen("event")) == 0) || // Search for devices named "event*"
|
||||
(strncmp("mouse", entity->d_name, strlen("mouse")) == 0)) // Search for devices named "mouse*"
|
||||
{
|
||||
sprintf(path, "%s%s", DEFAULT_EVDEV_PATH, entity->d_name);
|
||||
ConfigureEvdevDevice(path); // Configure the device if appropriate
|
||||
}
|
||||
}
|
||||
|
||||
closedir(directory);
|
||||
}
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue