dinput: Warn if failed to open device.

This commit is contained in:
Vitaliy Margolen 2008-12-27 11:23:13 -07:00 committed by Alexandre Julliard
parent e0152e85e9
commit a179f491fd
1 changed files with 11 additions and 7 deletions

View File

@ -231,12 +231,17 @@ static void find_joydevs(void)
snprintf(buf, sizeof(buf), EVDEVPREFIX"%d", i); snprintf(buf, sizeof(buf), EVDEVPREFIX"%d", i);
if ((fd=open(buf, O_RDWR))==-1) { if ((fd = open(buf, O_RDWR)) == -1)
fd = open(buf, O_RDONLY); {
no_ff_check = 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))) { if ((-1==ioctl(fd,EVIOCGBIT(0,sizeof(joydev.evbits)),joydev.evbits))) {
perror("EVIOCGBIT 0"); perror("EVIOCGBIT 0");
@ -319,9 +324,8 @@ static void find_joydevs(void)
have_joydevs++; have_joydevs++;
} }
close(fd); close(fd);
} }
}
} }
static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)