diff options
| author | shuffle2 <godisgovernment@gmail.com> | 2017-06-07 21:20:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-07 21:20:06 -0700 |
| commit | ffd8309aca806a6cf5ca4da85f5854ef14c8e0d9 (patch) | |
| tree | ba029b5a68e1613f3dca3185a854ef70d05de61e /Source/Core/InputCommon/GCAdapter.cpp | |
| parent | a2358786dc66eab8fa63987751d4e3fc1a3ee525 (diff) | |
| parent | 9ee63608b3c7160cadb0291e577b158d1b8aa5c6 (diff) | |
Merge branch 'master' into fix-unittests
Diffstat (limited to 'Source/Core/InputCommon/GCAdapter.cpp')
| -rw-r--r-- | Source/Core/InputCommon/GCAdapter.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index 2cb7819d9d..a422e2635e 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -266,27 +266,26 @@ static bool CheckDeviceAccess(libusb_device* device) } return false; } - else if ((ret = libusb_kernel_driver_active(s_handle, 0)) == 1) + else { - if ((ret = libusb_detach_kernel_driver(s_handle, 0)) && ret != LIBUSB_ERROR_NOT_SUPPORTED) + ret = libusb_kernel_driver_active(s_handle, 0); + if (ret == 1) { - ERROR_LOG(SERIALINTERFACE, "libusb_detach_kernel_driver failed with error: %d", ret); + ret = libusb_detach_kernel_driver(s_handle, 0); + if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED) + ERROR_LOG(SERIALINTERFACE, "libusb_detach_kernel_driver failed with error: %d", ret); } } // 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) - { return false; - } - else if ((ret = libusb_claim_interface(s_handle, 0))) - { + + ret = libusb_claim_interface(s_handle, 0); + if (ret) ERROR_LOG(SERIALINTERFACE, "libusb_claim_interface failed with error: %d", ret); - } else - { return true; - } } return false; } |
