summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2025-07-21 21:00:20 -0400
committerGitHub <noreply@github.com>2025-07-21 21:00:20 -0400
commitc6de692d01bd71ee501e4a7dfb3361c620b482f1 (patch)
treea877d272c7bc125a6ce505aa0fddeab5180e3549 /Source
parentc39c8277b7fd570a4101bc621a9179f3ece10e6b (diff)
parent8b2d5699329607d7c6e2de93369c95d4ace94399 (diff)
Merge pull request #13784 from jordan-woyak/btreal-restore-keys-on-hci-reset
BTReal: Always restore link keys on HCI reset.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp16
1 files changed, 11 insertions, 5 deletions
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<IPCReply> 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)
{