Commit 4d816bdb authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

dinput: Restore effect ID on error due to kernel < 3.14 bug.

Based on ideas by Elias Vanderstuyft Signed-off-by: 's avatarBruno Jesus <00cpxxx@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 32789799
...@@ -173,14 +173,19 @@ static HRESULT WINAPI LinuxInputEffectImpl_Download( ...@@ -173,14 +173,19 @@ static HRESULT WINAPI LinuxInputEffectImpl_Download(
LPDIRECTINPUTEFFECT iface) LPDIRECTINPUTEFFECT iface)
{ {
LinuxInputEffectImpl *This = impl_from_IDirectInputEffect(iface); LinuxInputEffectImpl *This = impl_from_IDirectInputEffect(iface);
int ret; int ret, old_effect_id;
TRACE("(this=%p)\n", This); TRACE("(this=%p)\n", This);
ff_dump_effect(&This->effect); ff_dump_effect(&This->effect);
old_effect_id = This->effect.id;
if (ioctl(*(This->fd), EVIOCSFF, &This->effect) != -1) if (ioctl(*(This->fd), EVIOCSFF, &This->effect) != -1)
return DI_OK; return DI_OK;
/* Linux kernel < 3.14 has a bug that incorrectly assigns an effect ID even
* on error, restore it here if that is the case. */
This->effect.id = old_effect_id;
switch (errno) switch (errno)
{ {
case EINVAL: case EINVAL:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment