mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 06:51:17 +01:00
macOS: Add errno setting in set_report (HID)
IsDeviceUsable in IOhidapi.cpp uses errno to detect if hid_write failed because of an unconnected Wiimote on a Dolphinbar (it expects errno == EPIPE in this case). macOS’s implementation of hid_write detected this specific error (IOHIDDeviceSetReport returns kUSBHostReturnPipeStalled) but didn’t set errno so the check failed. This add errno assignment to failure cases of macOS’s hid_write.
This commit is contained in:
parent
8d5810a103
commit
3abc288e02
13
Externals/hidapi/mac/hid.c
vendored
13
Externals/hidapi/mac/hid.c
vendored
@ -773,8 +773,10 @@ static int set_report(hid_device *dev, IOHIDReportType type, const unsigned char
|
||||
IOReturn res;
|
||||
|
||||
/* Return if the device has been disconnected. */
|
||||
if (dev->disconnected)
|
||||
if (dev->disconnected) {
|
||||
errno = ENODEV;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (data[0] == 0x0) {
|
||||
/* Not using numbered Reports.
|
||||
@ -797,9 +799,14 @@ static int set_report(hid_device *dev, IOHIDReportType type, const unsigned char
|
||||
|
||||
if (res == kIOReturnSuccess) {
|
||||
return length;
|
||||
}
|
||||
else
|
||||
} else if (res == (IOReturn)0xe0005000) {
|
||||
/* Kernel.framework's IOUSBHostFamily.h defines this error as kUSBHostReturnPipeStalled */
|
||||
errno = EPIPE;
|
||||
return -1;
|
||||
} else {
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user