IOS/USB: Reconnect HIDv4 Devices after shutdown

This commit is contained in:
Joshua de Reeper 2024-11-04 13:07:10 +00:00
parent 59530966f9
commit 6dbffd1fee
2 changed files with 4 additions and 1 deletions

View File

@ -96,10 +96,11 @@ std::optional<IPCReply> USB_HIDv4::GetDeviceChange(const IOCtlRequest& request)
m_devicechange_hook_request = std::make_unique<IOCtlRequest>(GetSystem(), request.address);
// If there are pending changes, the reply is sent immediately (instead of on device
// insertion/removal).
if (m_has_pending_changes)
if (m_has_pending_changes || m_is_shut_down)
{
TriggerDeviceChangeReply();
m_has_pending_changes = false;
m_is_shut_down = false;
}
return std::nullopt;
}
@ -114,6 +115,7 @@ IPCReply USB_HIDv4::Shutdown(const IOCtlRequest& request)
memory.Write_U32(0xffffffff, m_devicechange_hook_request->buffer_out);
GetEmulationKernel().EnqueueIPCReply(*m_devicechange_hook_request, -1);
m_devicechange_hook_request.reset();
m_is_shut_down = true;
}
return IPCReply(IPC_SUCCESS);
}

View File

@ -45,6 +45,7 @@ private:
static constexpr u8 HID_CLASS = 0x03;
bool m_has_pending_changes = true;
bool m_is_shut_down = false;
std::mutex m_devicechange_hook_address_mutex;
std::unique_ptr<IOCtlRequest> m_devicechange_hook_request;