diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2019-06-29 08:46:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-29 08:46:59 +0200 |
| commit | 75b2b53be2510f6d02e201e8d88e7ff3398363fa (patch) | |
| tree | 42fdf9a7f99a00951872d0fe0395acf10bb6ba20 /Source | |
| parent | e1e269c9f9aef44dafc5b5520b9a89d7c93273f9 (diff) | |
| parent | 70bca53ed6330d3fe3d143e107b98c06e6904d0f (diff) | |
Merge pull request #8200 from randomstuff/detach_driver
Automatically detach/reattach bluetooth driver in passthrough
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index 7ccd5c4fac..13d9563c53 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/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) |
