Bruno Jesus : dinput: Be more precise when returning effect upload errors.

Alexandre Julliard julliard at winehq.org
Tue Aug 23 11:28:44 CDT 2016


Module: wine
Branch: master
Commit: 844a25ab38ffd89359308d3ce19ac225fb1d9340
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=844a25ab38ffd89359308d3ce19ac225fb1d9340

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Mon Aug 22 22:06:56 2016 -0300

dinput: Be more precise when returning effect upload errors.

Based on ideas by Elias Vanderstuyft.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/effect_linuxinput.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index 9215265..2f3399d 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -173,20 +173,32 @@ static HRESULT WINAPI LinuxInputEffectImpl_Download(
 	LPDIRECTINPUTEFFECT iface)
 {
     LinuxInputEffectImpl *This = impl_from_IDirectInputEffect(iface);
+    int ret;
 
     TRACE("(this=%p)\n", This);
     ff_dump_effect(&This->effect);
 
-    if (ioctl(*(This->fd), EVIOCSFF, &This->effect) == -1) {
-	if (errno == ENOMEM) {
-	    return DIERR_DEVICEFULL;
-	} else {
-            FIXME("Could not upload effect. Assuming a disconnected device %d \"%s\".\n", *This->fd, strerror(errno));
-	    return DIERR_INPUTLOST;
-	}
-    }
+    if (ioctl(*(This->fd), EVIOCSFF, &This->effect) != -1)
+        return DI_OK;
 
-    return DI_OK;
+    switch (errno)
+    {
+        case EINVAL:
+            ret = DIERR_INVALIDPARAM;
+            break;
+        case ENOSPC:
+            ret = DIERR_DEVICEFULL;
+            break;
+        case ENOMEM:
+            ret = DIERR_OUTOFMEMORY;
+            break;
+        default:
+            ret = DIERR_INPUTLOST;
+            break;
+    }
+    TRACE("Could not upload effect to fd %d, errno %d \"%s\", returning 0x%x.\n",
+          *This->fd, errno, strerror(errno), ret);
+    return ret;
 }
 
 static HRESULT WINAPI LinuxInputEffectImpl_Escape(




More information about the wine-cvs mailing list