From e85fa26768cb4efbcec20dd32030c974e7e18c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 16 Jun 2019 15:07:06 +0200 Subject: [PATCH] BTReal: Use FromThread::ANY for USB transfer replies libusb transfer callbacks might be called immediately during transfer submission in some cases. (libusb doesn't even specify what thread the callback is invoked on.) In other words, it is possible to reach the transfer callback from the CPU thread, and not just from the USB event handling thread. So CoreTiming::FromThread::NON_CPU is incorrect and should instead be ANY. --- Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index b4322681d7..73a9c8fd5e 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -592,8 +592,7 @@ void BluetoothReal::HandleCtrlTransfer(libusb_transfer* tr) } const auto& command = m_current_transfers.at(tr).command; command->FillBuffer(libusb_control_transfer_get_data(tr), tr->actual_length); - m_ios.EnqueueIPCReply(command->ios_request, tr->actual_length, 0, - CoreTiming::FromThread::NON_CPU); + m_ios.EnqueueIPCReply(command->ios_request, tr->actual_length, 0, CoreTiming::FromThread::ANY); m_current_transfers.erase(tr); } @@ -641,8 +640,7 @@ void BluetoothReal::HandleBulkOrIntrTransfer(libusb_transfer* tr) const auto& command = m_current_transfers.at(tr).command; command->FillBuffer(tr->buffer, tr->actual_length); - m_ios.EnqueueIPCReply(command->ios_request, tr->actual_length, 0, - CoreTiming::FromThread::NON_CPU); + m_ios.EnqueueIPCReply(command->ios_request, tr->actual_length, 0, CoreTiming::FromThread::ANY); m_current_transfers.erase(tr); } } // namespace IOS::HLE::Device