DavidBuchanan314 / fusee-lede

Instructions/files for building a custom LEDE image to turn cheap routers into a Nintendo Switch "modchip"/"dongle". Powered by https://github.com/DavidBuchanan314/fusee-nano
55 stars 15 forks source link

Smashed the stack! But can't get switch to boot.. #6

Open shawly opened 6 years ago

shawly commented 6 years ago

So I've built a new LEDE image for my GL-MT300N-V2 (mt7628 based) with the ehci patch. I've added some logging to the 20-tegra_rcm script, and it seems that the script is executed twice, also it seems that the first time, the payload seems to get injected, but the Switch won't boot the payload. Furthermore the Switch won't get recognized anymore, not even my PC, I have to hold down the power button until the Switch turns off and then start it again, to get it back into RCM.

I've tried both, the standard Fusee payload that get's installed and I've also replaced it with the SX OS payload, but to no avail. On PC with TegraRcmGUI it works fine, so seem to be no apparent issues with the Switch itself.

Here is the syslog, as you can see, the script gets executed two times, but the second time it gets fired, it seems that an error occurs which doesn't get logged.

Fri Aug 17 08:26:48 2018 user.notice USB: Device: / Action: remove / ID: 955/7321/102
Fri Aug 17 08:26:48 2018 user.notice USB: Device: / Action: remove / ID: 955/7321/102
Fri Aug 17 08:27:14 2018 user.notice USB: Device: / Action: add / ID: 955/7321/102
Fri Aug 17 08:27:14 2018 user.notice APX: Starting fusee-nano...
Fri Aug 17 08:27:14 2018 user.notice APX: [*] device id: 000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2
Fri Aug 17 08:27:14 2018 user.notice APX: [*] Read 124 bytes from /usr/share/fusee-nano/intermezzo.bin
Fri Aug 17 08:27:14 2018 user.notice APX: [*] Read 27748 bytes from /usr/share/fusee-nano/payload.bin
Fri Aug 17 08:27:14 2018 user.notice APX: [+] Sent 0x17000 bytes
Fri Aug 17 08:27:14 2018 user.notice APX: [+] Smashed the stack: -1
Fri Aug 17 08:27:14 2018 user.notice APX: Switch should now boot...
Fri Aug 17 08:27:14 2018 user.notice USB: Device: / Action: add / ID: 955/7321/102
Fri Aug 17 08:27:14 2018 user.notice APX: Starting fusee-nano...
Fri Aug 17 08:27:15 2018 user.notice APX: Switch should now boot...

When removing the hotplug.d script and executing fusee-nano manually, the same thing occurs, it shows Smashed the stack: -1, nothing happens and if I execute it the second time [-] Failed to read device ID: Operation timed out is shown, which is the error message that wasn't logged before.

So is there any way to get this to work? As it seems the Switch at least gets recognized by my device.

DavidBuchanan314 commented 6 years ago

The [-] Failed to read device ID: Operation timed out on second run is normal - you will have to reboot the switch on every failed attempt.

I'm not sure why it's failing for you though. I was actually having similar issues when I was first trying to get this to work. For some reason, adding in a strategic usleep made things work, and I'm not really sure why... https://github.com/DavidBuchanan314/fusee-nano/blob/master/src/usb.c#L168

Perhaps you could try increasing the delay, or maybe removing it entirely? Other than that, I have no idea...

DavidBuchanan314 commented 6 years ago

Seems to be the same issue as here: https://github.com/DavidBuchanan314/fusee-lede/issues/3

DavidBuchanan314 commented 6 years ago

If your router is running in big-endian mode, please try building the latest commit, it might have fixed this.

shawly commented 6 years ago

Awesome, I'll try it out this weekend!

shawly commented 6 years ago

Nope, still the same behavior, shows smashed the stack on the first execution and if I try a second time, the Switch won't get detected anymore and I have to force restart it.

Edit: I also tried removing the usleep or extending it to 1sec but it still won't work.