dolphin/Externals/hidapi/applied_patches/0002-macOS-Add-errno-setting-in-set_report-HID.patch
Vincent Duvert bb5e5d964a Added patches for hidapi modifications
This allows tracking what modifications were made to the upstream code.
2018-01-13 21:20:54 +01:00

52 lines
1.7 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 3abc288e02089b3143547177e027d3820e5d7e59 Mon Sep 17 00:00:00 2001
From: Vincent Duvert <vincent@duvert.net>
Date: Sun, 7 Jan 2018 11:14:51 +0100
Subject: [PATCH 2/2] macOS: Add errno setting in set_report (HID)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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).
macOSs implementation of hid_write detected this specific error (IOHIDDeviceSetReport returns kUSBHostReturnPipeStalled) but didnt set errno so the check failed.
This add errno assignment to failure cases of macOSs hid_write.
---
Externals/hidapi/mac/hid.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/Externals/hidapi/mac/hid.c b/Externals/hidapi/mac/hid.c
index 46a97886d7..70b615d40d 100644
--- a/Externals/hidapi/mac/hid.c
+++ b/Externals/hidapi/mac/hid.c
@@ -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;
--
2.14.3 (Apple Git-98)