dinput: Replace perror with more appropriate ERR and WARN.

This commit is contained in:
Vitaliy Margolen 2008-12-27 11:23:15 -07:00 committed by Alexandre Julliard
parent a179f491fd
commit 7915569511

View File

@ -243,21 +243,25 @@ static void find_joydevs(void)
continue; continue;
} }
if ((-1==ioctl(fd,EVIOCGBIT(0,sizeof(joydev.evbits)),joydev.evbits))) { if (ioctl(fd, EVIOCGBIT(0, sizeof(joydev.evbits)), joydev.evbits) == -1)
perror("EVIOCGBIT 0"); {
close(fd); WARN("ioct(EVIOCGBIT, 0) failed: %d %s\n", errno, strerror(errno));
continue; close(fd);
} continue;
if (-1==ioctl(fd,EVIOCGBIT(EV_ABS,sizeof(joydev.absbits)),joydev.absbits)) { }
perror("EVIOCGBIT EV_ABS"); if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(joydev.absbits)), joydev.absbits) == -1)
close(fd); {
continue; WARN("ioct(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno));
} close(fd);
if (-1==ioctl(fd,EVIOCGBIT(EV_KEY,sizeof(joydev.keybits)),joydev.keybits)) { continue;
perror("EVIOCGBIT EV_KEY"); }
close(fd); if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(joydev.keybits)), joydev.keybits) == -1)
continue; {
} WARN("ioct(EVIOCGBIT, EV_KEY) failed: %d %s\n", errno, strerror(errno));
close(fd);
continue;
}
/* A true joystick has at least axis X and Y, and at least 1 /* A true joystick has at least axis X and Y, and at least 1
* button. copied from linux/drivers/input/joydev.c */ * button. copied from linux/drivers/input/joydev.c */
if (test_bit(joydev.absbits,ABS_X) && test_bit(joydev.absbits,ABS_Y) && if (test_bit(joydev.absbits,ABS_X) && test_bit(joydev.absbits,ABS_Y) &&
@ -628,24 +632,29 @@ static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
TRACE("(this=%p)\n",This); TRACE("(this=%p)\n",This);
res = IDirectInputDevice2AImpl_Acquire(iface); if ((res = IDirectInputDevice2AImpl_Acquire(iface)) != DI_OK)
if (res==DI_OK) { {
if (-1==(This->joyfd=open(This->joydev->device,O_RDWR))) { WARN("Failed to acquire: %x\n", res);
if (-1==(This->joyfd=open(This->joydev->device,O_RDONLY))) { return res;
/* Couldn't open the device at all */ }
perror(This->joydev->device);
IDirectInputDevice2AImpl_Unacquire(iface); if ((This->joyfd = open(This->joydev->device, O_RDWR)) == -1)
return DIERR_NOTFOUND; {
} else { if ((This->joyfd = open(This->joydev->device, O_RDONLY)) == -1)
/* Couldn't open in r/w but opened in read-only. */ {
WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device); /* Couldn't open the device at all */
ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno));
IDirectInputDevice2AImpl_Unacquire(iface);
return DIERR_NOTFOUND;
} }
}
} }
else else
WARN("Failed to acquire: %x\n", res); {
/* Couldn't open in r/w but opened in read-only. */
WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device);
}
return res; return DI_OK;
} }
/****************************************************************************** /******************************************************************************