Lines 1-38
Link Here
|
1 |
--- Source/Core/InputCommon/GCAdapter.cpp.orig 2016-12-01 10:27:29.504018310 +0000 |
1 |
commit c5b3b52d553d |
2 |
+++ Source/Core/InputCommon/GCAdapter.cpp 2016-12-01 10:30:44.024005984 +0000 |
2 |
Author: Jeffrey Pfau <jeffrey@endrift.com> |
3 |
@@ -50,7 +50,7 @@ |
3 |
Date: Mon Dec 26 22:50:36 2016 -0800 |
|
|
4 |
|
5 |
InputCommon: Fix FreeBSD 11 libusb incompatibilities |
6 |
--- |
7 |
Source/Core/InputCommon/GCAdapter.cpp | 6 ++++++ |
8 |
1 file changed, 6 insertions(+) |
9 |
|
10 |
--- Source/Core/InputCommon/GCAdapter.cpp.orig 2016-06-24 08:09:07 UTC |
11 |
+++ Source/Core/InputCommon/GCAdapter.cpp |
12 |
@@ -49,7 +49,11 @@ static std::function<void(void)> s_detect_callback; |
13 |
|
4 |
static bool s_libusb_driver_not_supported = false; |
14 |
static bool s_libusb_driver_not_supported = false; |
5 |
static libusb_context* s_libusb_context = nullptr; |
15 |
static libusb_context* s_libusb_context = nullptr; |
|
|
16 |
+#if defined(__FreeBSD__) && __FreeBSD__ >= 11 |
17 |
+static bool s_libusb_hotplug_enabled = true; |
18 |
+#else |
6 |
static bool s_libusb_hotplug_enabled = false; |
19 |
static bool s_libusb_hotplug_enabled = false; |
7 |
-#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
20 |
+#endif |
8 |
+#if !defined(__FreeBSD__) && defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
21 |
#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
9 |
static libusb_hotplug_callback_handle s_hotplug_handle; |
22 |
static libusb_hotplug_callback_handle s_hotplug_handle; |
10 |
#endif |
23 |
#endif |
11 |
|
24 |
@@ -102,7 +106,9 @@ static void ScanThreadFunc() |
12 |
@@ -76,7 +76,7 @@ |
|
|
13 |
} |
14 |
} |
15 |
|
16 |
-#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
17 |
+#if !defined(__FreeBSD__) && defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
18 |
static int HotplugCallback(libusb_context* ctx, libusb_device* dev, libusb_hotplug_event event, void* user_data) |
19 |
{ |
20 |
if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) |
21 |
@@ -101,7 +101,7 @@ |
22 |
Common::SetCurrentThreadName("GC Adapter Scanning Thread"); |
23 |
NOTICE_LOG(SERIALINTERFACE, "GC Adapter scanning thread started"); |
25 |
NOTICE_LOG(SERIALINTERFACE, "GC Adapter scanning thread started"); |
24 |
|
26 |
|
25 |
-#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
27 |
#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
26 |
+#if !defined(__FreeBSD__) && defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
28 |
+#ifndef __FreeBSD__ |
27 |
s_libusb_hotplug_enabled = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) != 0; |
29 |
s_libusb_hotplug_enabled = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) != 0; |
|
|
30 |
+#endif |
28 |
if (s_libusb_hotplug_enabled) |
31 |
if (s_libusb_hotplug_enabled) |
29 |
{ |
32 |
{ |
30 |
@@ -321,7 +321,7 @@ |
33 |
if (libusb_hotplug_register_callback(s_libusb_context, (libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT), LIBUSB_HOTPLUG_ENUMERATE, 0x057e, 0x0337, LIBUSB_HOTPLUG_MATCH_ANY, HotplugCallback, nullptr, &s_hotplug_handle) != LIBUSB_SUCCESS) |
31 |
void Shutdown() |
|
|
32 |
{ |
33 |
StopScanThread(); |
34 |
-#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
35 |
+#if !defined(__FreeBSD__) && defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 |
36 |
if (s_libusb_hotplug_enabled) |
37 |
libusb_hotplug_deregister_callback(s_libusb_context, s_hotplug_handle); |
38 |
#endif |