Power, sleep and battery
End the session safely
Section titled “End the session safely”How you end a session depends on where your files are, how the phone is powered and its power-off support. In every case, files in RAM, such as /tmp, are lost: copy anything you need to your computer or a card first.
| Situation | What to do |
|---|---|
| RAM boot, no battery | Unmount data cards, then unplug USB. |
| RAM boot, battery installed | Unmount data cards, then use the shutdown or battery-removal sequence on your phone page. |
| microSD system card, supported battery-only power-off | Power off with the red key. |
| microSD system card, any other supported power setup | Shut down while on USB power. |
Without a battery, unplugging USB cuts power immediately. Do not assume that poweroff can turn off a phone running on battery: use only the termination sequence documented for that phone and profile.
Unmount data cards
Section titled “Unmount data cards”If a microSD card is mounted for data, stop the programs that use it, turn off any swap on it and unmount it, as described in Remove the card safely. Do not unplug USB or remove the battery while a data card is mounted.
Power off with the red key
Section titled “Power off with the red key”Use this sequence only when your phone page lists battery-only power-off as supported for the current profile.
-
Unmount data cards as described above. With a microSD system card, skip this step; shutdown takes care of the system card.
-
Unplug the USB cable and make sure no charger is connected. The phone refuses to power off while it detects charger power.
-
Hold the Red key for five seconds.
A short press of the Red key does not power off; releasing it before five seconds cancels the request. See application controls for its action in the graphical session. The power-off hold works even while an application uses the keypad.
With a system card, Linux stops its services, writes pending data and makes the card read-only before the phone turns off. If shutdown cannot start, the phone stays on instead of cutting power. Wait until the phone is off before you remove the card.
Shut down a system card on USB power
Section titled “Shut down a system card on USB power”Use this procedure with a supported microSD system-card profile when the phone cannot use the battery-only sequence above. Unplugging USB alone, or a plain poweroff, does not make the system card safe.
-
Keep the USB cable connected. Save graphical work and stop the interface with
rc-service fplinux-session stop. Stop the other programs and services that write to the card, turn off any swap on the card and unmount every card filesystem except the system root. -
Write pending data and make the system root read-only:
Phone syncmount -o remount,ro / -
Check that the root is now read-only. The line for
/must showro:Phone grep ' / ' /proc/mountsIf the remount failed, stop the remaining programs that write to the card and repeat step 2. Keep the phone powered until it succeeds.
-
Shut down and unplug the cable:
Phone poweroff
Return to the phone’s own firmware
Section titled “Return to the phone’s own firmware”After the phone is off, start it normally, without holding the boot key, to use its own firmware. Linux reboot is not supported: every FPLinux start needs a new load over USB, as described in Run FPLinux.
The graphical session’s screen timeout and keypad lock leave Linux, programs and USB running. They are separate from system sleep below.
Sleep preserves the session in RAM while the screen and USB are off and programs are paused. Before sleeping, check that your phone page supports sleep in the current profile and lists a wake source you can use. Put the phone to sleep from a root shell:
echo freeze > /sys/power/stateWake it with a supported power-key action or a clock alarm, as listed on the phone page. Ordinary keypad keys do not wake the phone, and keys pressed during sleep are lost. After waking, the screen turns on again if it was on before, and USB reconnects; open a new shell as described in Connect from a computer.
- Keep any microSD card installed during sleep. A mounted card, swap on a card and a system card can stay in use only in target, profile and filesystem combinations documented as supported on the phone page.
- Sleep is not a way to remove a card or end the session.
- An active vibration stops and does not resume after waking.
- The phone cannot sleep while the FM receiver is on, or while a Bluetooth connection is active.
- This light sleep keeps the processor and memory powered, so it saves less power than a full suspend. Full suspend to RAM is not supported.
Clock and alarms
Section titled “Clock and alarms”Each time ./fplinux run or a standalone archive starts a new session, it tries to set the phone’s clock to your computer’s current time in UTC and prints the result. A clock-setting failure leaves the session usable, so check the result before relying on the time. Reconnecting to a running session does not change the clock. The system clock and battery-backed clock both hold UTC; the Clocks application can display local times at chosen UTC offsets without changing them.
The launcher’s initial clock synchronization updates the battery-backed clock only when its time cannot be read. Saving the date and time in Settings also attempts to update it. To store the current time from a shell:
hwclock -u -w -f /dev/rtc0On UMS9117 phones, the clock covers 1980 to 2099. A phone can lose its clock setting while the battery is out, so check it before relying on it.
Where RTC wake is supported for your phone and profile, set an alarm before sleeping. These RTC alarms are separate from the Clocks application’s reminders. This example wakes after 60 seconds; writing 0 first clears an alarm that is already set:
echo 0 > /sys/class/rtc/rtc0/wakealarmecho +60 > /sys/class/rtc/rtc0/wakealarmecho freeze > /sys/power/stateAn alarm fires once. It keeps its absolute time if you change the clock, and an alarm that the clock skips over fires once. Alarms cannot switch on a phone that is powered off.
Charger and battery
Section titled “Charger and battery”The interfaces and charge helper below apply to supported UMS9117 phones. Charger status, battery telemetry and charging are not verified on the SC9820E Xiaomi Qin 1s+; its board-temperature and ADC readings do not establish battery support.
Check whether charger power is connected (1) or not (0):
cat /sys/class/power_supply/sc2720-charger/onlineThis shows that power is connected, not that the battery is charging. The graphical battery icon is an estimate from available readings, not a calibrated battery percentage. FPLinux does not control charging. The battery voltage, current and a relative charge counter are available where battery telemetry is supported; their names and units are listed in Device interfaces. Their accuracy has not been checked against a measuring instrument.
Check the phone page for battery-telemetry support and the power setup in which it has been tested. The charge measurement helper requires an enabled fuel gauge and a battery installed.
Measure charge while a command runs
Section titled “Measure charge while a command runs”On a phone with supported battery telemetry, the optional fplinux-charge package runs one command and reports how much charge entered or left the battery meanwhile. Install it as described in Optional packages, then run:
fplinux-charge -- sleep 60When the command finishes, fplinux-charge prints the elapsed time, the charge change in µAh and the average current in µA. Negative values mean the battery discharged. Put the command to measure after --; run fplinux-charge --help for the options.
Charger source classification
Section titled “Charger source classification”/sys/class/power_supply/sc2720-charger/usb_type marks the detected source in brackets: SDP for a standard downstream port, CDP for a charging downstream port and DCP for a dedicated charging port. Unknown means no input, incomplete detection or no single reported type. Reading it does not start detection or establish available power, permitted current or actual charging.
Charge helper command boundary
Section titled “Charge helper command boundary”fplinux-charge --counter PATH -- COMMAND selects a counter explicitly; --counter may appear once and -- is required. The helper preserves the command’s exit or signal result when the final measurement succeeds. If the final measurement fails, it prints no metrics and returns 125 for a successful command; otherwise it preserves the command’s failure or signal result.