Repository navigation
Description
After encountering several devices that appeared to be completely unrecoverable and shared the same history of using NextUI, I started digging into the NextUI source code to investigate the possible cause.
Eventually, I found evidence suggesting that NextUI may be responsible for putting the Brick Pro into a limbo state during shutdown, potentially leaving the device in an abnormal power state.
First, for economic or development-effort reasons, NextUI currently appears to handle the shutdown process of the Brick Pro and Smart Pro using the same logic.
Both devices use a shutdown script called:
poweroff_next
The shutdown process is roughly as follows:
The user requests a shutdown.
The shutdown request is sent to the system (PWR_powerOff, PLAT_powerOff).
A shutdown file is created in the temporary directory so that the system knows the device is going through a normal shutdown process. This is intended to distinguish a normal shutdown from a crash or system failure.
poweroff_next is then called from launch.sh, the script that wraps the entire NextUI system.
run_poweroff_protection is executed to check whether the power-off protection feature is enabled. The purpose is to help prevent filesystem/data corruption on the SD card.
Then execute_axp2202_poweroff is executed. This is where I believe the problem occurs.
Why is this potentially dangerous?
The TrimUI Brick runs Linux.
Normally, the shutdown path on a Linux device would look something like:
Application/UI → Linux → PMIC Driver → PMIC
However, NextUI appears to use a different approach:
NextUI → poweroff_next → /dev/i2c-6 → directly writing shutdown registers to the PMIC
The problem is that NextUI does not communicate with the PMIC through the proper PMIC driver.
Inside the PMIC handling code, execute_axp2202_poweroff appears to perform register writes without properly checking whether each operation actually succeeded.
In other words, if one of the write operations fails, the system may simply ignore the failure and continue with the shutdown sequence anyway.
This could potentially result in a partial or incomplete power shutdown.
An incomplete shutdown is dangerous because it can leave different parts of the system in inconsistent power states.
This could potentially explain symptoms such as:
The display not turning on even though the system itself is powered.
The power button becoming unresponsive.
The device appearing to be off while still drawing power.
The CPU or other components still receiving power after shutdown.
The device becoming recoverable only after disconnecting the battery for a while and reconnecting it before attempting to power it on again.
The most obvious consequence is the SD card.
Repeated improper shutdowns can significantly reduce the lifespan of the card and may cause filesystem corruption. And because power is essentially the lifeblood of the entire device, abnormal power states can potentially lead to other unpredictable hardware problems as well.
Activity