mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
Merge pull request #13784 from jordan-woyak/btreal-restore-keys-on-hci-reset
BTReal: Always restore link keys on HCI reset.
This commit is contained in:
@ -121,6 +121,17 @@ std::optional<IPCReply> BluetoothRealDevice::IOCtlV(const IOCtlVRequest& request
|
|||||||
const auto payload = memory.GetSpanForAddress(cmd->data_address).first(cmd->length);
|
const auto payload = memory.GetSpanForAddress(cmd->data_address).first(cmd->length);
|
||||||
m_lib_usb_bt_adapter->ScheduleControlTransfer(cmd->request_type, cmd->request, cmd->value,
|
m_lib_usb_bt_adapter->ScheduleControlTransfer(cmd->request_type, cmd->request, cmd->value,
|
||||||
cmd->index, payload, GetTargetTime());
|
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};
|
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));
|
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)
|
else if (event == HCI_EVENT_CON_COMPL)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user