Removed console check, let the kernel decide whether muting is appropriate on this terminal.
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Jan 2017 19:04:38 -0800
changeset 10795e0fd1d8379cd
parent 10794 fb67bf50547d
child 10796 2a0d717d55be
Removed console check, let the kernel decide whether muting is appropriate 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.)
src/core/linux/SDL_evdev.c
     1.1 --- a/src/core/linux/SDL_evdev.c	Sun Jan 08 18:32:20 2017 -0800
     1.2 +++ b/src/core/linux/SDL_evdev.c	Sun Jan 08 19:04:38 2017 -0800
     1.3 @@ -135,20 +135,9 @@
     1.4      SDL_BUTTON_X2 + 3           /*  BTN_TASK        0x117 */
     1.5  };
     1.6  
     1.7 -static int SDL_EVDEV_is_console(int fd) {
     1.8 -    char type;
     1.9 -    
    1.10 -    return isatty(fd) && ioctl(fd, KDGKBTYPE, &type) == 0 &&
    1.11 -        (type == KB_101 || type == KB_84);
    1.12 -}
    1.13 -
    1.14  /* Prevent keystrokes from reaching the tty */
    1.15  static int SDL_EVDEV_mute_keyboard(int tty_fd, int* old_kb_mode)
    1.16  {
    1.17 -    if (!SDL_EVDEV_is_console(tty_fd)) {
    1.18 -        return SDL_SetError("Tried to mute an invalid tty");
    1.19 -    }
    1.20 -    
    1.21      if (ioctl(tty_fd, KDGKBMODE, old_kb_mode) < 0) {
    1.22          return SDL_SetError("Failed to get keyboard mode during muting");
    1.23      }
    1.24 @@ -164,7 +153,7 @@
    1.25  static void SDL_EVDEV_unmute_keyboard(int tty_fd, int old_kb_mode)
    1.26  {
    1.27      if (ioctl(tty_fd, KDSKBMODE, old_kb_mode) < 0) {
    1.28 -        SDL_Log("Failed to set keyboard mode");
    1.29 +        SDL_SetError("Failed to set keyboard mode during unmuting");
    1.30      }
    1.31  }
    1.32