Skip to content

Power, sleep and battery

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.

Which way to end the session Booted from a microSD system card? Files in RAM, such as /tmp, are lost in every case. No Release data cards Battery in the phone? Yes Battery-only power-off verified? No battery Unplug USB. Power is cut at once. Battery + verified power-off Unplug USB and charger, hold its power key 5 s. Battery, power-off not tested Follow the phone page's session-ending procedure. Yes Unplug USB and charger, hold its power key 5 s. No, any other case Shut down on USB power, then unplug USB.
Which way to end the session

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.

Use this sequence only when your phone page lists battery-only power-off as supported for the current profile.

  1. Unmount data cards as described above. With a microSD system card, skip this step; shutdown takes care of the system card.

  2. Unplug the USB cable and make sure no charger is connected. The phone refuses to power off while it detects charger power.

  3. 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.

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.

  1. 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.

  2. Write pending data and make the system root read-only:

    Phone
    sync
    mount -o remount,ro /
  3. Check that the root is now read-only. The line for / must show ro:

    Phone
    grep ' / ' /proc/mounts

    If the remount failed, stop the remaining programs that write to the card and repeat step 2. Keep the phone powered until it succeeds.

  4. Shut down and unplug the cable:

    Phone
    poweroff

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:

Phone
echo freeze > /sys/power/state

Wake 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.

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:

Phone
hwclock -u -w -f /dev/rtc0

On 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:

Phone
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo +60 > /sys/class/rtc/rtc0/wakealarm
echo freeze > /sys/power/state

An 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.

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):

Phone
cat /sys/class/power_supply/sc2720-charger/online

This 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.

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:

Phone
fplinux-charge -- sleep 60

When 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.

/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.

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.