[PATCH] winejoystick.drv: Gracefully handle polling an unplugged device
Ken Thomases
ken at codeweavers.com
Wed Mar 2 12:01:40 CST 2016
On Mar 2, 2016, at 11:28 AM, Aric Stewart <aric at codeweavers.com> wrote:
>
> dlls/winejoystick.drv/joystick_osx.c | 40 +++++++++++++++++++++++++++++++++---
> 1 file changed, 37 insertions(+), 3 deletions(-)
> - IOHIDDeviceGetValue(device, button, &valueRef);
> + ret = IOHIDDeviceGetValue(device, button, &valueRef);
> + if (ret != kIOReturnSuccess)
> + {
> + switch (ret)
> + {
> + case kIOReturnNotAttached:
> + return JOYERR_UNPLUGGED;
> + default:
> + ERR("IOHIDDeviceGetValue returned 0x%x\n",ret);
> + return JOYERR_NOCANDO;
> + }
> + }
The above sort of change is repeated three times. Seems like a case for a helper function.
-Ken
More information about the wine-devel
mailing list