Skip to content

Commit

Permalink
Worked around an issue where the kernel would lose the force feedback…
Browse files Browse the repository at this point in the history
… effect
  • Loading branch information
slouken committed Jan 11, 2020
1 parent e3cedf9 commit c14a59d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/joystick/linux/SDL_sysjoystick.c
Expand Up @@ -829,7 +829,11 @@ LINUX_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint1
}

if (ioctl(joystick->hwdata->fd, EVIOCSFF, &joystick->hwdata->effect) < 0) {
return SDL_SetError("Couldn't update rumble effect: %s", strerror(errno));
/* The kernel may have lost this effect, try to allocate a new one */
joystick->hwdata->effect.id = -1;
if (ioctl(joystick->hwdata->fd, EVIOCSFF, &joystick->hwdata->effect) < 0) {
return SDL_SetError("Couldn't update rumble effect: %s", strerror(errno));
}
}

event.type = EV_FF;
Expand Down

0 comments on commit c14a59d

Please sign in to comment.