Skip to content
Permalink
Browse files

Merge pull request #8200 from randomstuff/detach_driver

Automatically detach/reattach bluetooth driver in passthrough
  • Loading branch information...
leoetlino committed Jun 29, 2019
2 parents e1e269c + 70bca53 commit 75b2b53be2510f6d02e201e8d88e7ff3398363fa
Showing with 9 additions and 4 deletions.
  1. +9 −4 Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp
@@ -555,11 +555,16 @@ bool BluetoothReal::OpenDevice(libusb_device* device)
// Detaching always fails as a regular user on FreeBSD
// https://lists.freebsd.org/pipermail/freebsd-usb/2016-March/014161.html
#ifndef __FreeBSD__
const int result = libusb_detach_kernel_driver(m_handle, INTERFACE);
if (result < 0 && result != LIBUSB_ERROR_NOT_FOUND && result != LIBUSB_ERROR_NOT_SUPPORTED)
int result = libusb_set_auto_detach_kernel_driver(m_handle, 1);
if (result != 0)
{
PanicAlertT("Failed to detach kernel driver for BT passthrough: %s", libusb_error_name(result));
return false;
result = libusb_detach_kernel_driver(m_handle, INTERFACE);
if (result < 0 && result != LIBUSB_ERROR_NOT_FOUND && result != LIBUSB_ERROR_NOT_SUPPORTED)
{
PanicAlertT("Failed to detach kernel driver for BT passthrough: %s",
libusb_error_name(result));
return false;
}
}
#endif
if (libusb_claim_interface(m_handle, INTERFACE) < 0)

0 comments on commit 75b2b53

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