Merge pull request #12816 from Tilka/stm

IOS/STM: fix IPC reply for unknown ioctl requests
This commit is contained in:
Admiral H. Curtiss 2024-06-15 15:31:58 +02:00 committed by GitHub
commit 3edc663467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 5 deletions

View File

@ -29,6 +29,7 @@ enum ReturnCode : s32
IPC_EMAX = -5, // Too many file descriptors open
IPC_ENOENT = -6, // File not found
IPC_EQUEUEFULL = -8, // Queue full
IPC_UNKNOWN = -9, // Unknown
IPC_EIO = -12, // ECC error
IPC_ENOMEM = -22, // Alloc failed during request
FS_EINVAL = -101, // Invalid path

View File

@ -58,8 +58,20 @@ std::optional<IPCReply> STMImmediateDevice::IOCtl(const IOCtlRequest& request)
INFO_LOG_FMT(IOS_STM, " IOCTL_STM_LEDMODE");
break;
case IOCTL_STM_HOTRESET_FOR_PD:
case IOCTL_STM_WAKEUP:
case IOCTL_STM_GET_IDLEMODE:
case IOCTL_STM_READDDRREG:
case IOCTL_STM_READDDRREG2:
case IOCTL_STM_LEDFLASH:
case IOCTL_STM_READVER:
ERROR_LOG_FMT(IOS_STM, "{} - Unimplemented IOCtl: {}", GetDeviceName(), request.request);
break;
default:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_STM);
return_value = IPC_UNKNOWN;
break;
}
return IPCReply(return_value);
@ -73,7 +85,7 @@ STMEventHookDevice::~STMEventHookDevice()
std::optional<IPCReply> STMEventHookDevice::IOCtl(const IOCtlRequest& request)
{
if (request.request != IOCTL_STM_EVENTHOOK)
return IPCReply(IPC_EINVAL);
return IPCReply(IPC_UNKNOWN);
if (s_event_hook_request)
return IPCReply(IPC_EEXIST);

View File

@ -15,20 +15,23 @@ namespace IOS::HLE
{
enum
{
// /dev/stm/eventhook
IOCTL_STM_EVENTHOOK = 0x1000,
IOCTL_STM_GET_IDLEMODE = 0x3001,
IOCTL_STM_RELEASE_EH = 0x3002,
// /dev/stm/immediate
IOCTL_STM_HOTRESET = 0x2001,
IOCTL_STM_HOTRESET_FOR_PD = 0x2002,
IOCTL_STM_SHUTDOWN = 0x2003,
IOCTL_STM_IDLE = 0x2004,
IOCTL_STM_WAKEUP = 0x2005,
IOCTL_STM_GET_IDLEMODE = 0x3001,
IOCTL_STM_RELEASE_EH = 0x3002,
IOCTL_STM_READDDRREG = 0x4001,
IOCTL_STM_READDDRREG2 = 0x4002,
IOCTL_STM_VIDIMMING = 0x5001,
IOCTL_STM_LEDFLASH = 0x6001,
IOCTL_STM_LEDMODE = 0x6002,
IOCTL_STM_READVER = 0x7001,
IOCTL_STM_READDDRREG = 0x4001,
IOCTL_STM_READDDRREG2 = 0x4002,
};
enum