diff options
| author | Shawn Hoffman <godisgovernment@gmail.com> | 2022-04-22 08:48:28 -0700 |
|---|---|---|
| committer | Shawn Hoffman <godisgovernment@gmail.com> | 2022-04-22 09:56:47 -0700 |
| commit | 5cd3cf9072a6e75d5d047e66f6d3ce356ec9bf4f (patch) | |
| tree | 91ff8a51a3cb24e61610bc80c69ddd688f7e8691 /Source/Core/InputCommon/GCAdapter.cpp | |
| parent | 978c90845bccfbe864473556cfafb854f901255f (diff) | |
GCAdapter: fix retval check of libusb_detach_kernel_driver
Diffstat (limited to 'Source/Core/InputCommon/GCAdapter.cpp')
| -rw-r--r-- | Source/Core/InputCommon/GCAdapter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index fee15be7ba..6c6e4933bc 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -335,11 +335,13 @@ static bool CheckDeviceAccess(libusb_device* device) return false; } + bool detach_failed = false; ret = libusb_kernel_driver_active(s_handle, 0); if (ret == 1) { ret = libusb_detach_kernel_driver(s_handle, 0); - if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED) + detach_failed = ret < 0 && ret != LIBUSB_ERROR_NOT_FOUND && ret != LIBUSB_ERROR_NOT_SUPPORTED; + if (detach_failed) ERROR_LOG_FMT(CONTROLLERINTERFACE, "libusb_detach_kernel_driver failed with error: {}", ret); } @@ -351,7 +353,7 @@ 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) + if (detach_failed) { libusb_close(s_handle); s_handle = nullptr; |
