Skip to content

Commit

Permalink
Removed console check, let the kernel decide whether muting is approp…
Browse files Browse the repository at this point in the history
…riate on this terminal.

We don't fail the init if we can't mute the terminal (we might be running from ssh, or on a system without virtual terminals, etc.)
  • Loading branch information
slouken committed Jan 9, 2017
1 parent c16dd74 commit 7b66295
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/core/linux/SDL_evdev.c
Expand Up @@ -135,20 +135,9 @@ static Uint8 EVDEV_MouseButtons[] = {
SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */
};

static int SDL_EVDEV_is_console(int fd) {
char type;

return isatty(fd) && ioctl(fd, KDGKBTYPE, &type) == 0 &&
(type == KB_101 || type == KB_84);
}

/* Prevent keystrokes from reaching the tty */
static int SDL_EVDEV_mute_keyboard(int tty_fd, int* old_kb_mode)
{
if (!SDL_EVDEV_is_console(tty_fd)) {
return SDL_SetError("Tried to mute an invalid tty");
}

if (ioctl(tty_fd, KDGKBMODE, old_kb_mode) < 0) {
return SDL_SetError("Failed to get keyboard mode during muting");
}
Expand All @@ -164,7 +153,7 @@ static int SDL_EVDEV_mute_keyboard(int tty_fd, int* old_kb_mode)
static void SDL_EVDEV_unmute_keyboard(int tty_fd, int old_kb_mode)
{
if (ioctl(tty_fd, KDSKBMODE, old_kb_mode) < 0) {
SDL_Log("Failed to set keyboard mode");
SDL_SetError("Failed to set keyboard mode during unmuting");
}
}

Expand Down

0 comments on commit 7b66295

Please sign in to comment.