Re: [PATCH] winejoystick.drv: Gracefully handle polling an unplugged device
On Mar 2, 2016, at 11:28 AM, Aric Stewart <aric(a)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
participants (1)
-
Ken Thomases