erpt: GetMmcErrorInfo, GetSdCard*Info

This commit is contained in:
Michael Scire 2023-10-25 12:41:18 -07:00
parent fa384fd920
commit 60974a5f4e
10 changed files with 472 additions and 10 deletions

View file

@ -70,6 +70,26 @@ namespace ams::fs {
R_SUCCEED();
}
Result GetAndClearMmcErrorInfo(StorageErrorInfo *out_sei, size_t *out_log_size, char *out_log_buffer, size_t log_buffer_size) {
/* Check pre-conditions. */
AMS_FS_R_UNLESS(out_sei != nullptr, fs::ResultNullptrArgument());
AMS_FS_R_UNLESS(out_log_size != nullptr, fs::ResultNullptrArgument());
AMS_FS_R_UNLESS(out_log_buffer != nullptr, fs::ResultNullptrArgument());
auto fsp = impl::GetFileSystemProxyServiceObject();
/* Open a device operator. */
sf::SharedPointer<fssrv::sf::IDeviceOperator> device_operator;
AMS_FS_R_TRY(fsp->OpenDeviceOperator(std::addressof(device_operator)));
/* Get the error info. */
s64 log_size = 0;
AMS_FS_R_TRY(device_operator->GetAndClearMmcErrorInfo(out_sei, std::addressof(log_size), sf::OutBuffer(out_log_buffer, log_buffer_size), static_cast<s64>(log_buffer_size)));
*out_log_size = static_cast<size_t>(log_size);
R_SUCCEED();
}
Result GetMmcExtendedCsd(void *dst, size_t size) {
/* Check pre-conditions. */
AMS_FS_R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());