diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index 0fc76cff55..79cc6ccfed 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -121,6 +121,17 @@ std::optional BluetoothRealDevice::IOCtlV(const IOCtlVRequest& request const auto payload = memory.GetSpanForAddress(cmd->data_address).first(cmd->length); m_lib_usb_bt_adapter->ScheduleControlTransfer(cmd->request_type, cmd->request, cmd->value, cmd->index, payload, GetTargetTime()); + + if (opcode == HCI_CMD_RESET) + { + // After the console issues HCI reset is a good place to restore our link keys. + // We need to do this because: + // Some adapters apparently incorrectly delete keys on HCI reset. + // The adapter was potentially being controlled by the host OS bluetooth stack + // or a Dolphin instance with different link keys. + SendHCIDeleteLinkKeyCommand(); + SendHCIStoreLinkKeyCommand(); + } } return IPCReply{cmd->length}; } @@ -262,11 +273,6 @@ auto BluetoothRealDevice::ProcessHCIEvent(BufferType buffer) -> BufferType std::memcpy(buffer.data() + sizeof(hci_event_hdr_t) + sizeof(ev), &reply, sizeof(reply)); } - else if (ev.opcode == HCI_CMD_RESET) - { - SendHCIDeleteLinkKeyCommand(); - SendHCIStoreLinkKeyCommand(); - } } else if (event == HCI_EVENT_CON_COMPL) {