Skip to content

Commit

Permalink
Don't fail if we can't open the tty, this can be a legitimate use case.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 8, 2017
1 parent 267c950 commit 7e505b0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/core/linux/SDL_evdev.c
Expand Up @@ -196,15 +196,15 @@ SDL_EVDEV_Init(void)
#else
/* TODO: Scan the devices manually, like a caveman */
#endif /* SDL_USE_LIBUDEV */


/* This might fail if we're not connected to a tty (e.g. on the Steam Link) */
_this->console_fd = open("/dev/tty", O_RDONLY);
if( _this->console_fd < 0 ) {
return SDL_SetError("Failed to open /dev/tty");
}


/* Mute the keyboard so keystrokes only generate evdev events and do not
leak through to the console */
SDL_EVDEV_mute_keyboard(_this->console_fd, &_this->old_kb_mode);
if (_this->console_fd >= 0) {
SDL_EVDEV_mute_keyboard(_this->console_fd, &_this->old_kb_mode);
}
}

_this->ref_count += 1;
Expand Down Expand Up @@ -274,7 +274,8 @@ void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class,
#ifdef SDL_INPUT_LINUXKD
/* this logic is pulled from kbd_keycode() in drivers/tty/vt/keyboard.c in the
Linux kernel source */
static void SDL_EVDEV_do_text_input(unsigned short keycode) {
static void SDL_EVDEV_do_text_input(unsigned short keycode)
{
char shift_state;
int locks_state;
struct kbentry kbe;
Expand Down

0 comments on commit 7e505b0

Please sign in to comment.