diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index 63460f9c64..fa37559c8a 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -14,20 +14,19 @@ * If not, see . */ -#include "../../driver.h" - #include #include #include #include -#include #include + #include "../../general.h" + #include "../input_keymaps.h" #include "../input_common.h" #include "../input_joypad.h" -static long oldKbmd = 0xffff; +static long oldKbmd = 0xffff; static bool linuxraw_stdin_claimed = false; static struct termios oldTerm, newTerm; @@ -80,11 +79,11 @@ static void *linuxraw_input_init(void) if (oldKbmd == 0xffff) { tcgetattr(0, &oldTerm); - newTerm = oldTerm; - newTerm.c_lflag &= ~(ECHO | ICANON | ISIG); - newTerm.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON); - newTerm.c_cc[VMIN] = 0; - newTerm.c_cc[VTIME] = 0; + newTerm = oldTerm; + newTerm.c_lflag &= ~(ECHO | ICANON | ISIG); + newTerm.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON); + newTerm.c_cc[VMIN] = 0; + newTerm.c_cc[VTIME] = 0; if (ioctl(0, KDGKBMODE, &oldKbmd) != 0) { @@ -109,9 +108,9 @@ static void *linuxraw_input_init(void) /* Trap some standard termination codes so we * can restore the keyboard before we lose control. */ sigaction(SIGABRT, &sa, NULL); - sigaction(SIGBUS, &sa, NULL); - sigaction(SIGFPE, &sa, NULL); - sigaction(SIGILL, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); + sigaction(SIGFPE, &sa, NULL); + sigaction(SIGILL, &sa, NULL); sigaction(SIGQUIT, &sa, NULL); sigaction(SIGSEGV, &sa, NULL); diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index a136d4eef4..cb3d87d6a8 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -273,8 +273,8 @@ static bool add_device(udev_input_t *udev, { int fd; struct input_device **tmp; - struct stat st = {0}; struct input_device *device = NULL; + struct stat st = {0}; struct epoll_event event = {0}; if (stat(devnode, &st) < 0) @@ -337,14 +337,14 @@ static void udev_input_remove_device(udev_input_t *udev, const char *devnode) for (i = 0; i < udev->num_devices; i++) { - if (!strcmp(devnode, udev->devices[i]->devnode)) - { - close(udev->devices[i]->fd); - free(udev->devices[i]); - memmove(udev->devices + i, udev->devices + i + 1, - (udev->num_devices - (i + 1)) * sizeof(*udev->devices)); - udev->num_devices--; - } + if (strcmp(devnode, udev->devices[i]->devnode) != 0) + continue; + + close(udev->devices[i]->fd); + free(udev->devices[i]); + memmove(udev->devices + i, udev->devices + i + 1, + (udev->num_devices - (i + 1)) * sizeof(*udev->devices)); + udev->num_devices--; } }