IOS/STM: fix IPC reply for unknown ioctl requests

This commit is contained in:
Tillmann Karras 2024-05-31 10:21:59 +01:00
parent 9bc8ea6d6f
commit 96e2f5eef6
2 changed files with 14 additions and 1 deletions

View File

@ -29,6 +29,7 @@ enum ReturnCode : s32
IPC_EMAX = -5, // Too many file descriptors open IPC_EMAX = -5, // Too many file descriptors open
IPC_ENOENT = -6, // File not found IPC_ENOENT = -6, // File not found
IPC_EQUEUEFULL = -8, // Queue full IPC_EQUEUEFULL = -8, // Queue full
IPC_UNKNOWN = -9, // Unknown
IPC_EIO = -12, // ECC error IPC_EIO = -12, // ECC error
IPC_ENOMEM = -22, // Alloc failed during request IPC_ENOMEM = -22, // Alloc failed during request
FS_EINVAL = -101, // Invalid path 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"); INFO_LOG_FMT(IOS_STM, " IOCTL_STM_LEDMODE");
break; 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: default:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_STM); request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_STM);
return_value = IPC_UNKNOWN;
break;
} }
return IPCReply(return_value); return IPCReply(return_value);
@ -73,7 +85,7 @@ STMEventHookDevice::~STMEventHookDevice()
std::optional<IPCReply> STMEventHookDevice::IOCtl(const IOCtlRequest& request) std::optional<IPCReply> STMEventHookDevice::IOCtl(const IOCtlRequest& request)
{ {
if (request.request != IOCTL_STM_EVENTHOOK) if (request.request != IOCTL_STM_EVENTHOOK)
return IPCReply(IPC_EINVAL); return IPCReply(IPC_UNKNOWN);
if (s_event_hook_request) if (s_event_hook_request)
return IPCReply(IPC_EEXIST); return IPCReply(IPC_EEXIST);