Skip to content
Permalink
Browse files

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.
  • Loading branch information...
VinDuv committed Jul 17, 2018
1 parent 80d8173 commit 0165e5e703c791451d6e6f064f53fb0ff0d6b4c3
Showing with 6 additions and 0 deletions.
  1. +6 −0 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;
}

0 comments on commit 0165e5e

Please sign in to comment.
You can’t perform that action at this time.