This commit is contained in:
Timo 2025-05-29 16:46:01 +02:00 committed by GitHub
commit ea6bc5252b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 14 deletions

View File

@ -204,6 +204,22 @@ std::optional<IPCReply> USBV5ResourceManager::HandleDeviceIOCtl(const IOCtlReque
return handler(*device);
}
IPCReply USBV5ResourceManager::GetUSBVersion(const IOCtlRequest& request) const
{
static constexpr u32 VERSION = 0x50001;
if (request.buffer_in != 0 || request.buffer_in_size != 0 || request.buffer_out == 0 ||
request.buffer_out_size != 0x20)
{
return IPCReply(IPC_EINVAL);
}
auto& system = GetSystem();
auto& memory = system.GetMemory();
memory.Write_U32(VERSION, request.buffer_out);
return IPCReply(IPC_SUCCESS);
}
void USBV5ResourceManager::OnDeviceChange(const ChangeEvent event,
std::shared_ptr<USB::Device> device)
{

View File

@ -83,6 +83,7 @@ protected:
using Handler = std::function<std::optional<IPCReply>(USBV5Device&)>;
std::optional<IPCReply> HandleDeviceIOCtl(const IOCtlRequest& request, Handler handler);
IPCReply GetUSBVersion(const IOCtlRequest& request) const;
void OnDeviceChange(ChangeEvent event, std::shared_ptr<USB::Device> device) override;
void OnDeviceChangeEnd() override;

View File

@ -16,21 +16,15 @@
namespace IOS::HLE
{
constexpr u32 USBV5_VERSION = 0x50001;
USB_HIDv5::~USB_HIDv5() = default;
std::optional<IPCReply> USB_HIDv5::IOCtl(const IOCtlRequest& request)
{
auto& system = GetSystem();
auto& memory = system.GetMemory();
request.Log(GetDeviceName(), Common::Log::LogType::IOS_USB);
switch (request.request)
{
case USB::IOCTL_USBV5_GETVERSION:
memory.Write_U32(USBV5_VERSION, request.buffer_out);
return IPCReply(IPC_SUCCESS);
return GetUSBVersion(request);
case USB::IOCTL_USBV5_GETDEVICECHANGE:
return GetDeviceChange(request);
case USB::IOCTL_USBV5_SHUTDOWN:

View File

@ -16,21 +16,15 @@
namespace IOS::HLE
{
constexpr u32 USBV5_VERSION = 0x50001;
USB_VEN::~USB_VEN() = default;
std::optional<IPCReply> USB_VEN::IOCtl(const IOCtlRequest& request)
{
auto& system = GetSystem();
auto& memory = system.GetMemory();
request.Log(GetDeviceName(), Common::Log::LogType::IOS_USB);
switch (request.request)
{
case USB::IOCTL_USBV5_GETVERSION:
memory.Write_U32(USBV5_VERSION, request.buffer_out);
return IPCReply(IPC_SUCCESS);
return GetUSBVersion(request);
case USB::IOCTL_USBV5_GETDEVICECHANGE:
return GetDeviceChange(request);
case USB::IOCTL_USBV5_SHUTDOWN: