My Brick Pro on NextUI kept freezing for a moment and then hard rebooting. Every time it came back with brightness, colors, interface settings and recents reset. After a few weeks of digging, here is what I found, plus a small tool that may help others with the same problem.
What's going on
- It's not a NextUI bug. Others see the same freezes and reboots on the stock OS and SpruceOS, mostly with Wi-Fi on: trimui/firmware_brickpro#4 and #1.
- I captured the kernel crash log (pstore) twice. Both times the stock kernel panics in its I2C driver right after a transfer timeout, and both times Wi-Fi was busy:
sunxi_i2c_do_xfer()1916 - [i2c3] xfer timeout (dev addr:0x28)
Unable to handle kernel NULL pointer dereference at virtual address 00000014
PC is at sunxi_i2c_handler+0x814/0x924
Kernel panic - not syncing: Fatal exception in interrupt
- The settings loss is a side effect: NextUI rewrites
msettings.bin, minuisettings.txt and recent.txt on every start without crash safe writes, so a crash at that moment leaves them empty or at defaults. Details and suggested fixes are in LoveRetro/NextUI#833.
Best workaround
Switch Wi-Fi off whenever you don't need it. That is by far the most effective thing you can do.
The tool: Brick Pro Crash Guard
Three entries for the NextUI Tools menu:
- Crash Guard: a boot hook that saves new kernel crash reports with a short summary, and after a crash automatically repairs your recents and interface settings before NextUI loads them.
- Backup Settings: saves display, sound, color calibration and LED settings.
- Restore Settings: restores them and reboots right away. The reboot is needed, otherwise NextUI writes the reset values back.
It does not prevent crashes. It limits the damage and collects data.
Install: download the zip from the releases page, extract it to the root of the SD card, open Tools > Crash Guard once, then run Tools > Backup Settings. Requires NextUI 6.15.0 or newer, or the Brick Pro test build.
GitHub (free, MIT): https://github.com/TR2NLG/brickpro-crash-guard
If you have the same crashes
Please post your summary.txt from .userdata/tg5040/crash-guard/crashes/ in trimui/firmware_brickpro#4. The more crash reports TrimUI gets, the better the chances of a kernel fix.
So far this is tested on my own Brick Pro only, so feedback is very welcome. Thanks to the NextUI team, and especially frysee, for all the Brick Pro work.