summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/GCAdapter.cpp
diff options
context:
space:
mode:
authorVincent Duvert <vincent@duvert.net>2018-07-17 22:29:48 +0200
committerVincent Duvert <vincent@duvert.net>2019-05-29 18:28:24 +0200
commit0165e5e703c791451d6e6f064f53fb0ff0d6b4c3 (patch)
treef5b2e5e5c8793cd54f21a27141955c9e336ca6b4 /Source/Core/InputCommon/GCAdapter.cpp
parent80d8173d29749b13ccdf84e75641e179ea34768b (diff)
GCAdapter: Close libusb handle if an open error occurs
The handle was previously kept open, which was causing future adapter plug/unplug events to be ignored.
Diffstat (limited to 'Source/Core/InputCommon/GCAdapter.cpp')
-rw-r--r--Source/Core/InputCommon/GCAdapter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp
index 4e008317df..d52bdf561d 100644
--- a/Source/Core/InputCommon/GCAdapter.cpp
+++ b/Source/Core/InputCommon/GCAdapter.cpp
@@ -276,12 +276,18 @@ static bool CheckDeviceAccess(libusb_device* device)
// this split is needed so that we don't avoid claiming the interface when
// detaching the kernel driver is successful
if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
+ {
+ libusb_close(s_handle);
+ s_handle = nullptr;
return false;
+ }
ret = libusb_claim_interface(s_handle, 0);
if (ret)
{
ERROR_LOG(SERIALINTERFACE, "libusb_claim_interface failed with error: %d", ret);
+ libusb_close(s_handle);
+ s_handle = nullptr;
return false;
}