Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibusbDevice: Don't detach kernel drivers on macOS #13318

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Source/Core/Core/IOS/USB/LibusbDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ static int DoForEachInterface(const Configs& configs, u8 config_num, Function ac
int LibusbDevice::ClaimAllInterfaces(u8 config_num) const
{
const int ret = DoForEachInterface(m_config_descriptors, config_num, [this](u8 i) {
// On macos detaching would fail without root or entitlement.
// We assume user is using GCAdapterDriver and therefore don't want to detach anything
#if !defined(__APPLE__)
const int ret2 = libusb_detach_kernel_driver(m_handle, i);
if (ret2 < LIBUSB_SUCCESS && ret2 != LIBUSB_ERROR_NOT_FOUND &&
ret2 != LIBUSB_ERROR_NOT_SUPPORTED)
Expand All @@ -447,6 +450,7 @@ int LibusbDevice::ClaimAllInterfaces(u8 config_num) const
LibusbUtils::ErrorWrap(ret2));
return ret2;
}
#endif
return libusb_claim_interface(m_handle, i);
});
if (ret < LIBUSB_SUCCESS)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/InputCommon/GCAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ static bool CheckDeviceAccess(libusb_device* device)
if (ret == 1) // 1: kernel driver is active
{
// On macos detaching would fail without root or entitlement.
// We assume user is using GCAdapterDriver and therefor don't want to detach anything
// We assume user is using GCAdapterDriver and therefore don't want to detach anything
#if !defined(__APPLE__)
ret = libusb_detach_kernel_driver(s_handle, 0);
detach_failed =
Expand Down