summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJeffrey Pfau <jeffrey@endrift.com>2016-01-03 00:53:31 -0800
committerJeffrey Pfau <jeffrey@endrift.com>2016-01-03 00:53:31 -0800
commitd4e2c9fa98edf82380033b4192e511c634e5fc0c (patch)
tree36557986afd571d4f280927a017dd8213972a503 /Source
parentf0e5811d9af52c17598cf2dd1ba994ee12cbe53e (diff)
HW: Fix libusb support for older libusb APIs
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/HW/SI_GCAdapter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/Core/Core/HW/SI_GCAdapter.cpp b/Source/Core/Core/HW/SI_GCAdapter.cpp
index 655b9965e0..b6b12bcfdb 100644
--- a/Source/Core/Core/HW/SI_GCAdapter.cpp
+++ b/Source/Core/Core/HW/SI_GCAdapter.cpp
@@ -50,7 +50,9 @@ static std::function<void(void)> s_detect_callback;
static bool s_libusb_driver_not_supported = false;
static libusb_context* s_libusb_context = nullptr;
static bool s_libusb_hotplug_enabled = false;
+#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102
static libusb_hotplug_callback_handle s_hotplug_handle;
+#endif
static u8 s_endpoint_in = 0;
static u8 s_endpoint_out = 0;
@@ -72,6 +74,7 @@ static void Read()
}
}
+#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102
static int HotplugCallback(libusb_context* ctx, libusb_device* dev, libusb_hotplug_event event, void* user_data)
{
if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED)
@@ -86,12 +89,14 @@ static int HotplugCallback(libusb_context* ctx, libusb_device* dev, libusb_hotpl
}
return 0;
}
+#endif
static void ScanThreadFunc()
{
Common::SetCurrentThreadName("GC Adapter Scanning Thread");
NOTICE_LOG(SERIALINTERFACE, "GC Adapter scanning thread started");
+#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102
s_libusb_hotplug_enabled = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) != 0;
if (s_libusb_hotplug_enabled)
{
@@ -100,6 +105,7 @@ static void ScanThreadFunc()
if (s_libusb_hotplug_enabled)
NOTICE_LOG(SERIALINTERFACE, "Using libUSB hotplug detection");
}
+#endif
while (s_adapter_detect_thread_running.IsSet())
{
@@ -302,8 +308,10 @@ static void AddGCAdapter(libusb_device* device)
void Shutdown()
{
StopScanThread();
+#if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102
if (s_libusb_hotplug_enabled)
libusb_hotplug_deregister_callback(s_libusb_context, s_hotplug_handle);
+#endif
Reset();
if (s_libusb_context)