fatal: Reboot to RCM if VOL is pressed instead of PWR.

This commit is contained in:
Michael Scire 2018-11-30 05:33:35 -08:00
parent 8d3b8354c3
commit be5b58d033
8 changed files with 48 additions and 15 deletions

View File

@ -36,8 +36,8 @@ uint32_t configitem_set(bool privileged, ConfigItem item, uint64_t value) {
g_battery_profile = (value != 0);
break;
case CONFIGITEM_NEEDS_REBOOT_TO_RCM:
/* Force a reboot to RCM. */
{
/* Force a reboot to RCM, if requested. */
if (value != 0) {
MAKE_REG32(0x7000E450) = 0x2;
MAKE_REG32(0x7000E400) = 0x10;
while (1) { }

View File

@ -83,7 +83,8 @@
"svcGetDebugThreadContext": "0x67",
"svcQueryDebugProcessMemory": "0x69",
"svcReadDebugProcessMemory": "0x6a",
"svcGetDebugThreadParam": "0x6d"
"svcGetDebugThreadParam": "0x6d",
"svcCallSecureMonitor": "0x7f"
}
}, {
"type": "min_kernel_version",

View File

@ -58,9 +58,9 @@ static void SetupConfigLanguages() {
config->error_desc = u8"Please call 1-800-875-1852 for service.\n";
} else {
config->error_desc = u8"An error has occured.\n\n"
u8"Please press the POWER Button to restart the console. If you are\n"
u8"unable to restart the console, hold the POWER Button for 12 seconds\n"
u8"to turn the console off.\n\n"
u8"Please press the POWER Button to restart the console, or a VOL button\n"
u8"to restart the console in RCM mode. If you are unable to restart the\n"
u8"console, hold the POWER Button for 12 seconds to turn the console off.\n\n"
u8"If the problem persists, refer to the Nintendo Support Website.\n"
u8"support.nintendo.com/switch/error\n";
}

View File

@ -118,7 +118,7 @@ void __appInit(void) {
std::abort();
}
rc = fsInitialize();
rc = gpioInitialize();
if (R_FAILED(rc)) {
std::abort();
}
@ -141,6 +141,7 @@ void __appExit(void) {
fsdevUnmountAll();
fsExit();
plExit();
gpioExit();
spsmExit();
psmExit();
lblExit();

View File

@ -52,7 +52,7 @@ static bool InRepairWithoutVolHeld() {
/* Sleep for 100 ms. */
svcSleepThread(100000000UL);
}
}
}
return false;

View File

@ -94,14 +94,45 @@ void PowerButtonObserveTask::WaitForPowerButton() {
/* Force a reboot after some time if kiosk unit. */
const FatalConfig *config = GetFatalConfig();
TimeoutHelper reboot_helper(config->quest_reboot_interval_second * 1000000000UL);
TimeoutHelper reboot_helper(config->quest_reboot_interval_second * 1000000000UL);
bool check_vol_up = true, check_vol_down = true;
GpioPadSession vol_up_btn, vol_down_btn;
if (R_FAILED(gpioOpenSession(&vol_up_btn, GpioPadName_ButtonVolUp))) {
check_vol_up = false;
}
if (R_FAILED(gpioOpenSession(&vol_down_btn, GpioPadName_ButtonVolDown))) {
check_vol_down = false;
}
/* Ensure we close on early return. */
ON_SCOPE_EXIT { if (check_vol_up) { gpioPadClose(&vol_up_btn); } };
ON_SCOPE_EXIT { if (check_vol_down) { gpioPadClose(&vol_down_btn); } };
/* Set direction input. */
if (check_vol_up) {
gpioPadSetDirection(&vol_up_btn, GpioDirection_Input);
}
if (check_vol_down) {
gpioPadSetDirection(&vol_down_btn, GpioDirection_Input);
}
BpcSleepButtonState state;
GpioValue val;
while (true) {
Result rc = 0;
if (check_vol_up && R_SUCCEEDED((rc = gpioPadGetValue(&vol_up_btn, &val))) && val == GpioValue_Low) {
/* Tell exosphere to reboot to RCM. */
RebootToRcm();
}
Result rc = bpcGetSleepButtonState(&state);
if ((R_SUCCEEDED(rc) && state == BpcSleepButtonState_Held) || (config->quest_flag && reboot_helper.TimedOut())) {
if (check_vol_down && R_SUCCEEDED((rc = gpioPadGetValue(&vol_down_btn, &val))) && val == GpioValue_Low) {
/* Tell exosphere to reboot to RCM. */
RebootToRcm();
}
if ((R_SUCCEEDED(rc = bpcGetSleepButtonState(&state)) && state == BpcSleepButtonState_Held) || (config->quest_flag && reboot_helper.TimedOut())) {
bpcRebootSystem();
return;
}

View File

@ -215,9 +215,9 @@ Result ShowFatalTask::ShowFatal() {
} else {
/* Print a special message for atmosphere version mismatch. */
FontManager::Print(u8"Atmosphère version mismatch detected.\n\n"
u8"Please press the POWER Button to restart the console. If you are\n"
u8"unable to restart the console, hold the POWER Button for 12 seconds\n"
u8"to turn the console off.\n\n"
u8"Please press the POWER Button to restart the console, or a VOL button\n"
u8"to restart the console in RCM mode. If you are unable to restart the\n"
u8"console, hold the POWER Button for 12 seconds to turn the console off.\n\n"
u8"Please ensure that all Atmosphère components are updated.\n"
u8"github.com/Atmosphere-NX/Atmosphere/releases\n");
}

@ -1 +1 @@
Subproject commit dd31b3d2e2450a458ef9c0d6268f3780fe70e083
Subproject commit 05015b9354d3df80e0836aa95d1d4dcfc2aef4b7