Skip to content
Permalink
Browse files

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.
  • Loading branch information...
leoetlino committed Jun 16, 2019
1 parent cf60a9a commit e85fa26768cb4efbcec20dd32030c974e7e18c15
Showing with 2 additions and 4 deletions.
  1. +2 −4 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

0 comments on commit e85fa26

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