Vitaliy Margolen : dinput: Warn if failed to open device.

Alexandre Julliard julliard at winehq.org
Sat Dec 27 13:45:30 CST 2008


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

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Sat Dec 27 11:23:13 2008 -0700

dinput: Warn if failed to open device.

---

 dlls/dinput/joystick_linuxinput.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 95666e8..c6f07ac 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -231,12 +231,17 @@ static void find_joydevs(void)
 
         snprintf(buf, sizeof(buf), EVDEVPREFIX"%d", i);
 
-    if ((fd=open(buf, O_RDWR))==-1) {
-      fd = open(buf, O_RDONLY);
-      no_ff_check = 1;
-    }
+        if ((fd = open(buf, O_RDWR)) == -1)
+        {
+            fd = open(buf, O_RDONLY);
+            no_ff_check = 1;
+        }
 
-    if (fd!=-1) {
+        if (fd == -1)
+        {
+            WARN("Failed to open \"%s\": %d %s\n", buf, errno, strerror(errno));
+            continue;
+        }
 
       if ((-1==ioctl(fd,EVIOCGBIT(0,sizeof(joydev.evbits)),joydev.evbits))) {
         perror("EVIOCGBIT 0");
@@ -319,9 +324,8 @@ static void find_joydevs(void)
         have_joydevs++;
       }
 
-      close(fd);
+        close(fd);
     }
-  }
 }
 
 static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)




More information about the wine-cvs mailing list