Files
bananarchy/MANUAL.md
T

677 lines
100 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Bananarchy Linux — user, flashing, and customization manual
![Bananarchy Banner](artwork/banner-800x240.png)
This manual covers flashing, operating, and customizing **Bananarchy Linux** (`240x320` native edition) on **Qualcomm MSM8905 and MSM8909** Nokia feature phones. Current release: `a1108` (codename `dejavu`); see the [changelog](./CHANGELOG.md) for release notes.
- **Nokia 8110 4G (`nokia-argon`)**
- **Nokia 2720 Flip (`nokia-beatles`)**
- **Nokia 800 Tough (`nokia-tough` / `nokia-coconut`)**
- **Nokia 8000 4G (`nokia-sparkler`)** and **Nokia 6300 4G (`nokia-leo`)**
---
## 1. System overview and workspace contents
### 1.1 System images (`images/`)
- `images/bananarchy-nokia-argon.img`: partitioned MBR image (`256 MiB` `ext2` `pmOS_boot` + `ext4` `pmOS_root`) ready for EDL flashing to `userdata`, `fastboot flash userdata`, or raw `dd` to a microSD card.
- Additional device images (`bananarchy-nokia-beatles.img`, `bananarchy-nokia-tough.img`, `bananarchy-nokia-sparkler.img`) can be generated at any time via `./rebuild-image.sh <device> --mkinitfs`.
### 1.2 Bootloader and EDL programmer (`bootloader/`)
- `bootloader/lk2nd-msm8909.img`: secondary bootloader (`lk2nd`) providing Fastboot and `extlinux` boot discovery for MSM8905 and MSM8909 devices. `images/boot-lk2nd-nokia-beatles-display.img` is the source-built 2720 Flip port (see `bootloader/lk2nd/README.md`).
- `bootloader/loaders/`: signed Qualcomm Sahara/Firehose programmers (`05c6:9008`), one per target. The flasher picks the right one from `--device` / the positional target; run `./flash-edl.sh --list-loaders` to see each file's embedded attestation identity and mapping. Pass `--variant us` for a 2720 Flip US variant or `--loader PATH` to override the programmer entirely.
### 1.3 Core architecture highlights
1. **Pure X11 (`Xlibre` + `sxmo-de-dwm`) for `240x320` QVGA displays**:
- Uses a lightweight cross-compiled **Xlibre** server with `modesetting` KMS, partial-rectangle `ShadowFB` SPI updates, and zero Wayland overhead.
- **Patched `dwm`** provides a `240x320` vertical bottom-stack (`bstack`) layout, a 24px top status bar, a transparent `"Menu"` / `"Names"` desktop softkey bar, a native `ParentRelative` desktop datetime overlay (`Fira Code` 32pt `%H:%M` and 14pt `%a %d %b %Y` with 1px drop shadow, rendered directly by `dwm` with zero external Conky process overhead and automatic live timezone/wallpaper refresh), and `< 2 ms` handling of physical slider (`SW_LID`) and wake keys. The status bar clock is refreshed synchronously on unlock, whenever dmenu updates its input-method indicator, and every minute by a lightweight aligned job (the heavier status bar periodics stay at 300 s). Its status file is kept current even while the panel is blanked, so it cannot keep showing a pre-lock time after the panel wakes. Network state changes are handled by the NetworkManager dispatcher instead of a long-lived `nmcli device monitor`, so connectivity stays immediate without an idle poller.
2. **Preloaded resident DWM plugins (`< 2 ms` wakeup)**:
- Core phone applications (`dmenu`, `xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `passcode`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`, `sip`, `email`, `irc`, `tox`, `smallweb`, `webarchy`, `gps`, `privacy`, `engmenu`, `locker`) run as preloaded resident daemons (`dwm-plugin <name> --preload`) that sleep at 0% CPU and open instantaneously over FIFO/socket IPC.
- All UI elements — including the `dunst` notification daemon (`bananarchy-sync-dunst-theme`) — share the **NeoUI SDK (`libneoui.so` + `/usr/include/neoui.h`)** and a single **XRDB theming engine** (`~/.xthemes/*.xth` -> `~/.Xresources`) with 21 preinstalled color schemes, proportional font sizing (`theme.baseFontSize`), and live reload without restarting X11. NeoUI exposes both C++20 classes and a C-compatible FFI (`neoui_*`) for building custom native or scripted (`yabasic` via `~/Projects/neoui.yab`, `~/Projects/neoui_demo.yab`, and `~/Projects/bulls_cows.yab`, paired with **NeoNet** in `~/Projects/neonet.yab` and `~/Projects/neonet_demo.yab` for `libcurl` HTTP/HTTPS and TCP/TLS/UDP socket networking) `240x320` GUI applications — see [SDK.md](./SDK.md) for the complete API reference and examples.
3. **First-class terminal (`st`) and 6-mode `fcitx5-t9` keypad input**:
- `st` is patched with HarfBuzz OpenType ligature shaping (`Fira Code` default) and live `.Xresources` reload.
- `fcitx5-t9` provides 6 keypad input modes (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) in a fixed bottom candidate bar (`Y = 290, H = 30`).
4. **Mainline Linux 6.12 hardware drivers**:
- **QDSP6 / Q6Voice audio and Dual-SIM modem**: loudspeaker, boosted (+6 dB) earpiece, internal MEMS and headset microphones, `ModemManager` + `q6voiced` call audio routing, and direct Qualcomm QMI UIM Dual-SIM Dual Standby (DSDS), instant default SIM switching, Primary/Secondary GW (`4G/Data`) slot swapping, PIN/PUK management, and SIM phonebook access.
- **Rear 2MP camera and torch LED**: `msm8905-cam` V4L2 driver (`/dev/video0` `800x600` `RGB3` for GalaxyCore `GC2395` / `GC2385` / `GC2365`) and `leds-msm8905-torch` (`white:torch` + PM8909 clean poweroff).
5. **Preinstalled developer and utility stack**:
- `curl`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `nano`, `ed`, `less`, `rlwrap`, `mandoc`, `yabasic` (with the `neoui.yab` / `neonet.yab` FFI wrappers), `bantam` coding agent, `tcl` (runtime for `expect`), `frotz`, `ffmpeg`, `mpv`, `imv`, standalone `snake`, `tetris`, and `scoundrel` X11 games, the `gambatte` Game Boy / Game Boy Color emulator, and the **ReMEdy (`remedy` / `j2me`)** `240x320` J2ME (MIDP 2.0 / CLDC 1.1) emulator. No on-device compiler, Janet, Perl, Lua, or `sqlite3` CLI is shipped; native code is cross-compiled with `scripts/build-*.sh`. `curl`, `bc`, `ed`, `rlwrap`, `mandoc`, `nano`, `less`, and `frotz` are the pinned core tools.
---
## 2. Flashing instructions
### Method A: automated USB EDL flasher (recommended)
Run the automated EDL flasher from the repository root on your host machine:
```bash
sudo ./flash-edl.sh
```
*(To flash another target device image, pass its codename, e.g. `sudo ./flash-edl.sh nokia-sparkler`.)* The programmer is selected automatically: `8110.mbn` (8110 4G), `2720.mbn` (2720 Flip), `800t.mbn` (800 Tough), and `8k.mbn` for **both** 8000 4G and 6300 4G. The 2720 Flip US variant (`Nokia_bts_us`) uses `2720v.mbn`: pass `--variant us` (or `--loader ./bootloader/loaders/2720v.mbn`). Verify with `./flash-edl.sh --list-loaders`.
The script performs the following steps automatically:
1. Temporarily pauses host `ModemManager` so it does not interfere with `05c6:9008`.
2. Waits for the phone in Qualcomm EDL/Sahara mode. The flasher auto-detects
`05c6:9008` (QDLoader), `05c6:900e` (QHSUSB_BULK, common after a failed
boot) and `05c6:9006` (DLOAD); pass `--pid` to force one:
- **From Bananarchy Linux**: open the **Power** menu (`End / Power` key or `System menu -> Power`), select **Reboot to bootloader** (`sxmo_power.sh bootloader`) to enter the visible `lk2nd` Fastboot menu, then select **EDL** (or let `flash-edl.sh` automatically send `fastboot oem reboot-edl`). The low-bit reboot cookie now survives the stock boot chain and keeps the menu available.
- **Button combo**: power off the phone, hold **D-Pad up + D-Pad down**, and plug in the USB cable.
- **EDL cable**: hold the EDL cable button while plugging in USB.
- **From ADB or Fastboot**: the script automatically sends `adb reboot edl` or `fastboot oem reboot-edl` if detected.
- If the phone is stuck in Sahara with no fresh HELLO packet (e.g. a host
tool already consumed it), power-cycle it: hold **End/Power** for 15-20 s
(or disconnect/reconnect the battery), then retry. The flasher cannot
resume a half-open Sahara handshake.
3. Uploads the device-specific Firehose programmer from `bootloader/loaders/` via Sahara and connects to eMMC via Firehose.
4. Backs up `gpt.bin`, `fsc`, `fsg`, `modemst1`, `modemst2`, `persist`, and `boot` into `./backup/` if not already backed up.
5. Flashes `images/bananarchy-<device>.img` to `userdata`, clears the stock `system` superblock (first 64 sectors / 32 KiB), and reboots. This wipe is the default for every method; pass `--no-wipe-system` only if you deliberately want a dual-boot phone with KaiOS intact. **The default `--method lk2nd` writes the source-built `images/boot-lk2nd-nokia-beatles-display.img` into `boot`, and the standalone `images/boot-bananarchy-nokia-beatles.img` into `recovery` on the 2720 Flip (Argon-shaped hybrid).** That lk2nd image is built from upstream lk2nd plus `bootloader/lk2nd/nokia-beatles.patch`: it carries cmdline `lk2nd lk2nd.compatible=nokia,beatles`, keeps the upstream QCDT layout (both `0x14b` entries sharing one DTB), injects a compact `/lk2nd/nokia-beatles` node with the downstream GC9305 v2 panel init stream, and adds `/cpus` with `cpu@0`..`cpu@3` to every QCDT DTB. The 2720's MSM8905 is a partial-goods 2-core part; aboot `ASSERT FAILED at (platform/msm_shared/partial_goods.c:80)` and rebooted into Sahara memory-debug EDL because upstream lk2nd DTBs had no `/cpus` — that was the black-screen/no-fastboot crash. aboot hands off to lk2nd, which keeps aboot's 240x320 RGB565 panel init (or replays the downstream stream when cont-splash is off), then scans `userdata` for `extlinux.conf` and boots `vmlinuz` + `initramfs` with the explicit `fdt /qcom-msm8905-nokia-beatles.dtb`. Rebuild it with `scripts/build-lk2nd-beatles.sh`; see `bootloader/lk2nd/README.md`. The port paints the Bananarchy RGB565 boot splash instead of the near-black upstream splash; the branded screen confirms lk2nd owns the framebuffer. Live `oem display-init` proved the GC9305 v2 stream and frame flush, chain-loaded diagnostics now fall back to the QCDT panel stream, and `oem scan-dtb` captures the final post-update kernel DTB. The release image is display-enabled (`lk2nd.display=on`) so the branded splash and Fastboot menu are visible; the normal no-display image remains available for diagnostics. All QUP/clock polls are bounded, so a dead SPI bus reports a failure instead of hanging. If the phone never shows anything, run `lsusb`: `05c6:900e` means aboot crashed into EDL (Sahara MEMORY_DEBUG), not that lk2nd failed to display; the `/cpus` fix above addresses the confirmed ASSERT. Flash `images/boot-lk2nd-nokia-beatles-diagnostic.img` with `--lk2nd-image --verify --dump-diagnostics` (forced fastboot + runtime `oem display-init` probe), then `fastboot oem log && fastboot get_staged lk2nd.log`; if it returns to `900e`, re-read aboot's RLOG crash buffer (the untouched `bootloader/lk2nd-msm8909.img` lacks `/cpus` as well and crashes identically). See `bootloader/lk2nd/README.md`. If the KaiOS splash persists on a normal power-on, **hold Volume Up** to boot the mainline boot.img in `recovery`. `--method both` is the fallback that writes the standalone `images/boot-bananarchy-nokia-beatles.img` (appended beatles DTB, exact qcom IDs and 512 MiB `/memory` fallback) into both slots; `--method recovery` writes it only to `recovery`. Use `--boot-image PATH` to override the standalone image. Add `--verify` to read back every flashed `boot`/`recovery` partition and confirm the write really committed; a mismatch aborts before `userdata` is touched. Add `--dump-diagnostics` to save small `devinfo`/`aboot`/`tz`/`config` partitions into `backup/diag-*.img` for offline secure-boot analysis. The captured `diag-devinfo.img` proved this 2720 is locked (`is_unlocked=0`, `is_tampered=0`) while `diag-aboot.img` contains `Nokia_beatles ROOT CA0` and `Device is unlocked! Skipping verification...`; aboot therefore rejects every unsigned boot.img. The flasher defaults to unlocking `devinfo` on `nokia-beatles` before writing lk2nd, saves the original as `backup/devinfo-locked-<device>.img`, and accepts `--unlock-bootloader` / `--no-unlock-bootloader`. `scripts/make-unlocked-devinfo.py` can produce the patched image offline. Correction: `target_get_vb_version()` returns `VB_L` on this GPT (no `keymaster`), so aboot reads eMMC `devinfo`, not RPMB. The captured `diag-devinfo.img` after flashing shows `is_unlocked=1`; the eMMC unlock works and **no `fastboot oem unlock-go` step is needed**. `--only-unlock`, `enable_oem_unlock()` and `scripts/make-oem-unlock-config.py` are optional EDL-only prerequisites kept for completeness. EDL is the only required interface. After any DTB change run `python3 scripts/repack-beatles-bootimg.py` and `python3 scripts/sync-beatles-bootfs.py --debug-cmdline`; after any lk2nd change run `./scripts/build-lk2nd-beatles.sh`; never write an Android boot.img directly at raw offset 1 MiB. To diagnose a persistent `05c6:900e` without stock fastboot, power-cycle into EDL and run `python3 scripts/dump-edl-crash.py --out backup/crash-run`; it reads the Sahara memory-debug table and dumps aboot/TZ crash regions. The partition being overwritten is always backed up as `<partition>-<device>.img` (e.g. `boot-nokia-beatles.img`), so stale backups from another device are never reused.
---
### Method B: Fastboot flashing (once `lk2nd` is installed)
1. Enter the `lk2nd` Fastboot menu either by selecting **Reboot to bootloader** from the **Power** menu (`sxmo_power.sh bootloader`) or by holding **D-Pad down** while powering on the phone.
2. Flash the system image to `userdata`:
```bash
fastboot flash userdata ./images/bananarchy-nokia-argon.img
fastboot erase system
fastboot reboot
```
---
### Method C: booting from a microSD card
`lk2nd` automatically checks the microSD card for a `pmOS_boot` partition before internal eMMC:
```bash
sudo dd if=./images/bananarchy-nokia-argon.img of=/dev/sdX bs=4M status=progress conv=fsync
```
---
## 3. Keypad controls and native applications
### 3.1 Global keypad controls (`240x320`)
| Physical key | Linux keysym / event | Action |
| :--- | :--- | :--- |
| **Left softkey (`Menu`)** | `XF86KbdLcdMenu1` (`KEY_MENU`) | Open **System menu**, close open menu, or wake screen (if locked, opens **Passcode Locker** `xlocker`) |
| **Right softkey (`Names` / `Back`)** | `XF86KbdLcdMenu2` / `BackSpace` (`KEY_BACK`) | On empty desktop: open **Contacts (`Names`)**; inside apps: open **App context menu** (or close menu if open); in T9 preedit: `BackSpace` |
| **Both softkeys together** | `KEY_MENU` + `KEY_BACK` | Toggle **XDrawer** (`xdrawer`) global phone controls overlay from anywhere (disabled while passcode-locked) |
| **`*` + `#` together** | `KEY_NUMERIC_STAR` + `KEY_NUMERIC_POUND` | Capture a `240x320` screenshot (`scrot` via `bananarchy-screenshot`) to `~/Pictures/screenshot-YYYYMMDD-HHMMSS.png` |
| **Digits `0`–`9`, `*`, `#` (on idle desktop)** | `0`–`9`, `asterisk`, `numbersign` | Open **Dialer** (`xdialer`) and immediately insert the pressed digit, `*`, or `#` |
| **Call (green)** | `XF86PickupPhone` / `XF86Phone` (`KEY_SEND`) | Answer incoming call when ringing; on empty desktop: open **Call Log** (`xcalllog`); in menus: confirm (`Return`); in apps: **2x** focus next window, **3x** cycle tiling layout |
| **End / Power (red)** | `XF86PowerOff` | Wake or blank screen while passcode-locked, close open plugin/menu, or: **1x** open **Power menu**, **2x** lock phone with passcode (`xlocker`), **3x** (or hold `400ms`) launch a new terminal |
| **D-Pad up / down** | `Up` / `Down` | Navigate menus and apps; in `st`: `Shift+Up`/`Shift+Down` (or `ScrlUp`/`ScrlDn` in `Ctl` mode) scrolls terminal history; in T9 preedit: toggle letter case (`a` <-> `A`) or jump `+4` / `-4` candidates |
| **D-Pad left / right** | `Left` / `Right` | On empty desktop: switch workspace tags (`-1` / `+1`); in T9 preedit: step back 1 candidate (`Left`) or commit candidate (`Right`); in idle `Ctl` mode: `Home` / `End` |
| **Center OK** | `Return` (`KEY_OK`) | Confirm / Enter, or commit active T9 preedit candidate immediately |
| **Slider close / open** | `SW_LID` (`lid:on` / `lid:off`) | **Close**: close open menu, turn off keypad backlight, and lock phone with passcode (`xlocker`); **Open**: restore screen and keypad backlight and show passcode lock screen |
> **Screen blanking, idle blanking, deep standby, passcode locking (`xlocker`), waking, and brightness persistence**:
> While unlocked (and with the lid open), the display blanks automatically after the configured **Screen blank** timeout — **5 minutes by default** — via `dwm`'s own evdev input timer and `bananarchy-idle-blank.sh`. Change it in **Config -> Screen blank** (`Off`, 30 s, 1/5/10/30 min), which writes `~/.config/sxmo/idle_blank_timeout`; `bananarchy-idle-timeout.sh get|label|set <seconds>` does the same from the shell, and `SXMO_UNLOCK_IDLE_TIME` or `~/.cache/sxmo/sxmo.noidle` still override/disable it. Closing the slider/lid or locking from the **Power** menu blanks the panel **immediately** (both `Lock` and `Lock (Screen off)` now use `xlocker screenoff`), and an incoming call or SMS/notification turns it back on **immediately** via `bananarchy-screen-wake.sh`, which also resets `dwm`'s idle timer so it cannot blank again right away. Any keypad, lid or power key also restores the display; if it arrives before the idle-lock delay elapses, the desktop stays unlocked. Blanking now arms the screenlock daemon: `bananarchy-idle-blank.sh` calls `bananarchy-idle-lock.sh arm`, which starts the trusted `sxmo_state.sh set screenoff` transition (`xlocker screenoff` -> `LOCK_BLANK` on `locker.so`) after **30 seconds** of dark panel by default. Set `~/.config/sxmo/idle_lock_delay` with `bananarchy-idle-lock.sh set 0` to lock immediately on blank, any other number of seconds to change the grace period, or `set off` to keep the old blank-without-passcode behaviour. `bananarchy-idle-lock.sh get|label|cancel` reports and cancels the pending lock; `bananarchy-screen-wake.sh`, `bananarchy-idle-blank.sh on` and `sxmo_hook_unlock.sh` cancel it on every wake, and the transition only fires while the panel is still dark. X11 screensaver timeouts stay at `0 0 0`; DPMS is driven by the backlight state. Optional **deep standby** is currently **unavailable**: the shipped kernel keeps the pmaports module ABI and has no sleep states in `/sys/power/state`. It stays disabled via `/etc/bananarchy-no-deep-standby`. Even a full custom kernel module tree would not help here: this firmware has no PSCI `SYSTEM_SUSPEND`, so only s2idle (`freeze`) would be possible, without DDR self-refresh, and the saving would be under 1 mA (see `BATTERY-OPTIMIZATION-ANALYSIS.md`). Active calls, SSH sessions and VPN/tether connections would block suspension. Locking the phone (`Power -> Lock`, `Power -> Lock (Screen off)`, `2x End / Power`, or closing the physical slider) activates the fullscreen `240x320` **Passcode Locker (`xlocker` / `locker.so`)**, which verifies your numeric system password (`147147` by default, checked against `/etc/shadow` via `/usr/bin/bananarchy-verify-passcode`). While locked, there is no keypad, softkey, slider, or power-button bypass (`dmenu`, `xdrawer`, terminal spawning, and desktop shortcuts are blocked, and only incoming calls can temporarily overlay `xcallscreen`). Screen and keypad brightness levels configured in **XDrawer** or **Config -> Brightness** are persisted in `~/.config/sxmo/brightness` and `/tmp/sxmo_saved_brightness` and restored on every wake.
> **Runtime power policy (`/etc/bananarchy-power-policy.conf`)**:
> `WIFI_LISTEN_INTERVAL` (1-10, default 5) sets the `wcn36xx` beacon listen interval via `/etc/modprobe.d/10-bananarchy-power.conf`; higher values cut idle Wi-Fi RX wakeups but delay inbound packets, and the change applies at module load (reboot or reload `wcn36xx`). `MODEM_DRX_MODE` (default `0`) applies the Qualcomm `AT$QCDRX` DRX mode at boot and on every wake; `6-9` are progressively longer paging cycles that lower modem idle current at the cost of call/SMS setup latency, while `0` is the firmware default. The standard `AT+CPSMS` / `AT+CEDRXS` PSM/eDRX commands are not supported by this modem firmware. `DSDS_SECONDARY_MODE=eco` (default `active`) deactivates the secondary SIM's GW provisioning session after `DSDS_PARK_DELAY` seconds (default 300) of a dark panel and restores it on wake; **SIM2 is unreachable while parked**. This uses QMI provisioning sessions, not SIM power-off, so a PIN-locked SIM stays locked. Edit the file as root and run `doas /usr/bin/bananarchy-power-policy.sh apply`, or reboot; `doas /usr/bin/bananarchy-power-policy.sh status` reports the effective values. DDR self-refresh / `mem` suspend is unavailable on this firmware (no PSCI `SYSTEM_SUSPEND`); see `BATTERY-OPTIMIZATION-ANALYSIS.md` §15.
#### 3.1.1 Window tiling modes and switching combos
By default, `dwm` uses the **vertical bottom-stack (`bstack`, `TTT`)** layout so multiple `st` terminals stack **vertically (one under another)** to preserve full line width on the `240x320` portrait screen.
You can switch layouts, focus, and workspaces using the **Window management menu (`Windows`)** (accessible via `Left softkey -> Windows`, or by pressing **Right softkey** inside non-terminal applications, or selecting `Windows` from the `st` terminal context menu), physical keypad multi-presses, or an external keyboard (`Mod4` / `Super`):
- **Window management menu (`WM Menu`)**: provides instant C-level window actions (`Move to WS 1`..`4`, `Shift stack`, `Swap stack`, `Toggle Layout`, `Kill window`, and `Go to WS 1`..`4`), plus `Close Terminal` in the `st` context menu.
- **Triple-press Call (green) (`3x Call`)**: cycle the active layout (`TTT` -> `[]=` -> `[D]` -> `[M]` -> `TTT`).
- **Double-press Call (green) (`2x Call`)**: move focus to the next open window (`Super+j`).
- **Triple-press End / Power (red) (`3x End`)**: launch a new `st` terminal in the active workspace.
- **External keyboard shortcuts (`Mod4`)**:
- `Mod4+space`: cycle layout (`TTT` -> `[]=` -> `[D]` -> `[M]`).
- `Mod4+Shift+slash`: vertical stack layout (`bstack`, `TTT`).
- `Mod4+slash`: horizontal tile layout (`tile`, `[]=`).
- `Mod4+m`: fullscreen monocle layout (`monocle`, `[M]`).
- `Mod4+Up` / `Mod4+Down` (or `Mod4+k` / `Mod4+j`): move focus between tiled windows.
- `Mod4+Shift+k` / `Mod4+Shift+j`: move the focused window up or down in the stack.
- `Mod4+1`..`4`: switch to workspace tag `1`..`4`.
- `Mod4+Shift+q`: close the focused window.
#### 3.1.2 Preloaded native DWM applications
All twenty-five phone applications are compiled as shared-object plugins (`/usr/lib/dwm/plugins/*.so`), preloaded at `dwm` startup, and awakened over `/tmp/dwm_plugin_<name>.fifo` in `< 2 ms`:
1. **System and context menus (`dmenu.so` / `dmenu` / `xdmenu`)**:
- **Open / close**: press **Left softkey (`Menu`)** for the **System menu** or **Right softkey (`Back`)** inside an application for its **Context menu**; press the same softkey or `Escape` to close.
- **Built-in submenus and instant toggles**: renders `sys`, `applications`, `scripts`, `modem`, `config`, `sdcard`, `power` (including **Lock**, **Lock (Screen off)**, **Logout**, **Reboot**, **Reboot to bootloader**, and **Poweroff**; use the lk2nd Fastboot menu for **EDL**), `audio` (with linear volume steps and **Output: Speaker**, **Output: Earpiece**, and **Output: Headphones** routing), `notifications`, `wm`, `timezone`, `games`, `st`, and `nano` menus in place in `< 0.5 ms` without spawning external processes.
- **Script compatibility**: any script piping items into `/usr/bin/dmenu` or `sxmo_dmenu.sh` communicates with the resident daemon over `/tmp/dwm_plugin_dmenu.sock`.
2. **Global phone controls (`xdrawer.so` / `xdrawer`)**:
- **Open / close**: press **both softkeys simultaneously** (`KEY_MENU` + `KEY_BACK`) from anywhere, or select **XDrawer** from the System menu.
- **Controls**: use `Up`/`Down` (or `1`–`9`/`0`) to select linear (`1%`–`100%`) **Speaker**, **Earpiece**, **Ring Vol**, **Ringer** (`Ring+Vib` / `Vibrate` / `Silent` / `DND`), **Vibration** (`Light` / `Medium` / `Strong` with instant tactile feedback), **Flashlight**, **Sound**, **Microphone**, **Screen**, or **Keypad**; use `Left`/`Right` or `Return` to adjust or toggle.
3. **Phone dialer (`dialer.so` / `xdialer`)**:
- **Open**: press any **`0`–`9`, `*`, or `#` key** on the empty desktop, or open **Dialer** from the System menu or Call Log.
- **Dialing and T9 search**: typing digits filters saved contacts and recent numbers by phone number and T9 name in real time. Hold **`0`** (`>= 420 ms`) or press `Right` / **Left softkey (`+Sign`)** to insert `+`.
- **USSD codes and `*#06#` Dual-SIM IMEI display**:
- Typing **`*#06#`** immediately opens the **Device IMEI (`*#06#`)** dialog showing `IMEI 1`, `IMEI 2`, and `IMEI SV`.
- Typing any USSD code (`*...#` or `#...#`, such as `*100#`) switches the center softkey to **`SEND`**. Pressing **Call (green)** or **Center `OK`** runs the USSD session inside an interactive in-dialer modal with scrollable carrier output and multi-step reply support (prompting for **SIM 1** or **SIM 2** first when two SIM cards are active in DSDS).
4. **Call history and anti-spam blocklist (`calllog.so` / `xcalllog`)**:
- **Open**: press **Call (green)** on the empty desktop, or select **Call Log** from the System menu or Dialer.
- **Controls**: `Left`/`Right` switches between **`All`**, **`Miss`**, **`In`**, **`Out`**, and **`Spam`** tabs; `Up`/`Down` scrolls; **Call (green)** or **Center `OK`** dials the selected entry.
- **Anti-spam blocklist (`~/.config/sxmo/block.tsv`)**: press **Left softkey (`Options`)** to **Block Number (Spam)** or **Unblock Number**, open **Blocklist (N)** to manage blocked numbers, **Block a Number...** (supports exact numbers, 9-digit suffix matching, or prefix wildcards ending with `*`), or **Clear Spam Log** (`~/.local/share/sxmo/block/modemlog.tsv`). Incoming calls from blocked numbers are automatically hung up and recorded in the `Spam` tab without triggering missed-call notifications.
5. **Incoming and active call screen (`callscreen.so` / `xcallscreen`)**:
- **Automatic activation and Dual-SIM selection**: wakes the screen and opens automatically on incoming and outgoing calls across both SIM slots (displaying a `[SIM 1]` or `[SIM 2]` badge in the header when Dual-SIM Dual Standby is active). When initiating an outgoing call with two SIMs inserted, `xcallscreen` prompts to choose **`[1] SIM 1`** or **`[2] SIM 2`** (`1`/`2` keys or `Up`/`Down` + `Call`/`Enter`). Pressing **Call (green)** during an active call reopens `xcallscreen` from anywhere.
- **Incoming call actions**: press **Call (green)**, **Left softkey (`Accept`)**, **`1`**, or **Center `OK`** to answer; press **`*`** or **`0`** to silence the ringer; press **End (red)**, **Right softkey (`Reject`)**, or **`#`** to decline.
- **In-call controls and recording**:
- **`[1]` / `*` — microphone mute**: toggles hardware QDSP6 and PipeWire microphone mute (`ON` / `MUTED`).
- **`[2]` / `#` — call recording**: starts or stops recording call audio (`8 kHz` mono S16_LE WAV via `MultiMedia2` `hw:0,1` with automatic peak normalization) to `~/Recordings/rec_HHMMSS_<caller>.wav`, displaying a live `REC MM:SS` timer while recording and a persistent green `SAVED MM:SS` badge once saved.
- **`[3]` — audio route**: cycles between **`BLUETOOTH`** (when a Bluetooth headset is connected, routing call audio over QDSP6 `INT_BT_SCO_RX` / `INT_BT_SCO_TX`), **`SPEAKER`**, and **`EARPIECE`** (or **`HEADPHONES`** when wired headphones are plugged in).
- **`Left` / `Right` — call volume**: adjusts in-call volume in `5%` steps.
- **`[0]` / Left softkey (`DTMF`)**: toggles DTMF tone keypad mode.
- **End (red)** or **Right softkey (`Hangup`)**: hangs up the call.
6. **Contacts phonebook (`contacts.so` / `xcontacts`)**:
- **Open**: press the **Right softkey (`Names`)** on the empty desktop, or select **Contacts** from the System menu.
- **Search and actions**: type `0`–`9` for live T9/number filtering; press **Call (green)** to dial immediately; press **Center `OK`** for the contact details card (**Call Contact**, **Send SMS**, **Read Messages**, **Open in Dialer**, **Copy to SIM**, **Edit Contact**, **Delete Contact**); or press **Left softkey (`Options`)** for phonebook-wide actions.
- **Direct Dual-SIM QMI phonebook import and export**: select **Import from SIM** or **Export to SIM** in the **Options** menu (or **Copy to SIM** on an individual contact) to read or write `EF_ADN` SIM phonebook records directly over Qualcomm QMI UIM (`qrtr://0`) on either **SIM 1** or **SIM 2** — even on the inactive SIM slot.
- **Built-in contact editor**: create or edit contacts directly on the keypad (`#` cycles input mode, `*` inserts space, hold `0` or press `Right` for `+`, or pick from recent unknown callers).
7. **SMS manager, composer, and spam filter (`sms.so` / `xsms`)**:
- **Open**: select **Texts** from the System menu, or choose **Send SMS** / **Read Messages** from Contacts.
- **Conversations, inbox, and spam folder**: browse SMS threads and drafts with contact name resolution, unread indicators, and message bubbles (`Recv` and `Sent`). Press `Left`/`Right` in the thread list (or use **Left softkey (`Options`)**) to switch between **`Inbox`** (`~/.local/share/sxmo/modem`) and the **`Spam`** folder (`~/.local/share/sxmo/block`).
- **Full-length messages**: open a thread with **Center `OK`** to read the complete text of long, concatenated, or Unicode (`UCS-2`) messages. Message bodies are drawn line by line and clipped to the bubble, so a multipart message is never cut off at its first line. `Up`/`Down` scrolls inside the selected message (a scrollbar on the right edge shows the position) and steps to the previous/next message once the top or bottom is reached; **Right softkey (`Back`)** returns to the thread list. The QMI WMS daemon reassembles 8-bit and 16-bit concatenated SMS across GSM-7 and UCS-2 (including split surrogate pairs) before writing `sms.txt`, and the `[SIM n]` tag in its log header is stripped when parsing.
- **Anti-spam blocking**: press **Left softkey (`Options`)** on any thread or conversation to **Block Number (Spam)** (which adds the sender to `~/.config/sxmo/block.tsv` and moves their thread into the `Spam` folder), **Unblock & Restore** (which unblocks the sender and restores their thread to `Inbox`), **Manage Blocklist (N)**, or **Block a Number...**. Incoming texts from blocked numbers are silently routed into `~/.local/share/sxmo/block` without ringing or vibrating.
- **Multi-tap composer**: pick a recipient from Contacts/Recents or type a number (hold `0` for `+`), compose messages with multi-tap keypad entry (`#` cycles input mode), monitor live character/segment counts, save drafts automatically, and send via **Call (green)**, **Center `OK`**, or **Left softkey** (prompting to select **SIM 1** or **SIM 2** when two SIM cards are active in DSDS). The counter is encoding-aware: GSM-7 text shows `units/160` (or `units/306x2` for two concatenated parts at 153 septets each), while any character outside the GSM 7-bit alphabet (for example Ukrainian `є`, `і`, `ї`, `ґ`, or a supplementary-plane character) switches the whole message to UCS-2 and shows `units/70` (or `units/134x2` at 67 UTF-16 units per part). Long composed text is drawn line by line and scrolled so the end of the draft stays visible.
8. **File manager (`files.so` / `xfiles`)**:
- **Open**: select **Files** from the System menu or press `Mod4+d`.
- **Controls and viewers**: navigate directories with `Up`/`Down`/`Left`/`Right`/`Return`, filter with `0`–`9`, toggle dotfiles with `*`, and cycle sort order (**Name** / **Date** / **Size**) with `#`.
- **Integrated GUI text editor (`Edit in Text Editor`)**: available as an action in the **Left softkey (`Actions`)** menu for **any non-directory file** (as well as via **Left softkey (`Edit`)** from the built-in text viewer, or automatically after **New File**):
- **Navigation**: `Up`/`Down`/`Left`/`Right` moves the cursor across lines and UTF-8 characters with automatic vertical and horizontal viewport scrolling and line numbers (`Ln:Col`).
- **Multi-tap keypad text entry**: type with `0`–`9` and `*` (with a live bottom candidate bar), press `#` to cycle input modes (`[abc]` -> `[Abc]` -> `[ABC]` -> `[123]` -> `[Sym]`), press **Center `OK` (`Return`)** to split the line / insert a newline, and press **Right softkey (`Del`)** or `BackSpace` to delete the character before the cursor (or join with the previous line at column `0`).
- **Editor menu (`Left softkey`)**: opens the editor menu with **Save File** (press **Left softkey** twice to save immediately), **Save & Close**, **Insert New Line**, **Insert Space**, **Duplicate Line**, **Delete Line**, and **Close Without Saving**.
- **Yabasic (`.yab`) script execution**: pressing `Return` on any `.yab` file (or selecting **Run in Yabasic (Terminal)** from the **Left softkey (`Actions`)** menu) launches `yabasic` inside `st` in the file's directory and waits for `Enter` after completion so output can be inspected.
- **J2ME (`.jar` / `.jad`) MIDlet launching**: pressing `Return` on any `.jar` or `.jad` file (or selecting **Run in ReMEdy (J2ME)** from the **Left softkey (`Actions`)** menu) opens it directly in the **ReMEdy (`remedy`)** full-screen `240x320` J2ME emulator; `.jad` files also include a **View JAD Descriptor** action in the **Actions** menu.
- **Game Boy / Game Boy Color ROM launching**: pressing `Return` on any `.gb` or `.gbc` file (or selecting **Play in Game Boy Emulator** from the **Left softkey (`Actions`)** menu) opens it directly in the **Gambatte (`gambatte`)** emulator.
- **Image preview and wallpaper installation**: pressing `Return` on any image file (`.jpg`, `.png`, `.bmp`, `.gif`, `.webp`, `.ppm`, `.tif`, `.ico`, `.svg`) opens the built-in image viewer (`*` toggles full-screen preview; **Left softkey (`Set Wall`)** installs the image into `~/Pictures/Wallpapers/`, applies it via `feh`, and refreshes the desktop overlay). You can also select **Preview Image** or **Set as Wallpaper** directly from the **Left softkey (`Actions`)** menu.
- **Monophonic ringtone viewer (`.nrt`, `.rtttl`, `.rtx`, `.emy`, `.imy`), audio playback, and ringtone/notification installation**: pressing `Return` on any Nokia RTTTL (`.nrt`, `.rtttl`, `.rtx`), Ericsson eMelody (`.emy`), or IrDA iMelody (`.imy`) file opens the built-in **Ringtone Viewer** (`RingtoneView`), displaying the melody title, format tag, BPM, note count, duration, graphical piano-roll pitch contour, and scrollable note sequence (`Up`/`Down`), with instant playback preview (`*` or `Center OK`), `Left`/`Right` to step through ringtones in the current folder, **Left softkey (`Set Ring`)** to set as the active call ringtone, **`#`** to set as the active notification/SMS sound, and `1` to edit the melody text. Pressing `Return` on standard audio or tracker module files opens **Music (`xmusic`)**. From the **Left softkey (`Actions`)** menu on any monophonic melody, audio, or tracker file, select **Preview Ringtone**, **Set as Ringtone**, **Set as Notif / SMS Sound**, **Open in Ringtones App**, or **Play in Music Player**.
- **MicroSD card (`/media/sdcard`) integration**: when a microSD card (`/dev/mmcblk1`) is inserted, `udev` and `/usr/bin/sxmo_sdcard.sh` automatically mount it at `/media/sdcard` (keeping `7864900.sdhci` in `runtime_status = suspended` when idle and unbinding only during `--force-unmount` duress mode). From the **Left softkey (`Actions`)** menu inside `xfiles` (or **System menu -> SD Card**), select **Open SD Card (/media/sdcard)** to jump straight to the card (mounting it on demand if needed) or **Mount / Unmount SD Card** to safely flush and unmount the card before removal.
- **Bluetooth file transfer (`Send via Bluetooth`)**: select **Send via Bluetooth** from the **Left softkey (`Actions`)** menu on any file to choose a paired or nearby Bluetooth device (`*` rescans) and transmit the file over Bluetooth OBEX Object Push (`/usr/bin/bananarchy-bt-obex`).
- **File management actions**: the **Left softkey (`Actions`)** menu also provides **Edit in Text Editor**, **View Text**, **Edit in nano**, **New Folder**, **New File**, **Rename**, **Copy**, **Cut / Move**, **Paste Here**, **Properties**, **Open Terminal Here**, and **Delete**.
9. **Camera (`camera.so` / `xcamera`)**:
- **Open**: select **Camera** from the System menu or run `xcamera`.
- **Viewfinder and gallery**: streams live `800x600` frames from `/dev/video0` (`GC2395` / `GC2385` / `GC2365`) into a `240x180` 4:3 viewfinder. Press **Center `OK`**, **`5`**, or **Call (green)** to capture a JPEG to `~/Pictures/photo-YYYYMMDD-HHMMSS.jpg`; `*` or `1` toggles **Auto-Flash**; `0` or `2` toggles continuous **Torch**; `Up`/`Down` adjusts **Digital Zoom** (`1.0x` / `2.0x` / `4.0x`); `#` or `3` toggles the **3-second Self-Timer**; **Left softkey (`Gallery`)** opens the built-in photo gallery.
10. **Theme manager (`themes.so` / `xthemes`)**:
- **Open**: select **Themes** from the System, Apps, or Config menu, or run `xthemes`.
- **Live theme switching and customizer**: browse 21 preinstalled `.xth` schemes (`~/.xthemes/*.xth`) with live color swatches and press **Center `OK`** or **Call (green)** to apply across `dwm`, `dmenu`, `st`, `dunst` (`bananarchy-sync-dunst-theme`), and all plugins with zero restart. Press **`*`** or **Left softkey** to customize individual colors and font sizes, save a custom theme (`#`), or edit the `.xth` file in Nano.
11. **Modem, Dual-SIM, and PIN/PUK manager (`modem.so` / `xmodem`)**:
- **Open**: select **Modem** from the System menu, or run `xmodem`. Also opens automatically when a SIM card requires PIN or PUK unlock.
- **Four control tabs (`Left`/`Right` or `1`–`4`)**:
- **`1:SIMs`**: inspects both physical SIM slots via QMI UIM (`PRESENT`/`EMPTY`, `[PRI 4G / DEFAULT]`, `[PRI 4G / DSDS]`, `[SEC 2G / DEFAULT]`, `[SEC 2G / DSDS]`, `READY`/`PIN-LOCK`/`PUK-LOCK`, remaining retries, operator, RAT, and phone number). Press `Return` on a slot (or use the bottom quick-action rows) to **Set as Default SIM (Calls/SMS)** (instant switch without dropping network registration), **Make Primary GW (4G/Data Swap)** (`msm-modem-uim-selection switch <slot> --swap-gw` to move 4G/LTE/3G + Mobile Data to that slot and 2G DSDS standby to the other), **Unlock SIM PIN**, **Unblock SIM with PUK**, **Enable / Disable PIN Lock**, or **Change SIM PIN** (with automatic `ModemManager` reprobe after unlock).
- **`2:Radio`**: shows signal bar, registration status, access technology (`LTE`/`UMTS`/`GSM`), operator, both IMEIs, and phone number, with actions to switch **Network Mode** (`4G/3G/2G`, `3G/2G`, `4G Only`, `3G Only`, `2G Only`), **Send USSD Code**, toggle **Modem Power**, or **Restart ModemManager**.
- **`3:AT`**: interactive AT command console with presets (`AT`, `ATI`, `AT+CPIN?`, `AT+CSQ`, `AT+COPS?`, etc.) and custom keypad entry.
- **`4:Log`**: scrollable history of calls, SMS events, and USSD responses.
12. **Networks and Bluetooth manager (`networks.so` / `xnetworks` / `xbluetooth`)**:
- **Open**: select **Networks** or **Bluetooth** from the System menu, or run `xnetworks` / `xbluetooth`.
- **Three connectivity tabs (`Left`/`Right` or `1`–`3`)**:
- **`1:Wi-Fi`**: toggle Wi-Fi radio, rescan (`*`), toggle **Wi-Fi Hotspot**, and connect to WPA2/open networks with a multi-tap password dialog (`*` toggles password visibility).
- **`2:Cell/APN`**: toggle **Mobile Data** (configuring the QMI `bam-dmux` `wwan0` static IPv4 bearer, default route, and DNS automatically), inspect `wwan0` IPv4 status, edit **APN Configuration**, and toggle **USB Tethering**.
- **`3:Bluetooth`**: toggle **Bluetooth Power** (showing a live `ON (N Active)` badge and starting `/usr/bin/bananarchy-bt-obex`), toggle **Discoverable** (`ON (Visible)` vs `OFF (Hidden)`, persisted in `~/.config/sxmo/bt_discoverable`), edit the **Bluetooth Device Name** (`Name: <Alias> [Edit]`, persisted in `~/.config/sxmo/bt_name` and applied via `bluetoothctl system-alias` independently of the system hostname), monitor the live **OBEX File Receiver** widget (`#` opens `~/Downloads/` in `xfiles`), scan nearby devices (`*` or `Scan`, 15-second discovery scan), and manage paired/discovered devices. The scan keeps the `bluetoothctl scan on` output and parses its `[NEW] Device <MAC> <Name>` / `[CHG] Device ... Name:` lines, because BlueZ stops client-scoped discovery when `bluetoothctl` exits and can drop unpaired devices before a separate `bluetoothctl devices` query runs; the controller is also powered on automatically if `bluetoothctl show` reports `Powered: no`. Active connections are pinned to the top of the device list with a green border and live profile/battery badges (`[ACTIVE: A2DP]`, `[ACTIVE: HSP/HFP]`, `[ACTIVE: HID Gamepad]`, `[ACTIVE: HID Keyboard]`, `[ACTIVE: HID Mouse]`), and the device actions menu (`Center OK`) provides **Connect Device**, **Disconnect Device**, **Pair & Trust Device**, **Switch Audio (A2DP / HSP-HFP)**, and **Forget / Remove Device**. Supports Bluetooth **A2DP** (`sbc_xq`, `aac`, `ldac`, `aptx`, `aptx_hd`) and **HSP/HFP** (`mSBC` / `CVSD`) audio (routable via `xdrawer`, `dmenu Audio`, and `sxmo_audio.sh`), **HID keyboards** (automatically switching `fcitx5-t9` and NeoUI/plugin inputs to `[KBD]` direct QWERTY mode so `0-9`, `*`, `#`, `Shift+0-9`, and letters bypass T9 multi-tap and preedit popups), **HID mice** (automatically showing the X11 mouse cursor whenever a mouse is connected and hiding it when disconnected), and **HID gamepads** (automatically bridged to the phone's D-Pad, softkeys, and action keys via `/dev/uinput`).
13. **Ringtones, notification/SMS sounds, and ringer manager (`ringtones.so` / `xringtones`)**:
- **Open**: select **Ringtones** from the System, Config, or Audio menu, select **Notification Sound** from the **Notifications (`Notifs`)** menu, or run `xringtones [--notif] [file]`.
- **Supported formats**: standard audio (`.wav`, `.ogg`, `.mp3`, `.flac`, `.opus`, `.m4a`, `.aac`), chiptune tracker modules (`.mod`, `.xm`, `.it`, `.s3m`, etc.), and classic monophonic mobile ringtones — **Nokia RTTTL** (`.nrt`, `.rtttl`, `.rtx`), **Ericsson eMelody** (`.emy`), and **IrDA iMelody** (`.imy`) — synthesized via `monotone.h` / `/usr/bin/bananarchy-melody` (`~/Ringtones/`, `~/Music/`, `/usr/share/sxmo/ringtones/`, `/usr/share/sxmo/music/`).
- **Three tabs (`1:Ringtone`, `2:Notif/SMS`, `3:Settings` — switch with `1`–`3` or `Left`/`Right` in Tabs 1 and 2)**:
- **`1:Ringtone`**: browse and preview call ringtones (`*` or **Left softkey (`Play [*]` / `Stop`)**), press `Return` to set the active **Call Ringtone** (`~/.config/sxmo/ringtone`), or press `#` to quick-assign the highlighted tone as the **Notification / SMS Sound**.
- **`2:Notif/SMS`**: browse and single-shot preview notification/SMS alert tones (including `None (Mute Sound)` for vibration-only notifications) and press `Return` to set the active **Notification / SMS Sound** (`~/.config/sxmo/notif_sound` and `SXMO_TEXTSOUND` in `~/.config/sxmo/ringsettings`), wired directly into the system notification manager (`sxmo_notifs.sh`, `sxmo_hook_notification.sh`, `sxmo_hook_sms.sh`, `xirc`, and `xtox`).
- **`3:Settings`**: configure **Ringer Mode** (`Ring + Vibrate`, `Ring Only`, `Vibrate Only`, `Silent`), **Notif / SMS Sound** (`Left`/`Right` cycles tones, `*` previews, `Return` opens Tab 2), **Call Ringtone** (`Left`/`Right` cycles tones, `*` previews, `Return` opens Tab 1), **Ring & Alert Volume** (`0%`–`100%`, also adjustable in **XDrawer**), **Call Ring Duration**, **Call Ring Loop Count**, and 3-level hardware **Vibrate Strength** (`Level 1 (Light)` pulsed `1600 mV`, `Level 2 (Medium)` pulsed `2100 mV`, `Level 3 (Strong)` continuous `3100 mV`, `Return` tests vibration).
14. **Desktop wallpaper manager (`wallpapers.so` / `xwallpapers` / `xbackground`)**:
- **Open**: select **Wallpapers** from the System, Config, or Apps menu, or run `xwallpapers`.
- **Controls**: browse system and user wallpapers with a live portrait thumbnail, cycle scaling mode (`Fill`, `Scale`, `Fit`, `Center`, `Tile`) with `Left`/`Right` or `#`, toggle full-screen preview with `*`, and press `Return` to apply the wallpaper and immediately refresh the desktop overlay.
15. **Music and tracker module player (`music.so` / `xmusic` / `xplayer`)**:
- **Open**: select **Music** from the System, Applications, or Audio menu, open any audio/tracker file from **Files (`xfiles`)**, or run `xmusic [file_or_dir]`.
- **Supported formats**: plays standard audio (`.wav`, `.mp3`, `.ogg`, `.flac`, `.opus`, `.m4a`, `.aac`) as well as classic chiptune/tracker modules (`.mod`, `.xm`, `.it`, `.s3m`, `.mptm`, `.stm`, `.med`, `.okt`, `.669`, `.ult`, `.far`, `.mtm`, `.ptm`, `.amf`, `.dsm`, `.imf`, `.gdm`, `.stx`, `.umx`, `.mo3`) via an embedded `mpv` + `FFmpeg` + `libopenmpt` backend that automatically pauses on incoming calls.
- **Three tabs (`1:Player`, `2:Queue`, `3:Files` — switch with `1`–`3` or `Left`/`Right` in Queue/Files)**:
- **`1:Player`**: displays format badge (`MOD`, `XM`, `MP3`, etc.), scrolling track title, artist/metadata, animated equalizer bars, elapsed/total progress bar, repeat mode (`Off`, `All`, `One`), shuffle state, and volume. Press `Return` or `5` to **Play/Pause**, `Left`/`Right` (`4`/`6`) to **Seek `-5s`/`+5s`**, `Up`/`Down` (`2`/`8`) to adjust **Volume**, `7`/`9` for **Prev/Next track**, `*` to cycle **Repeat**, `#` to toggle **Shuffle**, `0` to **Stop**, or **Left softkey (`Options`)** to install the current track as the phone ringtone.
- **`2:Queue`**: browse the active playlist queue, filter with `0`–`9`, press `Return` to jump to a track, `*` to remove a track, `#` to shuffle, or **Left softkey (`Actions`)** to set the selected track as ringtone or clear the queue.
- **`3:Files`**: browse the filesystem (`~/Music`, `/usr/share/sxmo/music`, `/usr/share/sxmo/ringtones`, or any folder), press `Return` to play a file and load its folder into the queue, `*` to append a file or folder to the queue, or `#` to play the entire current folder.
16. **SIP VoIP client (`sip.so` / `xsip`)**:
- **Open**: select **SIP VoIP** from the System or Applications menu, or run `xsip`.
- **Three tabs (`1:Dialer`, `2:Accounts`, `3:History` — switch with `Left`/`Right`)**:
- **`1:Dialer`**: enter a SIP URI (`user@host[:port]` or `sip:user@host[:port]`) or account extension (`1001`) using multi-tap alphanumeric input (`*` or `#` cycles `[abc]` / `[ABC]` / `[123]` / `[Sym]` / `[Abc]`) or select a recent peer with `Up`/`Down`, and press **Call (green)** or **Center `OK`** to place an outgoing SIP call. Outbound calls work both with a registered SIP account and directly without any configured account (`Direct URI` mode, selectable via `Menu -> Switch Account` when accounts are also present).
- **`2:Accounts`**: add or edit SIP accounts (`~/.config/sxmo/sip_accounts.tsv`: Label, alphanumeric Username, Password, Domain, Port, UDP/TCP/TLS transport, ZRTP toggle, Preferred Codec, Enabled). Enabled accounts maintain RFC 3261 `REGISTER` keepalives with Digest MD5 authentication in the background even when `xsip` is closed.
- **`3:History`**: browse incoming, outgoing, and missed SIP calls (`~/.local/share/sxmo/sip_history.tsv`) and press **Call (green)** or **Center `OK`** to redial.
- **Audio codecs (`AUTO`, `PCMU`, `PCMA`, `GSM`, `OPUS`, `G722`, `G726-32`, `DVI4`, `L16`)**: supports full SDP `m=audio` / `a=rtpmap` / `a=fmtp` negotiation across 10 narrowband (`8 kHz`) and wideband (`16 kHz`) RTP/SRTP audio profiles, prioritizing **ITU-T G.711** `PCMU` (`PT 0`) and `PCMA` (`PT 8`, 8 kHz 64 kbps) first in `AUTO` mode, followed by **GSM 06.10 Full Rate** (`GSM/8000`, `PT 3`, 8 kHz 13 kbps RPE-LTP), **Opus** (`opus/48000/2`, RFC 7587, 16 kHz wideband VoIP with in-band FEC), **ITU-T G.722** (`G722/8000`, 16 kHz wideband 64 kbps SB-ADPCM), **ITU-T G.726-32** (`G726-32/8000`, 8 kHz 32 kbps ADPCM), **IMA ADPCM** (`DVI4/8000` `PT 5` and `DVI4/16000` `PT 6`), and **uncompressed 16-bit PCM** (`L16/8000` and `L16/16000`), plus **RFC 2833 / RFC 4733 `telephone-event/8000`** DTMF. Preferred codec priority is configurable per account (`Codec` field in the Account Editor) or for direct accountless calls (`Menu -> Cycle Direct Codec`).
- **ZRTP / SRTP encryption and CallScreen (`xcallscreen`) integration**: supports RFC 6189 **ZRTP** (`DH3k` 3072-bit / `DH2k` 2048-bit Diffie-Hellman key agreement with `a=zrtp-hash` SDP signaling and persistent 96-bit `ZID`) and RFC 3711 **SRTP** (`AES-128-CM` + `HMAC-SHA1-80`/`32`) encrypted voice media (`ON` by default per account and for direct accountless calls via `Menu -> Toggle Direct ZRTP`). Incoming `INVITE` requests wake the phone, trigger the ringtone/vibrator, and open `xcallscreen` with a `[SIP/<codec>]` badge; once ZRTP completes its handshake, the active codec and 4-character Short Authentication String (`SAS`) are displayed in both `xsip` (`<codec> | ZRTP SAS:<sas>`) and `xcallscreen` (`[SIP/<codec>:<sas>]`).
17. **Email client (`email.so` / `xemail` / `xmail`)**:
- **Open**: select **Email** from the System or Applications menu, or run `xemail` / `xmail`.
- **Three tabs (`1:Inbox`, `2:Compose`, `3:Accounts` — switch with `Left`/`Right`)**:
- **`1:Inbox`**: fetches headers and message bodies via `IMAP4rev1` or `POP3` over implicit TLS (`993`/`995`), `STARTTLS` (`143`/`110`), or plain TCP (`~/.local/share/sxmo/email/`), decoding RFC 2047 encoded-word subjects/senders, Base64/Quoted-Printable MIME parts, and HTML-only bodies. Press **Center `OK`** to open the full-screen message reader (`Up`/`Down` scrolls, **Center `OK`** replies), or **Call (green)** to sync the active account.
- **`2:Compose`**: enter `To`, `Subject`, and `Body` with multi-tap input (`*` cycles mode) and press **Call (green)** or **Left softkey (`Menu -> Send Email Now`)** to send via `SMTP` (`465` TLS or `587` `STARTTLS` with `AUTH PLAIN` / `AUTH LOGIN`).
- **`3:Accounts`**: add or edit multiple email accounts (`~/.config/sxmo/email_accounts.tsv`).
18. **IRCv3 client (`irc.so` / `xirc`)**:
- **Open**: select **IRC Chat** from the System or Applications menu, or run `xirc`.
- **Three tabs (`1:Chat`, `2:Buffers`, `3:Servers` — switch with `Left`/`Right`)**:
- **`1:Chat`**: displays scrollable message history (`Up`/`Down`) and multi-tap input bar (`*`/`#` cycles mode, **Center `OK`** or **Call (green)** sends message or executes `/join`, `/part`, `/leave`, `/close`, `/msg`, `/query`, `/nick`, `/me`, `/clear`, `/connect`, `/disconnect`, `/raw`, `/quit`).
- **`2:Buffers`**: lists server `*status*` buffers, joined `#channels`, and private query buffers with server/nick/connection subtitle and unread (`+N`) or `ACTIVE` badges. Highlight any buffer with `Up`/`Down` (or `2`/`8`) to switch the active buffer and press **Center `OK`**, `5`, **Call (green)**, `Left`, or **Right softkey (`Back`)** to open it in `Chat`; press `BackSpace` or **Left softkey (`Menu -> Close Buffer`)** to part and close the selected buffer.
- **`3:Servers`**: manage multiple IRC servers (`~/.config/sxmo/irc_servers.tsv`, preconfigured with Abjects (`irc.abjects.net`) over TLS `6697` and auto-joining `#bananarchy`), supporting OpenSSL TLS, IRCv3 capability negotiation (`CAP LS 302`: `sasl`, `server-time`, `message-tags`, `multi-prefix`, `away-notify`, `account-notify`, `chghost`, `cap-notify`), and `SASL PLAIN` authentication.
- **Background mode (`BG Mode`)**: when `BG Mode` is enabled on a server, closing `xirc` keeps the active IRC socket connection alive in the resident daemon and triggers notification hooks on nick highlights or private messages.
19. **Tox / Trifa P2P messenger and audio call client (`tox.so` / `xtox`)**:
- **Open**: select **Tox (Trifa)** from the System or Applications menu, or run `xtox`.
- **Three tabs (`1:Friends`, `2:Chat`, `3:My Tox ID` — switch with `Left`/`Right`)**:
- **`1:Friends`**: lists pending friend requests (press **Center `OK`** to accept) and saved friends with live status (`ONLINE (UDP)`, `ONLINE (TCP)`, `OFFLINE`). Press **Center `OK`** to open encrypted chat or **Call (green)** to start a `ToxAV` voice call.
- **`2:Chat`**: end-to-end encrypted P2P messaging (`~/.local/share/sxmo/tox/logs/`) with multi-tap input (`*` cycles mode, **Center `OK`** sends, **Call (green)** initiates a voice call).
- **`3:My Tox ID`**: displays your 76-character hexadecimal Tox ID (also exported to `/tmp/tox_id.txt` for easy copying over SSH) and DHT connection state (`DHT(UDP)` / `DHT(TCP)`).
- **Standby `ToxAV` voice calls**: incoming 48 kHz Opus `ToxAV` calls wake the display and open `xcallscreen` with a `[TOX]` badge.
20. **Kopher SmallWeb browser (`smallweb.so` / `xkopher` / `kopher` / `xsmallweb`)**:
- **Open**: select **SmallWeb (Kopher)** from the System or Applications menu, or run `xkopher [url]` / `kopher [url]`.
- **Supported protocols**: **Gopher** (`gopher://`, plus optional TLS `gophers://` or the in-menu `Gopher over TLS` toggle), **Gemini** (`gemini://` over TLS with text/gemini rendering and input prompts), **Spartan** (`spartan://`), and **Nex** (`nex://`), plus built-in `about:kopher` and `about:help` pages.
- **Default WAP-style keypad controls (from [Kopher](https://code.luxferre.top/luxferre/kopher.git), customizable in `~/.config/sxmo/smallweb_controls.tsv` via `Menu -> Customize Controls`)**:
- **`2` / `Up` and `8` / `Down`**: scroll up / down 1 line
- **`4` / `Left` and `6` / `Right`**: jump to previous / next link
- **`5` / `Center OK`**: open highlighted link or submit input prompt
- **`1` and `7`**: scroll left / right (`4` columns when line wrapping is off)
- **`3` and `9`**: jump to top / bottom of page
- **`*`**: toggle line wrapping (`WRAP` / `NOWRAP`)
- **Link focus always scrolls the viewport**: jumping to the previous /
next link (or toggling wrap) scrolls the focused link into view using
the actual wrapped display rows, in both `WRAP` and `NOWRAP` modes.
With wrapping off, horizontal scroll is reset to the start of the link
label. Page End also uses display rows rather than logical lines.
- **`#`**: toggle light / dark reader theme
- **`0`**: reload current page
- **`Call (green)`**: open URL address bar (`*` cycles input mode; `Call` inside the address bar toggles `Gopher TLS`)
- **`Right softkey` / `BackSpace`**: navigate back in history (or close when at root)
21. **Webarchy Web browser (`webarchy.so` / `webarchy` / `xwebarchy`)**:
- **Open**: select **Webarchy (Web)** from the System or Applications menu, or run `webarchy [url]` / `xwebarchy [url]`.
- **Engine, User-Agent, encoding, fonts, and multimedia**: built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` and WebGL) and 512 MB RAM pressure tuning (`160 MB` WebProcess cap). Uses `UTF-8` as the primary/default encoding when a server specifies none, configures Google **Noto** (`Noto Sans`, `Noto Serif`, `Noto Sans Symbols`, `Noto Sans Math`, `Noto Color Emoji`) as the default non-monospace web fonts while keeping **Fira Code** with OpenType ligatures (`calt`, `liga`) for monospace (`code`, `pre`, `kbd`, `samp`, `tt`), enables all HTML5/GStreamer multimedia playback (`MediaSource` / MSE, WebAudio, inline `<video>`/`<audio>`, and autoplay without user gesture requirements) by default, and uses `Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0` as the default User-Agent (overridable via `Menu -> User-Agent Override` across 4 presets or a custom multi-tap string persisted in `~/.config/sxmo/webarchy_ua.txt`).
- **Renderer profile and troubleshooting**: `nokia-argon` and the other slab targets keep Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` + WebGL). The 2720 Flip (`nokia,beatles`) starts on the CPU renderer (`WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER`) because its DMABUF/WebKit renderer cannot be initialised reliably; WebKitGTK's `WEBKIT_DISABLE_*` variables are presence flags, so they are never left set to `0`. Create `~/.config/sxmo/webarchy_software_renderer` to force the CPU profile on any target. If the WebProcess crashes on a hardware profile, Webarchy switches to software rendering once and reloads the page automatically. Load failures show the WebKit `GError` domain and code in the bottom status line, which makes an "Unexpected WebKit error" diagnosable instead of opaque.
- **Dual navigation modes (`[LNK]` Keypad Link Mode vs `[CUR]` Mouse Cursor Emulation Mode)**:
- **Keypad Link Mode (default)**: `Up` / `Down` scrolls vertically; `4` / `Left` and `6` / `Right` (or customizable Kopher keys in `~/.config/sxmo/smallweb_controls.tsv`) highlight the previous / next interactive element (`<a>`, `<button>`, `<input>`, `<select>`, `<textarea>`, `<video>`, `<audio>`) and display its label/URL in the bottom status bar; `5` / `Center OK` clicks the highlighted element or opens a NeoUI multi-tap text entry modal when an HTML `<input>` or `<textarea>` is selected (`Left softkey` or `Call` submits the form); `1` / `7` scrolls horizontally; `3` / `9` jumps to page top / bottom; `0` reloads; `#` cycles page zoom (`100%` / `85%` / `120%` / `70%`).
- **Mouse Cursor Emulation Mode (optional, off by default — toggle with `*#` chord or `Menu -> Toggle Mouse Cursor`)**: renders an on-screen pointer that moves with acceleration using `D-Pad` or `2`/`4`/`6`/`8` (plus diagonals `1`/`3`/`7`/`9`), automatically scrolls the page when pushed against the viewport edges, updates the bottom status bar with `(x,y)` coordinates and the hovered DOM element, and clicks or opens multi-tap input on `5` / `Center OK`.
- **Unobtrusive bookmarking (`~/.config/sxmo/webarchy_bookmarks.tsv`)**: displays a `*` prefix on the protocol badge (`*HTTPS` / `*HTTP`) whenever the current URL is bookmarked. Press `*` followed by `1`–`9`/`0` to save the current page to slot `1`–`10` (`**` sets the homepage), `#` followed by `1`–`9`/`0` to open slot `1`–`10` (`#*` opens the homepage), or open `Menu -> Bookmarks` (`Left softkey` saves into the highlighted slot, `Center OK` opens, `Call` deletes).
22. **GPS test utility and OpenStreetMap navigator (`gps.so` / `xgps` / `xmaps` / `xnav`)**:
- **Open**: select **GPS & Maps** from the System or Applications menu, or run `xgps` / `xmaps` / `xnav`.
- **Three tabs (`1:GPS Status`, `2:OSM Map`, `3:Nav/Search` — switch with `1`–`3` or `Left`/`Right` in Tabs 1 and 3)**:
- **`1:GPS Status`**: live GNSS reception test screen displaying Fix Status (`3D/2D FIX` vs `SEARCHING`), Latitude, Longitude, Altitude, Speed (`km/h`), Heading (`deg`), Satellites (`used/view`), HDOP, UTC timestamp, 3GPP cellular tower location (`MCC`/`MNC`/`TAC`/`CID`), and recent NMEA sentences (`$GPGGA`, `$GPRMC`, `$GPGSV`). Press **Center `OK`** to refresh immediately or `5` to center the map on the current GPS fix.
- **`2:OSM Map`**: interactive `240x212` OpenStreetMap slippy-map tile viewer with offline PNG tile caching (`~/.cache/sxmo/osm_tiles/<z>/<x>/<y>.png`), crosshair, GPS position marker, saved waypoint pins, and active route polyline overlay. Pan with `D-Pad` (`Up`/`Down`/`Left`/`Right`) or `2`/`8`/`4`/`6`, zoom in/out (`z=2..18`) with `*` / `#` (or `Center OK` / `0`), re-center on GPS (`FOLLOW`) with `5`, or press **Call (green)** to search places.
- **`3:Nav/Search`**: displays the active turn-by-turn route summary (total distance and next maneuver) and saved waypoints (`~/.config/sxmo/gps_waypoints.tsv`). Press **Call (green)** (or `Menu -> Search Place (Nominatim)`) to geocode any address or POI via OpenStreetMap Nominatim, or highlight any waypoint and press **Center `OK`** to compute a turn-by-turn road route from your current position via OSRM.
23. **Passcode phone locker (`locker.so` / `xlocker`)**:
- **Activate**: select **Power -> Lock** or **Power -> Lock (Screen off)**, double-press **End / Power**, close the physical slider, or run `xlocker [lock|screenoff|wake|status]`.
- **Controls, verification, and duress mode**: renders a fullscreen `240x320` (`X=0, Y=0`) lock screen showing the live clock, date, battery percentage, and unread SMS/notification count. Enter your numeric system password (`147147` by default, 4 or more digits) using `0`–`9`; when 4 or more digits are entered and match the user's `/etc/shadow` password hash (verified via `/usr/bin/bananarchy-verify-passcode`), the phone unlocks immediately. If a separate **duress passcode** has been configured and is entered on the lock screen (`exit 2`), `/usr/bin/bananarchy-duress-activate` silently activates **duress mode** (`/tmp/bananarchy_duress_mode` and blank profile `/tmp/duress_home`): contacts, call logs, and SMS history are blanked, the microSD card is unmounted and blocked, all active privacy/VPN tunnels are stopped (`bananarchy-privacy-ctl stop-all`), the UI theme and wallpaper are locked to `NordFrost.xth` and `/usr/share/wallpapers/nordic-peaks.png`, `*#06#` displays a session-persistent random Luhn-valid IMEI derived from the device's preconfigured 8-digit TAC, `xfiles` is clamped inside `/tmp/duress_home`, and `xpasscode`, `xprivacy`, `xtox`, `xirc`, `xsip`, and `st` are disabled and hidden from all menus until the phone is powered off or rebooted. Press `BackSpace`, `Left`, or **Right softkey (`Clear`)** to delete a digit; press **End / Power** (or **Right softkey (`Sleep`)** when the input field is empty) to blank the display while staying locked. Repeated wrong attempts enforce a 5-second lockout cooldown.
24. **Passcode and duress configurator (`passcode.so` / `xpasscode`)**:
- **Open**: select **Passcode** from the **Config** or **Applications** menu, or run `xpasscode`.
- **Two tabs (`1:User PIN`, `2:Duress PIN` — switch with `Left`/`Right`)**:
- **`1:User PIN`**: enter your current numeric passcode (`0`–`9`), enter and confirm a new user passcode of any length starting at `4` numeric digits, and press **Center `OK`** on **Save User Passcode** to update the real Linux system password (`user` in `/etc/shadow`).
- **`2:Duress PIN`**: verify your current user passcode and set or clear a separate numeric duress passcode (`4+` digits, stored as a salted hash in `/etc/bananarchy/duress.hash`, never matching the user passcode). Press `*` at any time to toggle masked vs. visible digits.
25. **Privacy Center (`privacy.so` / `xprivacy` / `privacy`)**:
- **Open**: select **Privacy Center** from the **System**, **Applications**, or **Config** menu, or run `xprivacy` / `privacy` (hidden and blocked in Duress Mode).
- **Five tabs (`1:Tor`, `2:Warp`, `3:OVPN`, `4:GS`, `5:WG` — switch with `Left`/`Right` or `1`–`5`; `Call` toggles the active tab's service; `*` refreshes status; `0` stops all active tunnels)**:
- **`1:Tor`**: start/stop the Tor anonymity daemon (`SocksPort 127.0.0.1:9050`, `TransPort 0.0.0.0:9040`, `DNSPort 0.0.0.0:9053`) with live bootstrap progress (`0%`–`100%`), and independently toggle **Route Native Traffic** (`OUTPUT` TCP + DNS redirection) and **Route Wi-Fi/USB Tether** (`PREROUTING` TCP + DNS redirection for `usb0` and `10.42.0.0/24`).
- **`2:Warp` (GS-Warp)**: start/stop the GSocket-tunneled OpenVPN client (`gs-warp` / `gs-warp-simple.sh` over `tun_gswarp`), edit the custom **GSocket Secret** string (or reset to the MD5 of the selected `.ovpn` profile), pick a custom `.ovpn` profile, and independently toggle **Route Native Traffic** and **Route Wi-Fi/USB Tether** (`table 210`).
- **`3:OVPN` (OpenVPN)**: start/stop OpenVPN (`tun_ovpn`) using any `.ovpn` configuration file selected via the built-in file picker or path editor, and independently toggle **Route Native Traffic** and **Route Wi-Fi/USB Tether** (`table 220`).
- **`4:GS` (GSocket single TCP port)**: start/stop `gs-netcat` (`gsocket`) for a single configurable **TCP Port** (`1`–`65535`) with a custom **GSocket Secret** (or generate a random secret via `gs-netcat -g`), switch between `Client (Out)` and `Server (In)` mode, and independently toggle **Route Native Port** and **Route Tethered Port** (`iptables -t nat REDIRECT` for that TCP port).
- **`5:WG` (WireGuard)**: start/stop a kernel WireGuard interface (`wg0`), generate a fresh Curve25519 keypair (`Generate New Keypair`), import a standard WireGuard `.conf` file, edit custom `PrivateKey`, `Peer PublicKey`, optional `PresharedKey`, `Endpoint (host:port)`, `Interface IP/CIDR`, and `Tunnel DNS`, and independently toggle **Route Native Traffic** and **Route Wi-Fi/USB Tether** (`table 230` with `fwmark 0xca6c` loop avoidance).
- **Zero-drain standby**: no background OpenRC daemons run when services are turned off, and `privacy.so` sleeps at `0%` CPU on `poll()` when hidden.
26. **Engineering menu (`engmenu.so` / `xengmenu`) and extended logging toggle (`bananarchy-engmenu-ctl`)**:
- **Open**: dial **`*#0001#`** (or `###`) in `xdialer`, or run `xengmenu` (hidden and blocked in Duress Mode).
- **Eight hardware and privacy controls (`1`–`8` hotkeys or `Up`/`Down` + `Center OK` / `Left softkey`)**:
- **`1: Override TTL`**: set a fixed outbound IPv4/IPv6 TTL/hop-limit (`64`, `65`, `128`, or custom `1..255`) for native and tethered traffic until reboot, or `0` to restore default.
- **`2: Edit IMEI 1` and `3: Edit IMEI 2`**: inspect or edit NVRAM IMEI 1 / IMEI 2 (`tunning` `nvm/num/550` & `nvm/context1/550` or `rf_nv` with Luhn check digit calculation and `*`/`#` random TAC-preserving generation).
- **`4: Run Overclock Script`**: toggle `performance` governor and maximum CPU/Adreno 304 GPU OPP clocks until reboot.
- **`5: Toggle DIAG Port`**: switch USB gadget between standard USB networking (`18d1:d001`) and Qualcomm Diagnostics + AT + NCM (`05c6:9091`).
- **`6: Edit Wi-Fi MAC` and `7: Edit Bluetooth MAC`**: set or randomize (`#`) locally-administered `wlan0` and `hci0` MAC addresses in NVRAM/persist and live interfaces.
- **`8: Extended Logging`**: toggle system and session logging (`OFF` by default). When `OFF` (default), all persistent and runtime logs (`sxmo_log`, `superd` and service logs, `Xorg`, `dwm`, `fcitx5`, `tinydm`, `NetworkManager`, `ModemManager`, and `/var/log`) are disabled and purged so there is zero idle logging activity and zero eMMC log wear. When `ON`, volatile diagnostic logs are written strictly to RAM (`/tmp/sxmo.log`, `/tmp/superd.log`, `/tmp/superd_state/superd/logs/*.log`). Also accessible from **`Config -> Extended Logging`** or via `bananarchy-engmenu-ctl logging [on|off|toggle|status]`.
#### 3.1.3 Standalone keypad games (`Snake`, `Tetris`, `Scoundrel`), Game Boy emulator (`Gambatte`), and J2ME emulator (`ReMEdy`)
Three native X11 games (`/usr/bin/snake`, `/usr/bin/tetris`, and `/usr/bin/scoundrel`), the **Gambatte (`gambatte` / `gbemu`)** Game Boy / Game Boy Color emulator, and the **ReMEdy (`remedy` / `j2me`)** J2ME (MIDP 2.0 / CLDC 1.1) emulator are accessible from **System menu -> Games** (and **System menu -> Applications** for ReMEdy, or by opening `.gb`/`.gbc` and `.jar`/`.jad` files directly in **Files (`xfiles`)**):
- **Snake (`snake`)**: steer with `2`/`8`/`4`/`6` or D-Pad; pause or restart with `5`/`Return`/`#`/`*`; quit with `Right softkey`/`BackSpace`/`Escape`.
- **Tetris (`tetris`)**: move with `4`/`6` (`Left`/`Right`), rotate with `2` (`Up`), soft drop with `8` (`Down`), hard drop with `0`/`5`/`Return`, pause with `#`/`*`, and quit with `Right softkey`/`BackSpace`/`Escape`.
- **Scoundrel (`scoundrel`)**: native `240x320` NeoUI roguelike solitaire dungeon crawler (based on the Zach Gage / Kurt Bieg card game). Navigate a 44-card dungeon (`26` Club/Spade monsters, `9` Diamond weapons, `9` Heart health potions) 4 cards at a time with `20` max HP: select room cards directly with `1`–`4` or move the cursor with `Left`/`Right` and play with `5`/`Center OK`/`Call`; press `0` or `*` to **Flee Room** (places the 4 room cards on the bottom of the deck; cannot flee two rooms in a row or after playing a card); when fighting a monster with an equipped weapon that can legally slay it (`monster <= last slain`), press `1`/`Left`/`OK` for **Weapon** or `2`/`Right` for **Barehanded**; press `#` for the in-game rules reference or **Left softkey** for a new run. High scores and win streaks are persisted in `~/.local/share/sxmo/scoundrel_stats.txt`.
- **Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`)**:
- **Launch**: open **Game Boy (Gambatte)** from **System menu -> Games**, open any `.gb` or `.gbc` file from **Files (`xfiles`)**, or run `gambatte [rom.gb|rom.gbc]`. When launched without a file argument, opens a built-in ROM browser scanning `/usr/share/games/gb`, `~/Games`, `~/ROMs`, `~/Downloads`, and user directories.
- **Default keypad controls** (fully readjustable via **Pause Menu -> Keypad Controls...** or **Left softkey (`Controls`)** in the ROM browser; persisted in `~/.config/sxmo/gambatte.cfg`):
- **B button**: `8`
- **Turbo B**: `5`
- **A button**: `9`
- **Turbo A**: `6`
- **Directions (`Up`/`Down`/`Left`/`Right`)**: `D-Pad` (`Up`, `Down`, `Left`, `Right`)
- **Start**: `2`
- **Select**: `3`
- **Palette selection**: `*` (cycles through 10 built-in color palettes: `DMG Classic`, `Bananarchy Gold`, `GB Pocket Gray`, `GB Light Teal`, `GBC Blue/Red`, `Super Game Boy`, `Amber CRT`, `Mintberry`, `Virtual Boy`, `Inverted Dark`)
- **Fast forward (2x)**: `0` (while held)
- **Quick shortcuts (when unbound)**: `1` cycles screen scaling mode (`Fit 240x216` 1.5x area-interpolated, `1:1 160x144`, `Fill 240x246`, `Full 240x296`); `4` saves state to the active slot; `7` loads state from the active slot; `#`, `BackSpace`, `Escape`, or either softkey opens the **Gambatte Pause Menu** (Save/Load State across 10 slots `.st0`..`.st9`, Palette, Screen Scale, Audio toggle, Keypad Controls remapping, Load Another ROM, and Quit). Battery-backed SRAM (`.sav`) and RTC (`.rtc`) are saved automatically in `~/.local/share/sxmo/gambatte/saves/`.
- **ReMEdy J2ME (MIDP 2.0 / CLDC 1.1) emulator (`remedy` / `j2me`)**:
- **Launch**: open **ReMEdy (J2ME)** from **System menu -> Applications** or **System menu -> Games**, open any `.jar` or `.jad` file from **Files (`xfiles`)**, or run `remedy [app.jar|app.jad]`. When launched without a file argument, opens the NeoUI-themed **ReMEdy J2ME** browser scanning `/usr/share/games/j2me`, `~/Games`, `~/J2ME`, `~/Downloads`, and user directories, displaying the selected MIDlet's `MIDlet-Name`, `MIDlet-Vendor`, `MIDlet-Version`, main class, and RMS save status.
- **Full-screen `240x320` resolution and NeoUI-themed LCDUI**: runs in a full-screen `240x320` window (`X=0, Y=0, W=240, H=320`) and declares native `240x320` dimensions (`getWidth() == 240`, `getHeight() == 320`) to J2ME applications. Full-screen `Canvas` and `GameCanvas` games get the entire `240x320` display, while high-level LCDUI screens (`Form`, `List`, `TextBox`, `Alert`, `ChoiceGroup`, `Gauge`, `TextField`, `StringItem`, and `Command` bars/menus) render with `libneoui.so` (`PluginTheme`) and adapt automatically to the active `.Xresources` / `~/.xthemes/*.xth` system theme.
- **Hardware-accelerated 3D (JSR-184 M3G), networking, RMS, and audio**: accelerates JSR-184 (`javax.microedition.m3g.*`) 3D scenes on the Adreno 304 (`FD304`) GPU via EGL + OpenGL ES 2.0 (with depth-buffered software fallback), supports HTTP/HTTPS and raw TCP/UDP socket connections (`javax.microedition.io.Connector`, `HttpConnection`, `SocketConnection`, `FileConnection` JSR-75), Nokia UI API (`com.nokia.mid.ui.*`), persistent `RecordStore` (RMS) storage (`~/.local/share/sxmo/remedy/rms/`), and MMAPI (`javax.microedition.media.Manager`) tone and WAV/MIDI audio over ALSA (`hw:0,0`). Audio follows the system speaker volume and mute state (the xdrawer **Speaker** slider) live, at the same loudness as other apps.
- **Keypad controls and pause menu**: maps D-Pad (`Up`/`Down`/`Left`/`Right`), `Center OK` (`FIRE`), `0`–`9`, `*`, `#`, **Left softkey** (`-6`), and **Right softkey** (`-7`) directly to MIDP 2.0 / Nokia key codes, with customizable key bindings persisted in `~/.config/sxmo/remedy.conf`. Press **Call (green)** (or hold **Right softkey** for `500 ms`) during execution to open the **ReMEdy Pause Menu** (Resume, MIDlet Commands, 3D Engine toggle, Softkey Bar mode, FPS Cap/Overlay, Audio (`Left`/`Right` change the system speaker volume, `OK` toggles ReMEdy sound), Keypad Controls remapping, Restart MIDlet, Clear MIDlet RMS Data, Load JAR/JAD, or Quit). Preinstalled MIDlets in `/usr/share/games/j2me/` and `~/Games/` include `g2048.jar`, `ReMEdy3DArena.jar` (JSR-184 3D benchmark), `AstroBlaster240.jar` (`GameCanvas` space shooter), and `NetToolJ2ME.jar` (LCDUI + HTTP/TCP socket test suite).
### 3.2 Multi-mode `fcitx5-t9` keypad reference
- **Short-press `#`** *(when no character is in preedit)*: cycles through the 6 input modes (`abc` -> `Abc` -> `ABC` -> `Sym` -> `Ctl` -> `123` -> `abc`), showing a `1500ms` mode banner at the bottom of the screen.
- **Auto-commit timeout**: `1500ms` for keys with `<= 10` candidates, or `1800ms` for keys with `> 10` candidates. Pressing a different key immediately commits the active candidate.
- **While a candidate is highlighted (`[item]`) in preedit**:
- Press **`#`** or **D-Pad `Up`**: toggles letter case (`a` <-> `A`) on the fly, or jumps forward **`+4` candidates** for non-alphabetic items.
- Press **D-Pad `Down`**: toggles letter case (`a` <-> `A`) for alphabetic items, or jumps backward **`-4` candidates** for non-alphabetic items.
- Press **D-Pad `Left`**: steps backward **1 candidate** on the same key.
- Press **D-Pad `Right`** or **Center `OK` (`Return`)**: commits the highlighted candidate immediately.
- Press **`BackSpace`**: cancels the uncommitted preedit candidate without deleting already committed text.
- **Long-press (`>= 550ms`)**:
- **Hold `0`–`9`**: commits the digit (`0`–`9`) immediately in any mode.
- **Hold `*`**: in `123` mode, commits `.` (decimal point); in all other modes, toggles a one-shot **`Ctrl+` modifier latch** (`+^`) so the next key is sent as `Ctrl+<key>`.
- **Hold `#`**: commits a literal `#` character immediately in any mode.
#### Modes 1–3: `abc` (lowercase), `Abc` (one-shot Shift), and `ABC` (Caps Lock)
*(In `Abc` and `ABC` modes, uppercase letters precede the digit and lowercase letters on keys `2`–`9`. In `Abc` mode, committing an alphabetic character automatically reverts to `abc`.)*
| Key | Tap sequence (`abc` mode) |
| :--- | :--- |
| **`1`** | `.` `,` `-` `_` `!` `?` `/` `@` `:` `;` `'` `"` `+` `=` `*` `#` `$` `%` `^` `&` `(` `)` `[` `]` `{` `}` `<` `>` `\|` `\` `~` `` ` `` `1` |
| **`2`** | `a` `b` `c` `2` `A` `B` `C` |
| **`3`** | `d` `e` `f` `3` `D` `E` `F` |
| **`4`** | `g` `h` `i` `4` `G` `H` `I` |
| **`5`** | `j` `k` `l` `5` `J` `K` `L` |
| **`6`** | `m` `n` `o` `6` `M` `N` `O` |
| **`7`** | `p` `q` `r` `s` `7` `P` `Q` `R` `S` |
| **`8`** | `t` `u` `v` `8` `T` `U` `V` |
| **`9`** | `w` `x` `y` `z` `9` `W` `X` `Y` `Z` |
| **`0`** | `Space` (`SPC`) `0` `Ent` (`Return`) `Tab` |
| **`*`** | `*` `#` `+` `-` `=` `_` `/` `\` `\|` `~` `` ` `` `@` `$` `%` `^` `&` `(` `)` `[` `]` `{` `}` `<` `>` `'` `"` `.` `,` `!` `?` `:` `;` `Tab` `Esc` `^C` `^D` `^Z` *(hold 450ms for `Ctrl+` latch)* |
#### Mode 4: `Sym` (grouped ASCII punctuation, symbols, and special keys)
| Key | Symbols / keys |
| :--- | :--- |
| **`1`** | `.` `,` `!` `?` `:` `;` `-` `_` `1` |
| **`2`** | `@` `#` `$` `%` `^` `&` `2` |
| **`3`** | `(` `)` `[` `]` `{` `}` `<` `>` `3` |
| **`4`** | `+` `-` `*` `/` `=` `_` `4` |
| **`5`** | `\|` `\` `~` `` ` `` `'` `"` `5` |
| **`6`** | `'` `"` `` ` `` `~` `^` `6` |
| **`7`** | `/` `\` `\|` `_` `-` `+` `7` |
| **`8`** | `<` `>` `!` `=` `?` `&` `8` |
| **`9`** | `$` `%` `^` `&` `*` `#` `@` `9` |
| **`0`** | `Space` (`SPC`) `0` `Tab` `Ent` (`Return`) `Esc` |
| **`*`** | `*` `#` `+` `-` `=` `_` `/` `\` `\|` `~` `` ` `` `@` `$` `%` `^` `&` `(` `)` `[` `]` `{` `}` `<` `>` `'` `"` `.` `,` `!` `?` `:` `;` |
#### Mode 5: `Ctl` (terminal control characters, navigation, and function keys)
- **Direct D-Pad navigation** *(when no preedit candidate is active in `Ctl` mode)*:
- **D-Pad `Up` / `Down`**: sends `Page_Up` (`PgUp`) / `Page_Down` (`PgDn`) immediately.
- **D-Pad `Left` / `Right`**: sends `Home` / `End` immediately.
- **Keypad multi-tap**:
| Key | Control sequences / special keys |
| :--- | :--- |
| **`1`** | `Esc` `Tab` `Del` `Ins` `Bksp` |
| **`2`** | `^C` `^D` `^Z` `^X` `^\` |
| **`3`** | `^A` `^E` `^U` `^K` `^W` |
| **`4`** | `^R` `^L` `^P` `^N` `^G` |
| **`5`** | `^S` `^Q` `^O` `^T` `^Y` |
| **`6`** | `^B` `^F` `^V` `^H` `^[` `^]` `^^` `^_` |
| **`7`** | `PgUp` `PgDn` `Home` `End` `ScrlUp` `ScrlDn` |
| **`8`** | `Up` `Down` `Left` `Right` |
| **`9`** | `F1` `F2` `F3` `F4` `F5` `F6` `F7` `F8` `F9` `F10` `F11` `F12` |
| **`0`** | `Space` (`SPC`) `Tab` `Ent` (`Return`) `Esc` |
| **`*`** | `Esc` `Tab` `^C` `^D` `^Z` `^X` `^L` `^R` `^W` |
#### Mode 6: `123` (instant numeric entry)
| Key | Action |
| :--- | :--- |
| **`0`–`9`** | Commits digit `0`–`9` immediately on single tap |
| **`*`** | Commits `*` immediately on single tap; **hold `450ms`** to commit `.` (decimal point) |
| **`#`** | **Short-press**: cycle back to `abc` mode; **hold `450ms`**: commit `#` |
---
## 4. Default credentials, USB SSH, and Bantam AI agent
- **Username**: `user`
- **Password**: `147147` (`doas` and `sudo` enabled; `/etc/doas.d/50-sxmo.conf` requires a password for general `wheel` use and grants targeted passwordless rules for system actions)
- **Changing the default password**: set `BANANARCHY_USER_PASSWORD` before bootstrapping a rootfs, or change it on the device with `passwd` or the passcode configurator. The power menu no longer contains any hardcoded credential.
- **USB networking SSH**:
```bash
ssh user@172.16.42.1
```
- **Bantam AI agent**:
Launch **Bantam** directly from the System menu (`Left softkey -> Applications -> Bantam`), or run `bantam` in any terminal (`st`) or over SSH. Configure your endpoint and API key via environment variables or `~/.bantam.cfg` when needed.
---
### 4.1 First-boot troubleshooting on the 2720 Flip
- **Wi-Fi and Bluetooth missing**: both radios depend on the shared WCNSS remote processor. `msm-firmware-loader` must start in sysinit before udev and mount the stock `modem` and `persist` partitions under `/run/msm-firmware-loader/mnt`; it then exposes `wcnss.mdt` and the factory `WCNSS_qcom_wlan_nv.bin` through the kernel firmware path. Check `rc-service msm-firmware-loader status`, `cat /sys/class/remoteproc/remoteproc1/state`, and `dmesg | grep -Ei 'wcnss|remoteproc|firmware'`. A `Direct firmware load for wcnss.mdt failed` message means the loader package or its sysinit link is missing, not that the Wi-Fi and Bluetooth drivers are absent. After a successful boot, `wlan0` and `hci0` enumerate automatically; Bluetooth userspace still starts on demand from the Networks/Bluetooth UI to save power.
- **X startup and keypad**: OpenRC starts independent services in parallel; `etc/init.d/local` replaces its stock `after *` dependency, which deadlocked with parallel startup on this image. `udev_settle_timeout=2` stops missing modem firmware from holding the display manager behind a long `udevadm settle`, and `bananarchy-sshd-debug` starts independently of `local.d`. A boot-open flip reads `/run/bananarchy/lid-state` and starts in `state=unlock` with no passcode screen, so the keypad is live as soon as `dwm` starts. If the keypad is dead, check `rc-service bananarchy-lid status`, `cat /run/bananarchy/lid-state`, `sxmo_state.sh get`, `/tmp/bananarchy_screen_locked`, `DISPLAY=:0 xwininfo -id 0xa00001` and `DISPLAY=:0 xinput list`.
- **Display distortion above 71% brightness**: the internal panel uses 25 MHz SPI on `nokia-beatles`, rather than the 50 MHz timing used by the other targets. This keeps the link stable when the MPP2 backlight PWM duty rises above the level-10/14 operating point. The brightness range remains 1–14 with no artificial cap, and panel offsets/init registers are unchanged. The timing can be checked with `dtc -I dtb -O dts /boot/qcom-msm8905-nokia-beatles.dtb | grep -A8 'display@0'`.
- **Closing the flip**: `bananarchy-lid` reads the current `EV_SW` switch mask from `/dev/input/event2`, follows hall edge events with an 80 ms stability window, and reconciles the raw gpio36/gpio92 debugfs levels every 200 ms even while evdev is present. This covers missed edges and stale `EVIOCGSW` state without a busy-polling loop. On close it blanks the main panel and keypad LED immediately, runs `sxmo_state.sh set screenoff` and tells the cover daemon `LID CLOSED`; on open it clears the lock flag, restores both backlights, sends a trusted `CLOSE` to `locker.so` and runs `sxmo_state.sh set unlock`. Check `rc-service bananarchy-lid status`, `sxmo_state.sh get` and `grep -E " gpio(36|92) " /sys/kernel/debug/gpio`. If the hall polarity is inverted on your unit, set `BANANARCHY_LID_GPIO_FILE` to a different debugfs GPIO file for the fallback path.
- **Cover display status and behaviour**: `bananarchy-cover-idle` is the compiled 0%-CPU default daemon and answers `bananarchy-coverctl` (`PING`, `STATUS`, `LID CLOSED|OPEN`, `BUTTON`, `NETWORK`, `BATTERY`, `NOTIFY`, `BLANK`/`UNBLANK`, `TEST`); the native `bananarchy-coverd` is retained only for diagnostics. With the flip **open** the external panel is fully off (all-black frame plus backlight 0) and `BUTTON` is ignored. With the flip **closed** the panel stays off until an external side key is pressed: `bananarchy-volume-keys` reads `/run/bananarchy/lid-state` and sends the trusted `BUTTON` datagram instead of changing the volume, which shows the live clock, date, battery percentage and the compact main network indicators (`4G SIG75 WIFI`-style, published by `bananarchy-cover-status.sh` from the NetworkManager dispatcher and at service start). No further button blanks the cover after exactly the same **Config -> Screen blank** timeout that `dwm` uses (`~/.config/sxmo/idle_blank_timeout`, default 300 s, `0` = never; `blank_timeout = auto` in `/etc/bananarchy/cover-display.conf` selects it, a numeric value overrides it). The daemon blocks in `poll()` with no timer while off, so idle CPU stays at 0%. The renderer uses the 32-bpp fbdev `write()` path (not `mmap()`, which raises `SIGBUS` on the DRM fbdev). The shipping DTS now registers both panels on an `spi-mux`: `display@0` keeps the verified 240x320 internal panel at 25 MHz with gpio110 as D/C (Xorg still pins `/dev/dri/card0`), while `display@1` is the 240x240 external GC9305 at 25 MHz with its own gpio21 D/C line, gpio23 reset and `write-only` framebuffer, exposed as `/dev/fb1`. gpio13 selects the mux and has a dedicated pull-down pinctrl state so the internal panel stays selected until `gpio-mux` drives it; the external panel's pinctrl group no longer touches gpio13. `spidev@1` is disabled, the `mux-core`/`mux-gpio`/`spi-mux` modules are loaded, and the external panel firmware is included in the initramfs. `bananarchy-coverctl STATUS` should now report `backend=fb`. `scripts/test-cover-idle.py` verifies the state machine with a fake framebuffer and `scripts/test-cover-dt.py` validates the DTB, firmware lists and Xorg pin; the DTB, appended boot DTB and `pmOS_boot` copy are rebuilt together. Physical sign-off of gpio13 mux polarity, external reset polarity and the lk2nd boot splash is still required on a live 2720 Flip; `devices/nokia-beatles/cover-panel.dtsi` remains a compile-checked reference for older DTBs. Run `bananarchy-cover-diagnose.sh` on the phone to check `/dev/fb1`, its geometry, the DRM cards, the loaded mux/panel modules, the firmware, the lid state and `bananarchy-coverctl STATUS` in one report. "Fully off" is a black frame plus `FBIOBLANK`/`FB_BLANK_POWERDOWN` on the fbdev (and the optional `backlight_path` sysfs node when present).
- **Camera app frozen / UI unresponsive**: check `top` for `bananarchy-volume-keys`. The daemon must be a single instance at 0% CPU; stale evdev fds are pruned by `prune_devices()`/`drop_device()` and guarded by `flock`. `rc-service bananarchy-volume-keys status` and `bananarchy-keypad-diagnose.sh` report its state. `xcamera` should return immediately and `bananarchy-photo <file>` should write a 600x800 JPEG.
- **Camera**: `/dev/video0` is provided by the out-of-tree `msm8905-cam` module, loaded at boot by `/etc/modules-load.d/bananarchy-hardware.conf` and `etc/local.d/10-bananarchy-hardware.start`. Check with `v4l2-ctl --list-devices`; a missing node means the module did not load (previously caused by a missing `/bin/sed` breaking the `modules` service).
- **Side volume keys**: the compiled evdev daemon `bananarchy-volume-keys` reads `KEY_VOLUMEUP`/`KEY_VOLUMEDOWN` directly and calls `sxmo_audio.sh vol up/down 5`; `sxmo_audio.sh` mirrors that percentage into the live PipeWire sink (the MSM8905 mainline kernel has no ALSA card yet). Press a side button and check `wpctl get-volume <sink-id>`; `bananarchy-keypad-diagnose.sh` reports the XKB mapping and both volume values.
- **First-boot checklist**: the rootfs must contain the full BusyBox applet set (`scripts/busybox-applets.txt`). `/bin/ash` is the `user` login shell and `/bin/grep` is used by OpenRC; if either is missing, sshd rejects `user/147147` and `udev` cannot start. Check `rc-service udev status` and `DISPLAY=:0 xinput list`: the keypad only appears in X when udev is running, `/dev/input/event*` are `0660 root:input` and elogind lists the keyboards under `seat0`. Run `rc-service tinydm restart` after fixing udev.
- **SSH rejects `147147`**: the PAM-enabled `/usr/sbin/sshd.pam` is pinned through `/etc/conf.d/sshd`, `/etc/pam.d/sshd` supplies an explicit `pam_unix` stack, and both `PasswordAuthentication` and `KbdInteractiveAuthentication` are enabled in `/etc/ssh/sshd_config.d/90-bananarchy-access.conf`. If PAM is ever broken again, a USB-only diagnostic listener is available on port 2222 (bound to `172.16.42.1`, never to Wi-Fi):
```bash
ssh -p 2222 user@172.16.42.1
```
The phone key in `keys/phone_id_ed25519` is pre-authorized for both `user` and `root`; add `touch /etc/bananarchy-no-debug-sshd` to turn the fallback listener off.
- **No boot splash**: the `extlinux.conf` `append` line must contain `quiet splash`. The pmOS initramfs defaults to `nosplash=y` and only starts `plymouthd` for the literal `splash` parameter; `scripts/sync-beatles-bootfs.py` restores the release cmdline and `--check` rejects a debug cmdline. Use `--debug-cmdline --allow-debug` only for a diagnostic build.
- **Keypad does not respond**: run `bananarchy-keypad-diagnose.sh` over SSH. It reports `/proc/bus/input/devices`, udev `ID_INPUT_*` tags (forced by `99-bananarchy-keypad.rules`), `SW_LID` / `SW_KEYPAD_SLIDE` state, kernel messages, Xorg/libinput devices and a short raw `evtest` probe. The Xorg rule `60-bananarchy-keypad.conf` binds the matrix keypad by product name so a missing `ID_INPUT_KEYBOARD` tag cannot make X ignore it. If the kernel emits no `EV_KEY` events at all, check the row/column GPIOs and `SW_LID` polarity on hardware.
---
## 5. Command-line hardware reference
### 5.1 Taking photos and screenshots (`bananarchy-photo`, `bananarchy-screenshot`, and `/dev/video0`)
Pressing **`*` and `#` simultaneously** from anywhere (desktop, menus, plugins, terminal, or games) captures a `240x320` screenshot using `scrot` (`/usr/bin/bananarchy-screenshot`), saves it to `~/Pictures/screenshot-YYYYMMDD-HHMMSS.png`, and triggers a brief haptic pulse and notification toast. You can also take screenshots from the CLI or via **System menu -> Scripts -> Screenshot**:
```bash
# Capture a 240x320 PNG screenshot to ~/Pictures/screenshot-YYYYMMDD-HHMMSS.png
bananarchy-screenshot
# Capture to a custom PNG path
bananarchy-screenshot ~/my-screen.png
```
The `msm8905-cam` kernel module drives the rear 2MP GalaxyCore `GC2395` (TA-1048), `GC2385` (TA-1059), and `GC2365` sensors through MSM8909 `CAMSS` and registers `/dev/video0` (`800x600` 24-bit `RGB3`). On `nokia-beatles` only, the demosaic sampler applies a 180-degree rotation while producing this frame, correcting the Flip's sensor mounting for every V4L2 consumer without an additional frame-buffer copy; the existing 90-degree portrait transform in `bananarchy-photo` and `xcamera` is unchanged.
- **Using `bananarchy-photo`**:
```bash
# Capture to ~/Pictures/photo-YYYYMMDD-HHMMSS.jpg and print path
bananarchy-photo
# Capture with rear LED flash enabled and open in imv
bananarchy-photo -f -v
# Capture to a custom JPEG or PNG file path
bananarchy-photo ~/my-shot.png
```
- **Direct low-level capture (`v4l2-ctl` + `ffmpeg -f rawvideo`)**:
```bash
v4l2-ctl -d /dev/video0 \
--set-fmt-video=width=800,height=600,pixelformat=RGB3 \
--stream-mmap --stream-count=1 --stream-to=/tmp/frame.rgb && \
ffmpeg -hide_banner -loglevel error \
-f rawvideo -pixel_format rgb24 -video_size 800x600 \
-i /tmp/frame.rgb -vf "transpose=1" -frames:v 1 -y ~/photo.jpg && \
rm -f /tmp/frame.rgb
```
### 5.2 Audio routing, music playback, and microphone recording
Both the rear loudspeaker (`Speaker`, with boosted `RX3 Digital Volume` for loud, clear ringtones and media), the front earpiece speaker (`Earpiece`, boosted by +6 dB and selectable as a standard output device for any audio stream), and wired 3.5mm headphones (`Headphones`, automatically detected and routed on plug-in and restored to `Speaker` on unplug by `sxmo_soundmonitor.sh`), as well as the internal MEMS microphone (`Mic1`) and 3.5mm headset microphone (`Mic2`), are managed through PipeWire/WirePlumber and `sxmo_audio.sh` with linear `1%`–`100%` volume controls across all channels:
- **Open an audio file, tracker module (`.mod`, `.xm`, `.it`, `.s3m`), monophonic ringtone (`.nrt`, `.rtttl`, `.rtx`, `.emy`, `.imy`), or folder in the native music player (`xmusic`)**:
```bash
xmusic ~/Music/Bananarchy_Chip.mod
```
- **Inspect, synthesize to WAV, or play a Nokia RTTTL (`.nrt`, `.rtttl`, `.rtx`), Ericsson eMelody (`.emy`), or IrDA iMelody (`.imy`) ringtone from the CLI (`bananarchy-melody`)**:
```bash
bananarchy-melody --info /usr/share/sxmo/ringtones/Nokia_Gran_Vals.nrt
bananarchy-melody --wav /usr/share/sxmo/ringtones/Ericsson_Cascade.emy /tmp/out.wav
bananarchy-melody --play /usr/share/sxmo/ringtones/IrDA_Pager.imy
```
- **List available audio outputs (`Speaker`, `Earpiece`, `Headphones`)**:
```bash
sxmo_audio.sh out list
```
- **Switch active output to the rear loudspeaker or front earpiece**:
```bash
sxmo_audio.sh out set "Speaker"
sxmo_audio.sh out set "Earpiece"
```
- **Record from the internal MEMS microphone (`Mic1`)**:
```bash
pw-record --rate=48000 --channels=1 --format=s16 ~/recording.wav
```
### 5.3 Flashlight (`white:torch`), keypad backlight (`white:kbd_backlight`), and vibration (`sxmo_vibrate`)
- **Turn rear flashlight on or off**:
```bash
brightnessctl -d white:torch set 1
brightnessctl -d white:torch set 0
```
- **Set keypad backlight brightness (`0`–`255`)**:
```bash
brightnessctl -d white:kbd_backlight set 255
```
- **Trigger PM8909 vibration motor (`duration_ms [strength_1_to_3]`)**:
```bash
sxmo_vibrate 350 1 # light (1600 mV, 38% duty cycle)
sxmo_vibrate 350 2 # medium (2100 mV, 67% duty cycle)
sxmo_vibrate 350 3 # strong (3100 mV, 100% continuous)
```
### 5.4 Cellular modem, Dual-SIM, and QMI UIM helper
- **Inspect Dual-SIM card status, PIN/PUK state, and active slot**:
```bash
doas /usr/libexec/msm-modem-uim-selection status
```
- **Switch default outgoing SIM slot (`1` or `2`) instantaneously without dropping DSDS registration**:
```bash
doas /usr/libexec/msm-modem-uim-selection switch 2
```
- **Swap Primary GW (`4G/LTE/3G + Mobile Data`) and Secondary GW (`2G GSM DSDS`) between physical SIM slots**:
```bash
doas /usr/libexec/msm-modem-uim-selection switch 2 --swap-gw
```
- **Send a USSD request on a specific SIM slot (`1` or `2`)**:
```bash
doas /usr/libexec/msm-modem-uim-selection ussd initiate --sim 2 "*111#"
```
- **Inspect ModemManager registration, operator, and signal quality**:
```bash
mmcli -m any
```
### 5.5 Adreno 304 GPU hardware acceleration and OpenGL / OpenGL ES demos
Bananarchy includes full kernel (`drm/msm` + `qcom-iommu` with `96 KB` GMEM, `a300_pfp.fw` / `a300_pm4.fw`, and up to `409.6 MHz` OPP scaling) and userspace (**Mesa Freedreno `FD304`**) hardware acceleration for the Qualcomm **Adreno 304 (`0x03000400`)** GPU across all supported MSM8905 and MSM8909 devices.
The **Xlibre** display server (`modesetting_drv.so`) uses **Glamor + DRI3 + GLX + KMSRO** to offload X11 rendering to the Adreno 304 GPU (`/dev/dri/card1` / `/dev/dri/renderD128`) and synchronize GMEM resolves before transferring damaged rectangles over DMA to the `panel-mipi-dbi` SPI display (`/dev/dri/card0`).
- **Query active OpenGL 3.1 / OpenGL ES 3.0 and EGL hardware renderer info**:
```bash
DISPLAY=:0 glxinfo -B
DISPLAY=:0 eglinfo -B
```
- **Run the 3D OpenGL hardware-accelerated demo on the `240x320` display**:
```bash
DISPLAY=:0 glxgears -info
```
- **Inspect live Adreno 304 GPU hardware state, frequency, and ringbuffer fences**:
```bash
doas cat /sys/kernel/debug/dri/1/gpu
```
### 5.6 MicroSD card management (`sxmo_sdcard.sh`) and GNSS / GPS CLI (`bananarchy-gps`)
- **Check microSD card (`/dev/mmcblk1`) status, mount, or unmount from the CLI**:
```bash
sxmo_sdcard.sh status
sxmo_sdcard.sh mount # mounts at /media/sdcard
sxmo_sdcard.sh unmount # flushes buffers and unmounts /media/sdcard
```
- **Test GNSS / GPS reception and inspect NMEA / 3GPP location from the CLI (`bananarchy-gps`)**:
```bash
bananarchy-gps status # enable GNSS if needed and print 3GPP + GPS coordinates and NMEA
bananarchy-gps nmea # print raw NMEA sentences from ModemManager / QMI PDS
bananarchy-gps watch 2 # continuously poll GPS fix and satellite telemetry every 2s
bananarchy-gps disable # stop standalone GNSS engine to save power
bananarchy-gps modem # show the resolved ModemManager modem and its location capabilities
```
All CLI and `gps.so` queries go through `/usr/bin/bananarchy-gps-modem.sh`, which picks the modem advertising `gps-nmea` (with `--location-enable-3gpp`, `--location-enable-gps-nmea`, `--location-enable-gps-raw`, `--location-set-gps-refresh-rate=2` and `--enable`). Plain `mmcli -m any` is ambiguous on the dual-SIM 2720 Flip and used to leave every GPS query empty.
### 5.7 Network time synchronisation (`bananarchy-time-sync.sh`)
`chronyd` runs from the default runlevel with `pool pool.ntp.org iburst minpoll 12 maxpoll 16`: long polls keep Wi-Fi asleep, while `iburst` sets the clock within seconds whenever the pool resolves. Because NetworkManager installs `resolv.conf` after `chronyd` starts, a `bananarchy-time-sync` OpenRC service and `/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh` re-resolve the pool and request an immediate burst when a connection comes up (`up`, `dhcp4-change`, `dhcp6-change`, `dns-change`, `connectivity-change`, `vpn-up`). The helper uses chronyd's root-only Unix command socket, so `cmdport 0` keeps the UDP command port closed, and it throttles repeats with a monotonic uptime stamp so a decades-long clock step cannot confuse it. `/var/lib/chrony` is owned by the `chrony` user so the driftfile survives reboots.
If the clock is still wrong after a connection comes up, use **Config -> Sync net time**. It runs `bananarchy-sync-net-time.sh`, forces an immediate burst over the same Unix socket, and shows a notification with the synced UTC date or a failure message. This is also handy after a long offline period, when the RTC has fallen back to 1970. After a confirmed sync, the helper calls `sxmo_hook_statusbar.sh refresh` as the X session user, so the status bar clock and charge icon are republished immediately instead of waiting for the next 300 s periodic tick. Charge events likewise refresh both the charge icon and the clock, and unlock forces a charge icon refresh even if the backlight is not yet bright. Plugging or unplugging the USB cable is handled by `85-bananarchy-battery.rules` and `/usr/bin/bananarchy-battery-charge-event.sh`: the charger's `power_supply` uevent forces the icon immediately and once more after a two-second sysfs race window (with `flock` coalescing the burst of uevents), so the charge icon changes at the moment of the transition even when the reported capacity has not changed yet.
```bash
bananarchy-time-sync.sh status # chronyc tracking + sources (via doas)
bananarchy-time-sync.sh force # re-resolve the pool and burst immediately
bananarchy-time-sync.sh sync # force and print a human-readable result
```
### 5.8 GPS-only system time (`bananarchy-gps-time-sync.sh`)
**Config -> Time source** toggles between `Network (NTP)` (the default) and `GPS only`. In GPS-only mode `chronyd` is stopped, `bananarchy-time-sync.sh` declines every boot/network-up/force NTP burst, and the system datetime is set **solely** from GNSS: `/usr/bin/bananarchy-gps-time-sync.sh` enables the modem's location sources, reads either ModemManager's `modem.location.gps.utc` or a valid `$GNRMC`/`$GPRMC` fix, steps the clock with `date -u -s`, writes the RTC with `hwclock -w -u`, and republishes the status bar clock. No DNS, NTP pool or network connection is used. The boot service calls `boot` in this mode, so a cold start with a 1970 RTC still recovers the date from GPS.
**Config -> Sync GPS time** (`/usr/bin/bananarchy-sync-gps-time.sh`) runs the same one-shot sync immediately and shows the resulting UTC timestamp (or the failure reason) as a notification; it works in either time-source mode. From the shell:
```bash
bananarchy-gps-time-sync.sh get # network | gps
bananarchy-gps-time-sync.sh source gps # select GNSS as the sole source
bananarchy-gps-time-sync.sh source network # restore NTP and chronyd
bananarchy-gps-time-sync.sh sync # one-shot GPS clock step
bananarchy-gps-time-sync.sh status # source, last fix, modem capabilities
```
---
## 6. Rebuilding the OS from a clean clone
A fresh `git clone` is enough to produce a flashable image. Docker, Python 3, and network access are the only host requirements; no pre-existing `rootfs/`, `images/`, or EDL checkout is needed.
```bash
./scripts/check-rebuild.sh # optional offline preflight
./rebuild-image.sh nokia-argon # builds images/bananarchy-nokia-argon.img
```
`rebuild-image.sh` runs the following steps automatically:
1. Verifies shell and Python syntax, the `armv7` package list, plugin artifacts, overlay sync, and the ignored local agent config (`scripts/check-rebuild.sh`).
2. Mirrors `prebuilt/` into `overlay/rootfs/` (`scripts/sync-prebuilt-overlay.sh`).
3. Creates a complete `armv7` rootfs from `scripts/rootfs-packages.txt` when `rootfs/` is missing or stale (`scripts/bootstrap-rootfs.sh`), including system accounts, OpenRC runlevels, base configuration, the overlay, and prebuilt kernel modules.
4. Applies the overlay, regenerates the initramfs with `mkinitfs`, and assembles the partitioned MBR image in `images/`.
Useful overrides and helpers:
```bash
ROOTFS_DIR=/path/to/rootfs IMAGES_DIR=/path/to/images ./rebuild-image.sh nokia-sparkler
BANANARCHY_USER_PASSWORD=1234 ./scripts/bootstrap-rootfs.sh --force
./scripts/bootstrap-rootfs.sh --check # report whether bootstrapping is needed
./chroot-shell.sh # bootstraps rootfs/ before opening a shell
sudo ./flash-edl.sh nokia-argon # uses vendor/edl/ and auto-installs host deps
```
The bootstrap is idempotent: an up-to-date rootfs is left untouched. `prebuilt/` is the single source of truth for compiled artifacts, and `scripts/rootfs-packages.txt` is the single source of truth for the package set. The patched EDL client library is vendored under `vendor/edl/` (MIT), so flashing works from a clean clone without a manual download; `flash-edl.sh` installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory when needed.
## Verified 2720 Flip image set
For the `a1108` / `dejavu` release, use the verified `nokia-beatles` raw image, standalone boot image, and display-enabled lk2nd image generated in `images/`. These files are local build outputs and are not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present. `scripts/set-bananarchy-hostname.sh` gives every image its target codename as the default hostname, and the display lk2nd image now requires the low-bit reboot cookie so **Reboot to bootloader** reaches the visible Fastboot menu. The default `147147` unlock passcode remains provisioned with the locker path unchanged. The X session performs a one-shot startup cleanup of stale `dmenu` and xlocker keyboard grabs, while `dwm` keeps the known-good 350 ms wake guard. `prepare-release.sh` rebuilds missing images from source and packages them; use `BA_REBUILD=1` for a forced source rebuild.