Port Quagr NeoUI pager plugin, opt-in receiver daemon, and cover alerts
- Port Quagr (<=30-byte SHA-256 + XOR + checksum) as C++20 NeoUI DWM plugin quagr.so (xquagr / quagr) across all targets with 3-tab UI (Receive, Send, Config) and independent Rx/Tx Passphrase or Raw 64-Hex key support. - Enforce strict receiver autostart gating in quagr_plugin_init and --preload (starts only when autostart_rx=1 and a valid Rx key/passphrase is set) with atomic $SXMO_NOTIFDIR system notification emission and duress-mode blocking. - Integrate QUAGR/QUAGR_CLEAR full-message wrapped rendering, extended ASCII 5x7 glyphs, persistent hold, and any-side-button dismissal into bananarchy-cover-idle and bananarchy-cover-event.sh for nokia-beatles. - Rebuild and pin a1120 (cocojamboo) images and release archives for nokia-argon, nokia-beatles, nokia-coconut, and nokia-sparkler, and add scripts/test-quagr.py.
This commit is contained in:
1 parent
0d8047ddfe
commit
f6b42ff604
81 files changed
+3165
-41
No files matched your search
@@ -135,7 +135,7 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
|
||||
keypad udev/Xorg rules, BusyBox applet lists, and `scripts/set-bananarchy-hostname.sh`.
|
||||
- The Power menu label is **Reboot to loader** and still calls `sxmo_power.sh bootloader`; `Logout` is removed from
|
||||
`dmenu.c`, `dmenu.so`, `sxmo_appmenu.sh`, and `sxmo_hook_contextmenu.sh`. Keep the compact Power menu layout synchronized.
|
||||
- Keep `msm8905-cam.c` 180-degree rotation enabled for `nokia,beatles`, `nokia,sparkler`, and `nokia,leo` alongside cached `row_buf` RAW10 demosaic; keep `patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch` (4-core SMP + `cpufreq` up to `1.267 GHz`), disabled `vibrator@c000` + volume-independent calibrated `157.0 Hz` haptic audio (`sxmo_vibrate.c`, `libpulse` + `SND_PCM_FORMAT_FLOAT_LE`, `HAPTIC_REF_RX3_VOL = 84`), `DEFAULT_USB_TIMEOUT_MS = 30000` (`--usb-timeout`), and `sxmo_timer.sh` / `dmenu.c` keypad cancellation (`scripts/test-timer.py`, `scripts/test-sparkler-port.py`, `scripts/test-edl-firehose-read.py`).
|
||||
- Keep `quagr` (`quagr.so` / `xquagr`) receiver autostart strictly gated on `autostart_rx=1` plus a valid Rx passphrase or 64-char hex key, closed-flip `QUAGR` cover alerts dismissing on any side button (`scripts/test-quagr.py`), `msm8905-cam.c` 180-degree rotation enabled for `nokia,beatles`, `nokia,sparkler`, and `nokia,leo` alongside cached `row_buf` RAW10 demosaic; keep `patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch` (4-core SMP + `cpufreq` up to `1.267 GHz`), disabled `vibrator@c000` + volume-independent calibrated `157.0 Hz` haptic audio (`sxmo_vibrate.c`, `libpulse` + `SND_PCM_FORMAT_FLOAT_LE`, `HAPTIC_REF_RX3_VOL = 84`), `DEFAULT_USB_TIMEOUT_MS = 30000` (`--usb-timeout`), and `sxmo_timer.sh` / `dmenu.c` keypad cancellation (`scripts/test-timer.py`, `scripts/test-sparkler-port.py`, `scripts/test-edl-firehose-read.py`, `scripts/test-quagr.py`).
|
||||
- Bluetooth HOGP config and plugin load are verified, but full hardware sign-off still needs a wake-up paired keyboard
|
||||
and **Connect Device** to confirm real HID key events.
|
||||
|
||||
|
||||
+9
-4
@@ -21,6 +21,11 @@ Upcoming release build (`a1120` / `cocojamboo` via `scripts/version.sh`) targeti
|
||||
- **Kernel DTS, volume-independent calibrated 157 Hz speaker-LRA haptic audio, dual-GPIO torch, and upright cached-row camera (`msm8905-cam` / `camera.so`)**: set `deviceinfo_drm="true"` and `matrix_keypad`/`matrix_keymap` in `devices/nokia-sparkler/modules-initfs`; updated `qcom-msm8909-nokia-sparkler.dts` and `qcom-msm8909-nokia-sparkler.dtb` with stock MSM8909 MTP root IDs (`0xf5`/`0x8`/`0x100`/`0x1000d`), `512 MiB` `/memory`, QDSP6/Q6Voice audio (`wcd_codec: audio-codec@f000`, `apr`, `sound@7702000` with `dai-link-multimedia3` disabled, `lpass_codec: audio-codec@771c000`), Sxmo keypad codes (`0x500d4` `KEY_CAMERA`, `0x100007f` `KEY_COMPOSE`, `0x205000e` `BackSpace`, `0x301009e` `KEY_BACK`), and disabled unpopulated PM8909 `vibrator@c000` (`status = "disabled";`); added native `157.0 Hz` speaker-LRA haptic audio (`vibrate_haptic_audio()`, `libpulse` sink/input query via `pa_sw_volume_to_linear`, `RX3 Digital Volume` + PipeWire `softVolumes` gain compensation over `SND_PCM_FORMAT_FLOAT_LE`, calibrated `1950` / `2550` / `3300` reference amplitudes at `HAPTIC_REF_RX3_VOL = 84`, `10 ms` cosine fade, `HOME=/home/user` root-drop fix, `plughw:0,0` / muted-sink bypass, and non-speaker exclusion) in `src/dwm-plugins/sxmo_vibrate.c` (`links libasound` + `libpulse` + `libm`), verified live on `nokia-sparkler` across `0%`..`100%` speaker volume (`23.95`–`26.15` RMS at L2) and concurrent playback; updated `src/leds-msm8905-torch/leds-msm8905-torch.c` (`GPIO_32` `flash-en` + `GPIO_31` `flash-now` `BC847BS`); added `nokia,sparkler` and `nokia,leo` to `rotate_180` plus cached `row_buf[2][CAM_RAW_STRIDE]` burst copies in `src/msm8905-cam/msm8905-cam.c` and reduced `camera_plugin.cpp` post-frame sleep to `10 ms` (verified `/dev/video0` frame time reduced from `1.34 s` to `0.193–0.229 s/frame` with upright JPEG output); wired `nokia-sparkler` across `check-beatles-bootimg.py`, `sync-beatles-bootfs.py`, `flash-edl.py`, `prepare-release.sh`, `check-rebuild.sh`, `test-sparkler-port.py`, and docs.
|
||||
- **EDL Firehose `<read>`, USB reconnect, and `30 s` USB timeout (`vendor/edl/Library/{firehose,usb,sahara}.py`, `flash-edl.py`, `MANUAL.md`)**: handled standard Qualcomm `rawmode="true"` XML ACK packets in `qualcomm_firehose` (`_begin_raw_read` / `_read_raw_sectors`) alongside FIH's immediate raw streams and capped reads to `min(bytes_to_read, max_chunk)`, fixing GPT/partition corruption on `8k.mbn` (`nokia-sparkler`, `nokia-leo`) and `2720v.mbn`; skipped redundant `set_configuration()` in `usb_class.connect()` when an active USB configuration already exists; raised per-transfer USB bulk read/write timeout to `30000 ms` (`DEFAULT_USB_TIMEOUT_MS = 30000`, `flash-edl.py --usb-timeout`, `2000 ms` Sahara connect probe, and `5–30 s` Fastboot/ADB kick timeouts); added `nokia-leo` to `UNLOCK_DEFAULT_DEVICES`, suppressed duplicate `Bootloader (boot)` output when a per-device `lk2nd` image is active, updated the EDL/Fastboot button-combo hints to **`*` + `#`** (EDL) and **`#`** (Fastboot) for `nokia-sparkler` and `nokia-leo`, added `scripts/test-edl-firehose-read.py`, and verified full live `--only-backup --dump-diagnostics` extraction from the connected `nokia-sparkler`.
|
||||
|
||||
### Quagr encrypted pager plugin (`quagr.so` / `xquagr`) and Nokia 2720 Flip cover alerts across all targets
|
||||
|
||||
- **Core C++20 NeoUI plugin (`src/dwm-plugins/quagr_plugin.cpp`, `quagr.so`, `xquagr`, `quagr`)**: ported the Quagr `<= 30`-byte SHA-256/XOR cipher (`SHA256("QUAGR:" || passphrase)` or direct 64-character raw hex keys, independently configurable for receive and send) over `ntfy` HTTP/HTTPS relays (`NetStream` chunked/raw streaming `GET /<topic>/raw` and `POST /<topic>`), with a 3-tab NeoUI keypad UI (`Receive`, `Send`, `Config`), `rx.log`/`tx.log` persistence, duress-mode blocking/hiding (`dmenu.c`, `dwm_plugin_runner.c`, `phone_data.h`, `xdrawer.cpp`, `sxmo_hook_apps.sh`, `bananarchy-duress-activate`), and Sxmo notification emission (`$SXMO_NOTIFDIR` -> `bananarchy-notifmonitor` sound + `dunstify`).
|
||||
- **Strict opt-in autostart & `nokia-beatles` external cover screen integration (`bananarchy-cover-idle.c`, `bananarchy-cover-event.sh`)**: gated `quagr_plugin_init` and `--preload` so the receiver daemon **only** starts when `autostart_rx=1` and a valid Rx passphrase or 64-hex key is configured (`0%` idle RAM/CPU otherwise); added `QUAGR`/`QUAGR_CLEAR`, full printable ASCII 5x7 glyphs, and multi-line `draw_wrapped_centered()` rendering to `bananarchy-cover-idle.c` so incoming closed-flip Quagr pages wake the outer `240x240` display immediately, show the entire wrapped message past `wake_blank_timeout` / concurrent `NOTIFY` races, and dismiss cleanly on any side button (`VOLUP`, `VOLDOWN`, `POWER`) or `LID OPEN` while keeping incoming call priority intact; verified via `scripts/test-quagr.py` and `scripts/check-rebuild.sh`.
|
||||
|
||||
### Keypad-friendly timer countdown and alarm cancellation across all targets
|
||||
|
||||
- **Permissionless `sxmo_timer.sh`, `dmenu` **Stop Timer** / **Cancel Timer**, and hook integration**: replaced `sxmo_sleep -c boottime_alarm` (`CLOCK_BOOTTIME_ALARM`, which failed with `Operation not permitted` for unprivileged `user`) with tracked `${XDG_RUNTIME_DIR}/sxmo_timers/*.timer` + `/tmp/sxmo_timer_ringing` state in `overlay/rootfs/usr/bin/sxmo_timer.sh`; added non-blocking `stty min 0 time 10` + `dd | tr` keypad cancellation (`Enter`/`0`/`q`/`BackSpace`/`#`/`*`) during countdown and any-key dismissal on expiry; replaced the infinite notification/vibration loop with a single wake, one replaceable critical notification, and a bounded `30 s` alert loop (`pw-play` / `mpv` + `sxmo_vibrate`) alongside `status`, `stop`, and `stop_ringing` subcommands and `HUP INT TERM EXIT` traps; added live `timer_menu_state()` **Stop Timer** / **Cancel Timer** items at the top of the `Sys` and `Timer` menus and `Clear Notification` / `sxmo_hook_mute_ring.sh` / `sxmo_hook_discard.sh` cancellation hooks, verified offline (`scripts/test-timer.py`) and live on `nokia-sparkler`.
|
||||
@@ -56,10 +61,10 @@ Upcoming release build (`a1120` / `cocojamboo` via `scripts/version.sh`) targeti
|
||||
### Image persistence and upcoming `a1120` (`cocojamboo`) release archives
|
||||
|
||||
- **Verified `a1120` / `cocojamboo` image set (`--mkinitfs`) and packaged archives**:
|
||||
- `images/bananarchy-nokia-argon.img`: SHA-256 `6ada66359a650a7e93f8937082a46353171989a54de19661821c1b91ea642ae3` (packaged in `bananarchy-nokia-argon-a1120-cocojamboo.zip`, SHA-256 `b4c8c1ede10d4dd764362f12bf4c783fd5d2558eb5fd3f0159c099a05a89c9a4`, alongside `bootloader/lk2nd-msm8909.img`).
|
||||
- `images/bananarchy-nokia-beatles.img`: SHA-256 `33b8b9181d5a23dd4a4bb473d827c6a87cf3407374c2e8b409fc45a7e60881b9`, `images/boot-bananarchy-nokia-beatles.img`: SHA-256 `7e242e51cb3b16fe932d83c5807b0df93188606aa78859c484e3a8ed4414a8ff`, and `images/boot-lk2nd-nokia-beatles-display.img`: SHA-256 `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d` (packaged in `bananarchy-nokia-beatles-a1120-cocojamboo.zip`, SHA-256 `11474af3d5301856da0363b891ae2e4ec7241ecebb54043eb5bfd72297614554`).
|
||||
- `images/bananarchy-nokia-coconut.img`: SHA-256 `4928a008fc1394e84c2bc2040b91b515eb2f506c39f0c822d8242e40dbf31eb6`, `images/boot-bananarchy-nokia-coconut.img`: SHA-256 `ac4ea812933bb9d990540881110ecf88f1585c31590d4b860834f1553f2f1537`, and `images/boot-lk2nd-nokia-coconut-display.img`: SHA-256 `e876424b38b0782f589756b4107337b24f27f7c37d624cc7d3907a5331df050a` (packaged in `bananarchy-nokia-coconut-a1120-cocojamboo.zip`, SHA-256 `7cb55ff1e9fedda3e2c594e1ec2e9536a09e35e3a9895a5f488c4b2eb4cf5520`).
|
||||
- `images/bananarchy-nokia-sparkler.img`: SHA-256 `7b8de44bac9cded16f219d723748806a17053886dd1762d7261ac6de308918d6`, `images/boot-bananarchy-nokia-sparkler.img`: SHA-256 `1ae0dfe5f189cbf381cdc26a89d95bfbabf2e267e86091fd1e8b32392460fa79`, and `images/boot-lk2nd-nokia-sparkler-display.img`: SHA-256 `bc41c2ddd1079246a7e91a40222fcafb82b0b52965c8ee8081872767d006748f` (packaged in `bananarchy-nokia-sparkler-a1120-cocojamboo.zip`, SHA-256 `e98a3454ff9df21648cff697a11144498658479c8c971725ff8884650b656528`).
|
||||
- `images/bananarchy-nokia-argon.img`: SHA-256 `640127f7d49e25906df1d9bb9e63fb2c07374bfa908092658d0e763c7ac87a94` (packaged in `bananarchy-nokia-argon-a1120-cocojamboo.zip`, SHA-256 `80c1284f5f8ba305065085ed9e4cb5e2494797ab21a2aeb6582d2f43cca21145`, alongside `bootloader/lk2nd-msm8909.img`).
|
||||
- `images/bananarchy-nokia-beatles.img`: SHA-256 `289698c31daf25adceba6af8fcdc93cd85673d0a24faf5c848ef0c0bb659fab7`, `images/boot-bananarchy-nokia-beatles.img`: SHA-256 `cc0678bcdcd3fbafe54a4e5236f104d647dd6965aa05dfe4de56217095b8eba8`, and `images/boot-lk2nd-nokia-beatles-display.img`: SHA-256 `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d` (packaged in `bananarchy-nokia-beatles-a1120-cocojamboo.zip`, SHA-256 `dfb10c9938c586cc89939f667ecb005a34bad9eb29903b33b6c6e9f2996c963e`).
|
||||
- `images/bananarchy-nokia-coconut.img`: SHA-256 `1f36243dc318fb024650c55e64202941c761227bf528fbb3128a1b5063eead0d`, `images/boot-bananarchy-nokia-coconut.img`: SHA-256 `e38cba2eaf502eaccf4c6b8b4b3dc97145cde1aefed940546385793ef25035e0`, and `images/boot-lk2nd-nokia-coconut-display.img`: SHA-256 `e876424b38b0782f589756b4107337b24f27f7c37d624cc7d3907a5331df050a` (packaged in `bananarchy-nokia-coconut-a1120-cocojamboo.zip`, SHA-256 `f68d3703f7e8d89602a7181b71c233a3a5c3bfa2c625fa0ddb0aded304d7344b`).
|
||||
- `images/bananarchy-nokia-sparkler.img`: SHA-256 `170e1ef659755b7c10571a926211ff14352e194eaf92ecc8177c04003936091d`, `images/boot-bananarchy-nokia-sparkler.img`: SHA-256 `8ebfb07dd3d3a5108e47962e90a4594c43e66343986175791097542828d016e3`, and `images/boot-lk2nd-nokia-sparkler-display.img`: SHA-256 `bc41c2ddd1079246a7e91a40222fcafb82b0b52965c8ee8081872767d006748f` (packaged in `bananarchy-nokia-sparkler-a1120-cocojamboo.zip`, SHA-256 `895cc86195c6e55d46f256cb559c1a8bcb06f38de2420157d00fd3730f135dd0`).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -274,7 +274,15 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
||||
- **`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`)**:
|
||||
20. **Quagr encrypted pager (`quagr.so` / `xquagr` / `quagr`)**:
|
||||
- **Open**: select **Quagr Pager** from the System or Applications menu, or run `xquagr` / `quagr` (hidden and blocked in Duress Mode).
|
||||
- **Three tabs (`1:Receive`, `2:Send`, `3:Config` — switch with `Left`/`Right`)**:
|
||||
- **`1:Receive`**: displays relay subscription state (`OFFLINE`, `CONNECT`, `LISTEN`, `RECONN`), topic, Rx key fingerprint, and scrollable received page history (`~/.local/share/sxmo/quagr/rx.log`). Press **Call (green)** (or **Center `OK`** when empty / **Menu -> Listen Now**) to subscribe or stop, and press **Center `OK`** on any received page to open the full wrapped page modal (press **Left softkey (`To Send`)** to copy it into the composer).
|
||||
- **`2:Send`**: multi-tap / `fcitx5-t9` composer enforced at the `30`-byte UTF-8 Quagr wire limit with a live `N / 30 bytes` progress meter and sent history (`~/.local/share/sxmo/quagr/tx.log`). Press **Center `OK`** or **Call (green)** to encrypt with the Tx key and `POST` to the relay.
|
||||
- **`3:Config`**: stores `~/.config/sxmo/quagr.conf` (`0600`). Configure **Autostart Receiver** (`ON`/`OFF`), independent **Rx Key Mode** and **Tx Key Mode** (`Passphrase` using `SHA256("QUAGR:" || passphrase)` vs `Raw Hex (64)` for 32-byte raw keys), **Copy Rx -> Tx**, **Generate Rx Hex Key**, **Relay Base URL** (default `https://ntfy.sh`), **Topic ID** (default `quagr-public`), and **Show Secrets**.
|
||||
- **Opt-in background receiver & notifications**: `quagr_plugin_init` and `dwm-plugin quagr --preload` **only** autostart the background stream receiver when **both** **Autostart Receiver** is `ON` (`autostart_rx=1`) **and** a valid Rx passphrase or 64-character hex key is set. Decrypted incoming pages emit a standard Sxmo notification (`$SXMO_NOTIFDIR/quagr_*` -> desktop toast, sound, and main-screen wake when open) and, on **Nokia 2720 Flip (`nokia-beatles`)** with the flip closed, send `QUAGR <msg>` directly to `bananarchy-cover-idle`, immediately lighting the `240x240` cover display with the full wrapped message until dismissed with any side button (`Volume Up`, `Volume Down`, or `Power`) or by opening the flip.
|
||||
|
||||
21. **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`)**:
|
||||
@@ -294,7 +302,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
||||
- **`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`)**:
|
||||
22. **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. The image build also compiles `usr/share/glib-2.0/schemas/gschemas.compiled` from the explicit `glib` and `gsettings-desktop-schemas` packages; if that file is missing, WebKit's network process logs `No GSettings schemas are installed on the system` and reports an internal error before a page can load.
|
||||
@@ -303,24 +311,24 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
||||
- **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`)**:
|
||||
23. **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`)**:
|
||||
24. **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`)**:
|
||||
25. **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`)**:
|
||||
26. **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`).
|
||||
@@ -330,7 +338,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
||||
- **`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`)**:
|
||||
27. **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.
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
- **Pure X11 graphical stack with GPU acceleration**: cross-compiled **Xlibre** (`X11Libre/xserver`) display server offloading 2D/3D screen rendering to the **Adreno 304 GPU** via **Glamor, DRI3, GLX, and Mesa Freedreno (`FD304`, OpenGL 3.1 / OpenGL ES 3.0)** over `panel-mipi-dbi` KMSRO, paired with a customized **Sxmo (`sxmo-de-dwm`)** window manager (`240x320` vertical stack layout, native `ParentRelative` desktop clock and softkey bar without Conky overhead, `< 2 ms` slider/key wake latency, and zero Wayland overhead).
|
||||
|
||||
### Keypad-first user experience and native DWM plugins
|
||||
Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of 26 preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`:
|
||||
Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of 27 preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`:
|
||||
- **System and context menus (`dmenu`)**: instant full-screen 10-line vertical menus with live T9 filtering, built-in submenus, top-level **Stop Timer** / **Cancel Timer** controls when a timer is active, and hardware toggles.
|
||||
- **Passcode-based fullscreen phone locker (`xlocker`), GUI passcode configurator (`xpasscode`), and Duress Mode**: zero-bypass `240x320` fullscreen numeric passcode lock screen verified against the current user's system shadow password (`/usr/bin/bananarchy-verify-passcode`), blocking all desktop, menu, drawer, terminal, and power actions while locked and automatically handing off the display only during incoming calls. Includes a NeoUI **Passcode Configurator (`xpasscode` / `passcode.so`)** in `Config -> Passcode` to change the real Linux user password (`user`, any numeric length `>= 4` digits) and configure a separate **Duress Passcode**. Entering the duress passcode on the lock screen switches the session into **Duress Mode** (`/tmp/duress_home` blank profile with no contacts, SMS, call logs, or personal files, microSD unmounted and disabled, `xfiles` clamped to the profile directory, Passcode/Privacy Center/Tox/IRC/SIP/`st` terminal hidden and blocked, `*#06#` displaying a session-persistent random Luhn-valid IMEI derived from the device's TAC, and theme/wallpaper locked to `NordFrost.xth` and `nordic-peaks.png` until poweroff or reboot).
|
||||
- **Idle screen lock**: after the configurable **Screen blank** timeout, `bananarchy-idle-blank.sh` arms `bananarchy-idle-lock.sh`, which triggers `xlocker screenoff` after a 30 s dark-panel grace period (set `~/.config/sxmo/idle_lock_delay` to `0` for immediate locking or `off` to blank without a passcode). Waking the panel cancels the pending lock, so a quick key press returns to the unlocked desktop.
|
||||
@@ -43,11 +43,12 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs
|
||||
- **Modem and Dual-SIM manager (`xmodem`)**: 4-tab cellular control center (`SIMs`, `Radio`, `AT`, `Log`) supporting Dual-SIM Dual Standby (DSDS) with simultaneous network registration on both SIM slots, instant default SIM switching (`Set as Default SIM (Calls/SMS)`), full Primary/Secondary GW (`4G/Data`) slot swapping (`Make Primary GW (4G/Data Swap)`), SIM PIN unlock and PUK unblock wizards, 2G/3G/4G radio mode selection, interactive USSD sessions, and a live AT command console.
|
||||
- **Networks and Bluetooth manager (`xnetworks`) with OBEX file transfer (`bananarchy-bt-obex`)**: 3-tab connectivity manager for Wi-Fi networks, WPA2 password entry, Wi-Fi hotspot, USB tethering, 4G/LTE mobile data (`wwan0`) and APN editing, and Bluetooth pairing, with built-in Bluetooth OBEX Object Push file reception (`~/Downloads` status and receiver toggle in the `Bluetooth` tab) and **Send via Bluetooth** in `xfiles`. Bluetooth discovery runs through `/usr/local/bin/bluetoothctl` and `bananarchy-bt-scan.sh`, which keeps one interactive `bluetoothctl` PTY client alive, sets auto transport and duplicate-data, queries `devices` during active discovery, and stops discovery cleanly so unpaired peripherals are not dropped when the scan command exits. A narrow `doas` helper runs `btmgmt -i hci0 le on` before each scan because the WCNSS controller otherwise powers up with LE disabled and only performs BR/EDR inquiry. BlueZ runs in `dual` controller mode because `bredr` mode rejects the LE-only HOGP profile, leaving BLE keyboards and mice connected but without a usable input node. Pair/connect actions power the adapter on, enable LE, force the LE bearer for HID-over-GATT devices, and pair unbonded peripherals before connecting.
|
||||
- **File manager (`xfiles`) with microSD automount (`sxmo_sdcard.sh`), Bluetooth file sharing, music and tracker player (`xmusic`), and camera (`xcamera`)**: keypad directory browser with automatic microSD card (`/dev/mmcblk1`) detection and `/media/sdcard` mounting/unmounting, **Send via Bluetooth** OBEX file push to paired/discovered devices, built-in text viewer, integrated GUI multi-tap text editor (`Edit in Text Editor`, available as an action on any file), image viewer, and dedicated monophonic ringtone viewer (`RingtoneView` for Nokia RTTTL `.nrt`/`.rtttl`/`.rtx`, Ericsson eMelody `.emy`, and IrDA iMelody `.imy` with graphical piano-roll pitch contour, note sequence viewer, live audio preview, and one-key assignment as call ringtone or notification/SMS sound — plus one-click actions to launch `.jar`/`.jad` MIDlets in the **ReMEdy (`remedy`)** J2ME emulator, launch `.gb`/`.gbc` ROMs in the Game Boy emulator, run `.yab` scripts in Yabasic inside the terminal, play audio, preview images, set any image as wallpaper, or install any audio, tracker, or monophonic melody file as call ringtone or notification/SMS sound), a 3-tab music and chiptune tracker module player (`WAV`, `MP3`, `OGG`, `FLAC`, `Opus`, `MOD`, `XM`, `IT`, `S3M`, `NRT`, `RTTTL`, `RTX`, `EMY`, `IMY`, and more), and a live V4L2 camera viewfinder with digital zoom, flash/torch control, self-timer, and photo gallery.
|
||||
- **Native NeoUI communication and internet suite (`xsip`, `xemail`, `xirc`, `xtox`, `xkopher`, `webarchy`)**:
|
||||
- **Native NeoUI communication and internet suite (`xsip`, `xemail`, `xirc`, `xtox`, `xquagr`, `xkopher`, `webarchy`)**:
|
||||
- **SIP VoIP client (`xsip` / `sip.so`)**: RFC 3261 SIP softphone (`Dialer`, `Accounts`, `History`) supporting both account-registered calling (with Digest MD5 authentication and standby `REGISTER` keepalive) and direct accountless P2P SIP URI calling (`user@host[:port]` or `sip:user@host[:port]`), RFC 3263 DNS `SRV` (`_sip._udp.<domain>`) proxy discovery and dialog routing, RFC 6189 **ZRTP** media-path Diffie-Hellman (`DH3k`/`DH2k`) key agreement and RFC 3711 **SRTP** (`AES-128-CM` + `HMAC-SHA1-80`) voice encryption with a 4-character `SAS` verification code, incoming `INVITE` ringing and call handling integrated with `xcallscreen` (`[SIP/<codec>]` / `[SIP/<codec>:<sas>]`), multi-codec wideband and narrowband RTP/SRTP audio (`Opus` 16 kHz / 48 kHz RTP clock with in-band FEC, `ITU-T G.722` 16 kHz wideband SB-ADPCM, `G.711 PCMU`/`PCMA` 8 kHz, `GSM 06.10` Full Rate 8 kHz, `ITU-T G.726-32` 8 kHz ADPCM, `IMA ADPCM DVI4` 8/16 kHz, and `L16` uncompressed 16-bit PCM 8/16 kHz) with per-account and direct-mode codec preference selection, and RFC 2833 / RFC 4733 DTMF.
|
||||
- **Email client (`xemail` / `xmail` / `email.so`)**: multi-account `IMAP4rev1`, `POP3`, and `SMTP` client (`Inbox`, `Compose`, `Accounts`) supporting implicit TLS, `STARTTLS`, and plain TCP, SASL `PLAIN`/`LOGIN`, MIME RFC 2047/Base64/Quoted-Printable decoding, offline inbox cache, full-screen message reader, and composer.
|
||||
- **IRCv3 client (`xirc` / `irc.so`)**: multi-server IRC client (`Buffers`, `Chat`, `Servers`) with OpenSSL TLS, IRCv3 capability negotiation (`CAP LS 302`: `sasl`, `server-time`, `message-tags`, `multi-prefix`, `away-notify`, `account-notify`, `chghost`, `cap-notify`), `SASL PLAIN` authentication, slash commands, and resident background mode with highlight vibration alerts; the default network is Abjects (`irc.abjects.net`, TLS port `6697`) auto-joining `#bananarchy`.
|
||||
- **Tox / Trifa P2P messenger and audio call client (`xtox` / `tox.so`)**: encrypted P2P messenger (`Friends`, `Chat`, `My Tox ID`) built on `c-toxcore` (`libtoxcore.so.2`) with DHT + TCP relay bootstrap, friend requests, persistent message history, and `ToxAV` 48 kHz Opus voice calls integrated with `xcallscreen`.
|
||||
- **Quagr encrypted pager (`xquagr` / `quagr` / `quagr.so`)**: 3-tab NeoUI encrypted `<= 30`-byte pager over `ntfy` HTTP/HTTPS relays (`Receive`, `Send`, `Config`), supporting independent Rx and Tx credentials (each configurable as a Passphrase `SHA256("QUAGR:" + passphrase)` or raw 64-character hexadecimal key), a strict opt-in background receiver daemon (autostarts **only** when enabled in `~/.config/sxmo/quagr.conf` and a valid Rx key/passphrase is set) writing standard Sxmo sound/desktop notifications (`$SXMO_NOTIFDIR`), and closed-flip 2720 Flip (`nokia-beatles`) external cover screen integration that wakes immediately to display the full wrapped page until dismissed with any side button.
|
||||
- **Kopher SmallWeb browser (`xkopher` / `kopher` / `xsmallweb` / `smallweb.so`)**: multi-protocol SmallWeb client for **Gopher** (`gopher://`) with optional TLS (`gophers://`), **Gemini** (`gemini://`), **Spartan** (`spartan://`), and **Nex** (`nex://`), featuring WAP-style default keypad controls from [Kopher](https://code.luxferre.top/luxferre/kopher.git), user-adjustable keybindings (`~/.config/sxmo/smallweb_controls.tsv`), 10 bookmarks, custom homepage support, and link focus that always scrolls the viewport to the focused link in both wrapped and unwrapped modes.
|
||||
- **Webarchy Web browser (`webarchy` / `xwebarchy` / `webarchy.so`)**: full-featured HTML5/CSS3/JS web browser built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`, WebGL, accelerated 2D canvas, and 512 MB RAM pressure tuning), default KaiOS 4.0 User-Agent (`Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0`) with preset and custom User-Agent override (`~/.config/sxmo/webarchy_ua.txt`), `UTF-8` default encoding fallback, `Noto Sans` / `Noto Serif` (`font-noto` + `font-noto-emoji`) as the default non-monospace browser fonts and `Fira Code` with OpenType ligatures as the monospace font, full GStreamer multimedia (`MediaSource` / MSE, WebAudio, inline HTML5 `<video>`/`<audio>` autoplay without user gesture requirements), unobtrusive bookmarking (`*HTTPS`/`*HTTP` header badge, `*`+`0-9` save / `#`+`0-9` load chords, and bookmark manager), and dual navigation modes (keypad link-stepping mode with NeoUI multi-tap form input by default, plus an optional `*#` accelerated mouse cursor emulation mode), and a device-aware renderer profile: the 2720 Flip uses the WebKit CPU renderer (with automatic software fallback after a WebProcess crash) while the 8110 4G keeps Adreno 304 acceleration; `~/.config/sxmo/webarchy_software_renderer` forces the CPU profile on any target. The image build also compiles the installed GSettings schema XML into `usr/share/glib-2.0/schemas/gschemas.compiled`; without that database WebKit's network process aborts with an internal error before any renderer policy can help.
|
||||
- **GPS-only system time and live timezone sync**: **Config -> Time source** switches from NTP to GNSS only (stopping `chronyd` and disabling every network-up NTP burst) and **Config -> Sync GPS time** steps the clock from a ModemManager GPS UTC value or a valid RMC fix, writes the RTC and refreshes the status bar. All GPS queries now resolve the GNSS-capable modem through `bananarchy-gps-modem.sh` instead of the ambiguous `mmcli -m any`, which fixes empty GPS data on the dual-SIM 2720 Flip. Network-up `chronyd` bursts wait for sync completion (`bananarchy-time-sync.sh`) and live timezone changes (`setup-timezone` / `dmenu`) immediately refresh `099-time`, `bananarchy-run-aligned` (`SIGUSR1`), `locker.so` (`REFRESH_TIME`), and `bananarchy-cover-idle` (`ba_refresh_tz`) without rebooting. See `MANUAL.md` sections 5.6 and 5.8.
|
||||
@@ -99,7 +100,7 @@ bananarchy/
|
||||
│ ├── sxmo-dwm/ # Patched sxmo-dwm (240x320 bstack, Pango bar, softkey bar, and plugin API)
|
||||
│ ├── dwm-plugins/ # DWM plugins (locker, passcode, dialer, calllog, callscreen, contacts, sms,
|
||||
│ │ # files, camera, themes, modem, networks, ringtones, wallpapers, music, sip,
|
||||
│ │ # email, irc, tox, smallweb, webarchy, gps, privacy, engmenu) and runner
|
||||
│ │ # email, irc, tox, quagr, smallweb, webarchy, gps, privacy, engmenu) and runner
|
||||
│ ├── xdrawer/ # XDrawer global phone controls DWM plugin (xdrawer.so / xdrawer)
|
||||
│ ├── sxmo-dmenu/ # Resident DWM menu plugin (dmenu.so) and client (dmenu / xdmenu)
|
||||
│ ├── sxmo-st/ # Patched sxmo-st terminal with HarfBuzz Fira Code ligatures and XIM
|
||||
|
||||
@@ -80,6 +80,13 @@ case "$EVENT" in
|
||||
notification)
|
||||
coverctl NOTIFY "Notification" >/dev/null 2>&1 || true
|
||||
;;
|
||||
quagr)
|
||||
msg="$(clean_field "$*")"
|
||||
[ -n "$msg" ] && coverctl QUAGR "$msg" >/dev/null 2>&1 || true
|
||||
;;
|
||||
quagr-clear|quagr-dismiss)
|
||||
coverctl QUAGR_CLEAR >/dev/null 2>&1 || true
|
||||
;;
|
||||
ring)
|
||||
arg1="$(clean_field "${1:-}")"
|
||||
sim="$(clean_field "${2:-}")"
|
||||
|
||||
Binary file not shown.
@@ -106,7 +106,7 @@ pkill -9 -x st >/dev/null 2>&1 || true
|
||||
doas -n /usr/bin/bananarchy-privacy-ctl stop-all >/dev/null 2>&1 || true
|
||||
|
||||
# Notify all plugins to close overlays and reload theme/profile
|
||||
for p in dmenu xdrawer passcode tox irc sip engmenu privacy dialer calllog contacts sms files camera themes modem networks ringtones wallpapers music email smallweb webarchy gps; do
|
||||
for p in dmenu xdrawer passcode tox irc sip quagr engmenu privacy dialer calllog contacts sms files camera themes modem networks ringtones wallpapers music email smallweb webarchy gps; do
|
||||
fifo="/tmp/dwm_plugin_${p}.fifo"
|
||||
if [ -p "$fifo" ]; then
|
||||
printf 'CLOSE\nRELOAD_THEME\n' > "$fifo" 2>/dev/null || true
|
||||
|
||||
Binary file not shown.
Symlink
+1
@@ -0,0 +1 @@
|
||||
dwm-plugin
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
dwm-plugin
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -55,6 +55,7 @@ write_line_app xsip "$icon_phn SIP VoIP" "xsip"
|
||||
write_line_app xemail "$icon_eml Email" "xemail"
|
||||
write_line_app xirc "$icon_msg IRC Chat" "xirc"
|
||||
write_line_app xtox "$icon_msg Tox Messenger" "xtox"
|
||||
write_line_app xquagr "$icon_bel Quagr Pager" "xquagr"
|
||||
write_line_app xwebarchy "$icon_glb Webarchy Browser" "xwebarchy"
|
||||
write_line_app xkopher "$icon_glb Kopher (SmallWeb)" "xkopher"
|
||||
write_line_app xgps "$icon_map GPS & Maps" "xgps"
|
||||
|
||||
@@ -80,6 +80,13 @@ case "$EVENT" in
|
||||
notification)
|
||||
coverctl NOTIFY "Notification" >/dev/null 2>&1 || true
|
||||
;;
|
||||
quagr)
|
||||
msg="$(clean_field "$*")"
|
||||
[ -n "$msg" ] && coverctl QUAGR "$msg" >/dev/null 2>&1 || true
|
||||
;;
|
||||
quagr-clear|quagr-dismiss)
|
||||
coverctl QUAGR_CLEAR >/dev/null 2>&1 || true
|
||||
;;
|
||||
ring)
|
||||
arg1="$(clean_field "${1:-}")"
|
||||
sim="$(clean_field "${2:-}")"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Symlink
+1
@@ -0,0 +1 @@
|
||||
dwm-plugin
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
dwm-plugin
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -61,7 +61,8 @@ if command -v docker >/dev/null 2>&1; then
|
||||
[ ! -f "$BASE_DIR/prebuilt/sxmo-x11/usr/bin/st" ] || \
|
||||
[ ! -f "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/dmenu.so" ] || \
|
||||
[ ! -f "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/engmenu.so" ] || \
|
||||
[ ! -f "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so" ]; then
|
||||
[ ! -f "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so" ] || \
|
||||
[ ! -f "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so" ]; then
|
||||
echo " -> Missing prebuilt sxmo-x11/NeoUI artifacts; running scripts/build-sxmo-x11.sh..."
|
||||
"$BASE_DIR/scripts/build-sxmo-x11.sh"
|
||||
fi
|
||||
|
||||
@@ -132,7 +132,7 @@ EOF
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sip.so &
|
||||
pids="$pids $!"
|
||||
|
||||
for ssl_plug in email irc smallweb; do
|
||||
for ssl_plug in email irc smallweb quagr; do
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
"/bananarchy/src/dwm-plugins/${ssl_plug}_plugin.cpp" $NEOUI_LIBS $PLUG_LIBS -lssl -lcrypto \
|
||||
-o "/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/${ssl_plug}.so" &
|
||||
@@ -186,7 +186,8 @@ EOF
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/gps.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/passcode.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/engmenu.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so
|
||||
|
||||
$CC $OPT_CFLAGS -std=c99 -D_DEFAULT_SOURCE -Wall -Wextra \
|
||||
/bananarchy/src/dwm-plugins/dwm_plugin_runner.c -ldl \
|
||||
@@ -216,8 +217,26 @@ EOF
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-melody
|
||||
$STRIP --strip-unneeded /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-melody
|
||||
|
||||
ln -sf dwm-plugin /bananarchy/prebuilt/sxmo-x11/usr/bin/xquagr
|
||||
ln -sf dwm-plugin /bananarchy/prebuilt/sxmo-x11/usr/bin/quagr
|
||||
mkdir -p /bananarchy/overlay/rootfs/usr/bin /bananarchy/overlay/rootfs/usr/lib/dwm/plugins
|
||||
cp -f /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so \
|
||||
/bananarchy/overlay/rootfs/usr/lib/dwm/plugins/quagr.so
|
||||
ln -sf dwm-plugin /bananarchy/overlay/rootfs/usr/bin/xquagr
|
||||
ln -sf dwm-plugin /bananarchy/overlay/rootfs/usr/bin/quagr
|
||||
if [ -d /target-rootfs/usr/bin ]; then
|
||||
mkdir -p /target-rootfs/usr/lib/dwm/plugins
|
||||
cp -f /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so \
|
||||
/target-rootfs/usr/lib/dwm/plugins/quagr.so
|
||||
ln -sf dwm-plugin /target-rootfs/usr/bin/xquagr
|
||||
ln -sf dwm-plugin /target-rootfs/usr/bin/quagr
|
||||
fi
|
||||
|
||||
chown -R "$HOST_UID:$HOST_GID" \
|
||||
/bananarchy/prebuilt/sxmo-x11 \
|
||||
/bananarchy/overlay/rootfs/usr/lib/dwm/plugins/quagr.so \
|
||||
/bananarchy/overlay/rootfs/usr/bin/xquagr \
|
||||
/bananarchy/overlay/rootfs/usr/bin/quagr \
|
||||
/bananarchy/src/neoui \
|
||||
/bananarchy/src/xdrawer \
|
||||
/bananarchy/src/dwm-plugins
|
||||
|
||||
@@ -256,6 +256,11 @@ EOF
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so &
|
||||
pids="$pids $!"
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/quagr_plugin.cpp $NEOUI_LIBS $PLUG_LIBS -lssl -lcrypto \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so &
|
||||
pids="$pids $!"
|
||||
|
||||
for pid in $pids; do
|
||||
wait "$pid"
|
||||
done
|
||||
@@ -289,7 +294,8 @@ EOF
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/gps.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/passcode.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/engmenu.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so
|
||||
|
||||
$CC $OPT_CFLAGS -std=c99 -D_DEFAULT_SOURCE -Wall -Wextra \
|
||||
/bananarchy/src/dwm-plugins/dwm_plugin_runner.c -ldl \
|
||||
@@ -357,6 +363,8 @@ EOF
|
||||
ln -sf dwm-plugin /bananarchy/prebuilt/sxmo-x11/usr/bin/xengmenu
|
||||
ln -sf dwm-plugin /bananarchy/prebuilt/sxmo-x11/usr/bin/xprivacy
|
||||
ln -sf dwm-plugin /bananarchy/prebuilt/sxmo-x11/usr/bin/privacy
|
||||
ln -sf dwm-plugin /bananarchy/prebuilt/sxmo-x11/usr/bin/xquagr
|
||||
ln -sf dwm-plugin /bananarchy/prebuilt/sxmo-x11/usr/bin/quagr
|
||||
|
||||
mkdir -p /bananarchy/overlay/rootfs/usr/bin /bananarchy/overlay/rootfs/usr/lib/dwm/plugins /bananarchy/overlay/rootfs/usr/include
|
||||
cp -a /bananarchy/prebuilt/sxmo-x11/usr/bin/. /bananarchy/overlay/rootfs/usr/bin/
|
||||
|
||||
@@ -481,15 +481,15 @@ fi
|
||||
|
||||
echo "[check] Known-good flashable image set..."
|
||||
for pair in \
|
||||
"6ada66359a650a7e93f8937082a46353171989a54de19661821c1b91ea642ae3 images/bananarchy-nokia-argon.img" \
|
||||
"33b8b9181d5a23dd4a4bb473d827c6a87cf3407374c2e8b409fc45a7e60881b9 images/bananarchy-nokia-beatles.img" \
|
||||
"7e242e51cb3b16fe932d83c5807b0df93188606aa78859c484e3a8ed4414a8ff images/boot-bananarchy-nokia-beatles.img" \
|
||||
"640127f7d49e25906df1d9bb9e63fb2c07374bfa908092658d0e763c7ac87a94 images/bananarchy-nokia-argon.img" \
|
||||
"289698c31daf25adceba6af8fcdc93cd85673d0a24faf5c848ef0c0bb659fab7 images/bananarchy-nokia-beatles.img" \
|
||||
"cc0678bcdcd3fbafe54a4e5236f104d647dd6965aa05dfe4de56217095b8eba8 images/boot-bananarchy-nokia-beatles.img" \
|
||||
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img" \
|
||||
"4928a008fc1394e84c2bc2040b91b515eb2f506c39f0c822d8242e40dbf31eb6 images/bananarchy-nokia-coconut.img" \
|
||||
"ac4ea812933bb9d990540881110ecf88f1585c31590d4b860834f1553f2f1537 images/boot-bananarchy-nokia-coconut.img" \
|
||||
"1f36243dc318fb024650c55e64202941c761227bf528fbb3128a1b5063eead0d images/bananarchy-nokia-coconut.img" \
|
||||
"e38cba2eaf502eaccf4c6b8b4b3dc97145cde1aefed940546385793ef25035e0 images/boot-bananarchy-nokia-coconut.img" \
|
||||
"e876424b38b0782f589756b4107337b24f27f7c37d624cc7d3907a5331df050a images/boot-lk2nd-nokia-coconut-display.img" \
|
||||
"7b8de44bac9cded16f219d723748806a17053886dd1762d7261ac6de308918d6 images/bananarchy-nokia-sparkler.img" \
|
||||
"1ae0dfe5f189cbf381cdc26a89d95bfbabf2e267e86091fd1e8b32392460fa79 images/boot-bananarchy-nokia-sparkler.img" \
|
||||
"170e1ef659755b7c10571a926211ff14352e194eaf92ecc8177c04003936091d images/bananarchy-nokia-sparkler.img" \
|
||||
"8ebfb07dd3d3a5108e47962e90a4594c43e66343986175791097542828d016e3 images/boot-bananarchy-nokia-sparkler.img" \
|
||||
"bc41c2ddd1079246a7e91a40222fcafb82b0b52965c8ee8081872767d006748f images/boot-lk2nd-nokia-sparkler-display.img"; do
|
||||
set -- $pair
|
||||
want=$1
|
||||
@@ -2405,6 +2405,38 @@ if ! python3 "$BASE_DIR/scripts/test-timer.py" >/dev/null 2>&1; then
|
||||
fail "scripts/test-timer.py failed"
|
||||
fi
|
||||
|
||||
echo "[check] Quagr NeoUI pager plugin, opt-in daemon, and cover alerts..."
|
||||
for artifact in \
|
||||
src/dwm-plugins/quagr_plugin.cpp \
|
||||
prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so \
|
||||
overlay/rootfs/usr/lib/dwm/plugins/quagr.so \
|
||||
scripts/test-quagr.py; do
|
||||
if [ ! -f "$BASE_DIR/$artifact" ]; then
|
||||
fail "missing Quagr artifact: $artifact"
|
||||
fi
|
||||
done
|
||||
for link in \
|
||||
prebuilt/sxmo-x11/usr/bin/xquagr \
|
||||
prebuilt/sxmo-x11/usr/bin/quagr \
|
||||
overlay/rootfs/usr/bin/xquagr \
|
||||
overlay/rootfs/usr/bin/quagr; do
|
||||
if [ ! -L "$BASE_DIR/$link" ]; then
|
||||
fail "missing Quagr runner symlink: $link"
|
||||
fi
|
||||
done
|
||||
if ! grep -qF 'shouldAutostartQuagr' "$BASE_DIR/src/dwm-plugins/quagr_plugin.cpp" || \
|
||||
! grep -qF 'quagr_active' "$COVER_SRC" || \
|
||||
! grep -qF 'quagr)' "$COVER_EVENT" || \
|
||||
! grep -qF '"xquagr.pid"' "$DMENU_SRC" || \
|
||||
! grep -qF 'xquagr' "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_apps.sh"; then
|
||||
fail "Quagr plugin, cover screen integration, dmenu wiring, or apps hook is incomplete"
|
||||
fi
|
||||
if [ -x "$BASE_DIR/scripts/test-quagr.py" ] && \
|
||||
command -v python3 >/dev/null 2>&1 && \
|
||||
! python3 "$BASE_DIR/scripts/test-quagr.py" >/dev/null 2>&1; then
|
||||
fail "scripts/test-quagr.py failed"
|
||||
fi
|
||||
|
||||
if [ "$FAILURES" -ne 0 ]; then
|
||||
echo "[check] $FAILURES check(s) failed."
|
||||
exit 1
|
||||
|
||||
Executable
+625
@@ -0,0 +1,625 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Host integration test for the Quagr client/daemon & cover screen integration.
|
||||
|
||||
Compiles quagr_plugin.cpp + neoui.cpp and bananarchy-cover-idle.c on the host to
|
||||
verify:
|
||||
1. Quagr crypto interoperability (passphrase SHA-256 & raw 64-hex keys, XOR,
|
||||
2-byte checksum, 30-byte padding, wrong-key rejection).
|
||||
2. Strict autostart gating in both quagr_plugin_init() and --preload
|
||||
(starts ONLY when autostart_rx=1 and a valid Rx passphrase/hex key exist).
|
||||
3. End-to-end streaming HTTP chunked receive, atomic $SXMO_NOTIFDIR creation,
|
||||
rx.log persistence, and immediate BANANARCHY_COVER_SOCKET QUAGR delivery.
|
||||
4. Closed-flip bananarchy-cover-idle instant wake, full wrapped message display,
|
||||
persistence past wake_blank_timeout and NOTIFY races, and dismissal via any
|
||||
side button (VOLUP, VOLDOWN, POWER) or LID OPEN while preserving call priority.
|
||||
"""
|
||||
import hashlib
|
||||
import os
|
||||
import pathlib
|
||||
import queue
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
BASE = pathlib.Path(__file__).resolve().parent.parent
|
||||
QUAGR_CPP = BASE / "src/dwm-plugins/quagr_plugin.cpp"
|
||||
NEOUI_CPP = BASE / "src/neoui/neoui.cpp"
|
||||
COVER_C = BASE / "src/bananarchy-daemons/bananarchy-cover-idle.c"
|
||||
|
||||
FB_W, FB_H, FB_BPP = 240, 240, 32
|
||||
FB_SIZE = FB_W * FB_H * (FB_BPP // 8)
|
||||
|
||||
|
||||
def derive_quagr_pass_key(passphrase: str) -> bytes:
|
||||
return hashlib.sha256(("QUAGR:" + passphrase).encode("utf-8")).digest()
|
||||
|
||||
|
||||
def qgr_encrypt_py(message: str, key: bytes, nonce: bytes = None) -> str:
|
||||
raw = message.encode("utf-8")[:30]
|
||||
padded = raw + b"\xff" * (30 - len(raw))
|
||||
chk = hashlib.sha256(padded).digest()[:2]
|
||||
if nonce is None:
|
||||
nonce = os.urandom(4)
|
||||
mask = hashlib.sha256(nonce + key).digest()
|
||||
mc = padded + chk
|
||||
cipher = bytes(a ^ b for a, b in zip(mc, mask))
|
||||
return (nonce + cipher).hex()
|
||||
|
||||
|
||||
def wait_for(predicate, timeout=4.0, step=0.05):
|
||||
end = time.time() + timeout
|
||||
while time.time() < end:
|
||||
if predicate():
|
||||
return True
|
||||
time.sleep(step)
|
||||
return False
|
||||
|
||||
|
||||
def write_quagr_conf(home_dir: pathlib.Path, *, autostart=0, relay="https://ntfy.sh",
|
||||
topic="quagr-public", rx_mode="pass", rx_secret="",
|
||||
tx_mode="pass", tx_secret=""):
|
||||
cfg_dir = home_dir / ".config/sxmo"
|
||||
cfg_dir.mkdir(parents=True, exist_ok=True)
|
||||
conf = cfg_dir / "quagr.conf"
|
||||
conf.write_text(
|
||||
f"autostart_rx={1 if autostart else 0}\n"
|
||||
f"relay_url={relay}\n"
|
||||
f"topic_id={topic}\n"
|
||||
f"rx_mode={rx_mode}\n"
|
||||
f"rx_secret={rx_secret}\n"
|
||||
f"tx_mode={tx_mode}\n"
|
||||
f"tx_secret={tx_secret}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def pkg_flags(*pkgs):
|
||||
out = subprocess.check_output(["pkg-config", *pkgs], text=True)
|
||||
return out.strip().split()
|
||||
|
||||
|
||||
class CoverHarness:
|
||||
def __init__(self, root: pathlib.Path, exe: pathlib.Path):
|
||||
self.root = root
|
||||
self.sock_path = root / "cover.sock"
|
||||
self.fb = root / "fb1"
|
||||
self.backlight = root / "backlight"
|
||||
self.config = root / "cover.conf"
|
||||
self.main_blank = root / "idle_blank_timeout"
|
||||
self.lid_file = root / "lid-state"
|
||||
self.event_log = root / "cover-events.log"
|
||||
self.event_sh = root / "cover-event.sh"
|
||||
self.event_sh.write_text(
|
||||
"#!/bin/sh\n"
|
||||
"printf '%s %s\\n' \"$1\" \"$2\" >> \"$TEST_COVER_EVENT_LOG\"\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
os.chmod(self.event_sh, 0o755)
|
||||
self.fb.write_bytes(b"\x00" * FB_SIZE)
|
||||
self.backlight.write_text("0", encoding="utf-8")
|
||||
self.main_blank.write_text("5\n", encoding="utf-8")
|
||||
self.lid_file.write_text("open\n", encoding="utf-8")
|
||||
self.config.write_text(
|
||||
f"enabled = true\n"
|
||||
f"backend = fb\n"
|
||||
f"socket_path = {self.sock_path}\n"
|
||||
f"fb_device = {self.fb}\n"
|
||||
f"backlight_path = {self.backlight}\n"
|
||||
f"backlight_level = 160\n"
|
||||
f"blank_timeout = auto\n"
|
||||
f"wake_blank_timeout = 1\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
env = dict(os.environ)
|
||||
env.update({
|
||||
"BANANARCHY_COVER_LOCK": str(root / "cover.lock"),
|
||||
"BANANARCHY_COVER_FB_GEOM": f"{FB_W},{FB_H},{FB_BPP}",
|
||||
"BANANARCHY_COVER_MAIN_BLANK_CFG": str(self.main_blank),
|
||||
"BANANARCHY_COVER_NOIDLE_PATH": str(root / "sxmo.noidle"),
|
||||
"BANANARCHY_COVER_LID_STATE": str(self.lid_file),
|
||||
"BANANARCHY_COVER_EVENT_CMD": str(self.event_sh),
|
||||
"TEST_COVER_EVENT_LOG": str(self.event_log),
|
||||
})
|
||||
self.proc = subprocess.Popen(
|
||||
[str(exe), "--config", str(self.config)],
|
||||
env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
||||
)
|
||||
self.client_path = root / "cover-client.sock"
|
||||
self.client = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||
self.client.bind(str(self.client_path))
|
||||
self.client.settimeout(2.0)
|
||||
if not wait_for(self.sock_path.exists, timeout=3.0):
|
||||
raise RuntimeError("cover socket never appeared")
|
||||
|
||||
def send(self, cmd: str) -> str:
|
||||
self.client.sendto(cmd.encode("utf-8"), str(self.sock_path))
|
||||
try:
|
||||
return self.client.recv(512).decode("utf-8").strip()
|
||||
except socket.timeout:
|
||||
return ""
|
||||
|
||||
def status(self) -> dict:
|
||||
raw = self.send("STATUS")
|
||||
fields = {}
|
||||
for tok in raw.split():
|
||||
if "=" in tok:
|
||||
k, v = tok.split("=", 1)
|
||||
fields[k] = v
|
||||
return fields
|
||||
|
||||
def set_lid(self, state: str):
|
||||
self.lid_file.write_text(state + "\n", encoding="utf-8")
|
||||
self.send("LID " + state.upper())
|
||||
|
||||
def frame_nonzero_rows(self) -> list:
|
||||
data = self.fb.read_bytes()
|
||||
rows = []
|
||||
stride = FB_W * 4
|
||||
for y in range(FB_H):
|
||||
row = data[y * stride:(y + 1) * stride]
|
||||
if any(row):
|
||||
rows.append(y)
|
||||
return rows
|
||||
|
||||
def backlight_value(self) -> str:
|
||||
return self.backlight.read_text(encoding="utf-8").strip()
|
||||
|
||||
def events(self) -> str:
|
||||
if not self.event_log.exists():
|
||||
return ""
|
||||
return self.event_log.read_text(encoding="utf-8")
|
||||
|
||||
def close(self):
|
||||
try:
|
||||
self.send("QUIT")
|
||||
except OSError:
|
||||
pass
|
||||
self.client.close()
|
||||
try:
|
||||
self.proc.wait(timeout=3)
|
||||
except subprocess.TimeoutExpired:
|
||||
self.proc.kill()
|
||||
self.proc.wait()
|
||||
|
||||
|
||||
def build_host_binaries(root: pathlib.Path):
|
||||
cflags = pkg_flags("--cflags", "pangoxft", "x11", "xfixes", "xft",
|
||||
"fontconfig", "freetype2", "alsa", "openssl",
|
||||
"libjpeg", "libpng")
|
||||
libs = pkg_flags("--libs", "pangoxft", "x11", "xfixes", "xft",
|
||||
"fontconfig", "freetype2", "alsa", "openssl",
|
||||
"libjpeg", "libpng")
|
||||
|
||||
so_path = root / "quagr.so"
|
||||
cmd_so = [
|
||||
"g++", "-shared", "-fPIC", "-std=c++20", "-O2", "-Wall", "-Wextra",
|
||||
*cflags, f"-I{BASE / 'src/neoui'}", f"-I{BASE / 'src/dwm-plugins'}",
|
||||
str(QUAGR_CPP), str(NEOUI_CPP), *libs, "-o", str(so_path),
|
||||
]
|
||||
res_so = subprocess.run(cmd_so, capture_output=True, text=True)
|
||||
if res_so.returncode != 0:
|
||||
raise RuntimeError("quagr.so host compile failed:\n" + res_so.stderr)
|
||||
|
||||
harness_c = root / "quagr_host_runner.c"
|
||||
harness_c.write_text(textwrap.dedent("""
|
||||
#define _DEFAULT_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "dwm_plugin.h"
|
||||
|
||||
static int g_spawn_calls = 0;
|
||||
static char g_spawn_name[64] = "";
|
||||
static char g_spawn_arg[64] = "";
|
||||
|
||||
static void mock_spawn_plugin(const char* name, const char* arg) {
|
||||
g_spawn_calls++;
|
||||
snprintf(g_spawn_name, sizeof(g_spawn_name), "%s", name ? name : "");
|
||||
snprintf(g_spawn_arg, sizeof(g_spawn_arg), "%s", arg ? arg : "");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
const char* so_path = getenv("TEST_QUAGR_SO");
|
||||
if (!so_path || !*so_path) return 90;
|
||||
void* h = dlopen(so_path, RTLD_NOW | RTLD_LOCAL);
|
||||
if (!h) {
|
||||
fprintf(stderr, "dlopen: %s\\n", dlerror());
|
||||
return 91;
|
||||
}
|
||||
const DwmPlugin* plug = (const DwmPlugin*)dlsym(h, DWM_PLUGIN_ENTRY_SYMBOL);
|
||||
if (!plug || plug->api_version != DWM_PLUGIN_API_VERSION || !plug->name) {
|
||||
fprintf(stderr, "invalid plugin entry\\n");
|
||||
return 92;
|
||||
}
|
||||
if (argc >= 2 && strcmp(argv[1], "--probe-init") == 0) {
|
||||
DwmHostApi api;
|
||||
memset(&api, 0, sizeof(api));
|
||||
api.api_version = DWM_PLUGIN_API_VERSION;
|
||||
api.spawn_plugin = mock_spawn_plugin;
|
||||
if (plug->init) plug->init(&api);
|
||||
printf("spawn=%d name=%s arg=%s\\n", g_spawn_calls, g_spawn_name, g_spawn_arg);
|
||||
dlclose(h);
|
||||
return 0;
|
||||
}
|
||||
if (!plug->run_main) return 93;
|
||||
int rc = plug->run_main(argc, argv);
|
||||
dlclose(h);
|
||||
return rc;
|
||||
}
|
||||
"""), encoding="utf-8")
|
||||
|
||||
runner_path = root / "quagr_host_runner"
|
||||
cmd_run = [
|
||||
"gcc", "-std=c99", "-O2", "-Wall", "-Wextra",
|
||||
f"-I{BASE / 'src/sxmo-dwm'}", str(harness_c), "-ldl",
|
||||
"-o", str(runner_path),
|
||||
]
|
||||
res_run = subprocess.run(cmd_run, capture_output=True, text=True)
|
||||
if res_run.returncode != 0:
|
||||
raise RuntimeError("runner compile failed:\n" + res_run.stderr)
|
||||
|
||||
cover_exe = root / "cover-idle"
|
||||
res_cov = subprocess.run(
|
||||
["gcc", "-std=c11", "-O2", "-Wall", "-Wextra", "-Werror",
|
||||
f"-I{COVER_C.parent}", str(COVER_C), "-o", str(cover_exe)],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
if res_cov.returncode != 0:
|
||||
raise RuntimeError("cover-idle host compile failed:\n" + res_cov.stderr)
|
||||
|
||||
return so_path, runner_path, cover_exe
|
||||
|
||||
|
||||
def run_runner(runner: pathlib.Path, so_path: pathlib.Path, home: pathlib.Path,
|
||||
args, extra_env=None, timeout=5.0):
|
||||
env = dict(os.environ)
|
||||
env["HOME"] = str(home)
|
||||
env["TEST_QUAGR_SO"] = str(so_path)
|
||||
if extra_env:
|
||||
env.update(extra_env)
|
||||
return subprocess.run(
|
||||
[str(runner), *args], env=env, capture_output=True, text=True, timeout=timeout,
|
||||
)
|
||||
|
||||
|
||||
def test_init_and_autostart_gating(so_path: pathlib.Path, runner: pathlib.Path,
|
||||
root: pathlib.Path):
|
||||
# 1. Protocol & crypto internal self-test
|
||||
h0 = root / "home-selftest"
|
||||
h0.mkdir()
|
||||
r = run_runner(runner, so_path, h0, ["--self-test"])
|
||||
assert r.returncode == 0, f"--self-test failed: {r.stderr}"
|
||||
|
||||
# 2. Config absent -> no autostart in both init() and --preload
|
||||
h_none = root / "home-none"
|
||||
h_none.mkdir()
|
||||
r_init = run_runner(runner, so_path, h_none, ["--probe-init"])
|
||||
assert r_init.stdout.strip() == "spawn=0 name= arg=", r_init.stdout
|
||||
r_pre = run_runner(runner, so_path, h_none, ["--preload"], timeout=2.0)
|
||||
assert r_pre.returncode == 0
|
||||
|
||||
# 3. autostart_rx=0 with valid Rx passphrase -> no autostart
|
||||
h_off = root / "home-off"
|
||||
write_quagr_conf(h_off, autostart=0, rx_mode="pass", rx_secret="valid-pass")
|
||||
r_init = run_runner(runner, so_path, h_off, ["--probe-init"])
|
||||
assert r_init.stdout.strip() == "spawn=0 name= arg=", r_init.stdout
|
||||
r_pre = run_runner(runner, so_path, h_off, ["--preload"], timeout=2.0)
|
||||
assert r_pre.returncode == 0
|
||||
|
||||
# 4. autostart_rx=1 with empty Rx secret (even if Tx secret set!) -> no autostart
|
||||
h_empty = root / "home-empty-rx"
|
||||
write_quagr_conf(h_empty, autostart=1, rx_mode="pass", rx_secret="",
|
||||
tx_mode="pass", tx_secret="only-tx-set")
|
||||
r_init = run_runner(runner, so_path, h_empty, ["--probe-init"])
|
||||
assert r_init.stdout.strip() == "spawn=0 name= arg=", r_init.stdout
|
||||
r_pre = run_runner(runner, so_path, h_empty, ["--preload"], timeout=2.0)
|
||||
assert r_pre.returncode == 0
|
||||
|
||||
# 5. autostart_rx=1 with invalid 63-char hex Rx key -> no autostart
|
||||
h_badhex = root / "home-badhex"
|
||||
write_quagr_conf(h_badhex, autostart=1, rx_mode="hex", rx_secret="a" * 63)
|
||||
r_init = run_runner(runner, so_path, h_badhex, ["--probe-init"])
|
||||
assert r_init.stdout.strip() == "spawn=0 name= arg=", r_init.stdout
|
||||
r_pre = run_runner(runner, so_path, h_badhex, ["--preload"], timeout=2.0)
|
||||
assert r_pre.returncode == 0
|
||||
|
||||
# 6. autostart_rx=1 with valid passphrase -> init() spawns --preload
|
||||
h_pass = root / "home-pass-ok"
|
||||
write_quagr_conf(h_pass, autostart=1, rx_mode="pass", rx_secret="foo bar baz")
|
||||
r_init = run_runner(runner, so_path, h_pass, ["--probe-init"])
|
||||
assert r_init.stdout.strip() == "spawn=1 name=quagr arg=--preload", r_init.stdout
|
||||
|
||||
# 7. autostart_rx=1 with valid 64-hex key -> init() spawns --preload
|
||||
h_hex = root / "home-hex-ok"
|
||||
write_quagr_conf(h_hex, autostart=1, rx_mode="hex", rx_secret="0123456789abcdef" * 4)
|
||||
r_init = run_runner(runner, so_path, h_hex, ["--probe-init"])
|
||||
assert r_init.stdout.strip() == "spawn=1 name=quagr arg=--preload", r_init.stdout
|
||||
print("[ok] Quagr crypto self-test and strict init/--preload autostart gating")
|
||||
|
||||
|
||||
class MockNtfyState:
|
||||
def __init__(self):
|
||||
self.stream_ready = threading.Event()
|
||||
self.stop_stream = threading.Event()
|
||||
self.chunks = queue.Queue()
|
||||
self.posted = []
|
||||
self.get_count = 0
|
||||
|
||||
|
||||
def start_mock_ntfy(state: MockNtfyState):
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
protocol_version = "HTTP/1.1"
|
||||
|
||||
def log_message(self, fmt, *args):
|
||||
return
|
||||
|
||||
def do_GET(self):
|
||||
if not self.path.endswith("/raw"):
|
||||
self.send_response(404)
|
||||
self.send_header("Content-Length", "0")
|
||||
self.end_headers()
|
||||
return
|
||||
state.get_count += 1
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/plain")
|
||||
self.send_header("Transfer-Encoding", "chunked")
|
||||
self.end_headers()
|
||||
# Send an initial ntfy keepalive blank chunk before signaling ready
|
||||
self.wfile.write(b"1\r\n\n\r\n")
|
||||
self.wfile.flush()
|
||||
state.stream_ready.set()
|
||||
while not state.stop_stream.is_set():
|
||||
try:
|
||||
chunk = state.chunks.get(timeout=0.1)
|
||||
except queue.Empty:
|
||||
continue
|
||||
if chunk is None:
|
||||
break
|
||||
data = chunk.encode("utf-8")
|
||||
frame = f"{len(data):x}\r\n".encode("ascii") + data + b"\r\n"
|
||||
self.wfile.write(frame)
|
||||
self.wfile.flush()
|
||||
try:
|
||||
self.wfile.write(b"0\r\n\r\n")
|
||||
self.wfile.flush()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def do_POST(self):
|
||||
clen = int(self.headers.get("Content-Length", "0"))
|
||||
body = self.rfile.read(clen).decode("utf-8", errors="replace")
|
||||
state.posted.append((self.path, body))
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Length", "2")
|
||||
self.end_headers()
|
||||
self.wfile.write(b"ok")
|
||||
|
||||
srv = ThreadingHTTPServer(("127.0.0.1", 0), Handler)
|
||||
srv.daemon_threads = True
|
||||
t = threading.Thread(target=srv.serve_forever, daemon=True)
|
||||
t.start()
|
||||
return srv
|
||||
|
||||
|
||||
def run_preload_stream_case(so_path: pathlib.Path, runner: pathlib.Path,
|
||||
case_dir: pathlib.Path, *, rx_mode: str,
|
||||
rx_secret: str, decrypt_key: bytes, message: str):
|
||||
state = MockNtfyState()
|
||||
srv = start_mock_ntfy(state)
|
||||
port = srv.server_address[1]
|
||||
home = case_dir / "home"
|
||||
notif_dir = case_dir / "notifs"
|
||||
notif_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
cover_sock_path = case_dir / "mock_cover.sock"
|
||||
cover_rx = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||
cover_rx.bind(str(cover_sock_path))
|
||||
cover_rx.settimeout(0.2)
|
||||
|
||||
different_tx_hex = "fe" * 32
|
||||
write_quagr_conf(
|
||||
home,
|
||||
autostart=1,
|
||||
relay=f"http://127.0.0.1:{port}",
|
||||
topic="testroom",
|
||||
rx_mode=rx_mode,
|
||||
rx_secret=rx_secret,
|
||||
tx_mode="hex",
|
||||
tx_secret=different_tx_hex,
|
||||
)
|
||||
|
||||
# Clean any stale plugin lock/fifo in /tmp just in case
|
||||
for p in ("/tmp/dwm_plugin_quagr.lock", "/tmp/dwm_plugin_quagr.fifo",
|
||||
"/tmp/dwm_plugin_quagr.daemon.pid"):
|
||||
if os.path.exists(p):
|
||||
os.unlink(p)
|
||||
|
||||
env = dict(os.environ)
|
||||
env.update({
|
||||
"HOME": str(home),
|
||||
"TEST_QUAGR_SO": str(so_path),
|
||||
"SXMO_NOTIFDIR": str(notif_dir),
|
||||
"BANANARCHY_COVER_SOCKET": str(cover_sock_path),
|
||||
})
|
||||
proc = subprocess.Popen(
|
||||
[str(runner), "--preload"], env=env,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
||||
)
|
||||
try:
|
||||
assert state.stream_ready.wait(timeout=3.0), "preload daemon did not subscribe"
|
||||
|
||||
# Push noise encrypted under a different key -> must be silently ignored
|
||||
wrong_key = derive_quagr_pass_key("definitely-wrong-key")
|
||||
state.chunks.put(qgr_encrypt_py("Noise ignore me", wrong_key) + "\n")
|
||||
# Push real packet split across two chunks to test chunked stream assembly
|
||||
good_pkt = qgr_encrypt_py(message, decrypt_key) + "\n"
|
||||
state.chunks.put(good_pkt[:33])
|
||||
time.sleep(0.05)
|
||||
state.chunks.put(good_pkt[33:])
|
||||
|
||||
received_dgrams = []
|
||||
|
||||
def check_notif_and_cover():
|
||||
try:
|
||||
data = cover_rx.recv(512).decode("utf-8", errors="replace")
|
||||
received_dgrams.append(data)
|
||||
except OSError:
|
||||
pass
|
||||
files = [f for f in notif_dir.iterdir() if not f.name.startswith(".")]
|
||||
return len(files) > 0 and len(received_dgrams) > 0
|
||||
|
||||
assert wait_for(check_notif_and_cover, timeout=4.0), (
|
||||
f"missing notif/cover delivery: notifs={list(notif_dir.iterdir())}, "
|
||||
f"dgrams={received_dgrams}"
|
||||
)
|
||||
assert received_dgrams == [f"QUAGR {message}\n"], f"unexpected cover dgram: {received_dgrams}"
|
||||
|
||||
nfiles = [f for f in notif_dir.iterdir() if not f.name.startswith(".")]
|
||||
assert len(nfiles) == 1, f"expected 1 notif file (noise ignored), got {nfiles}"
|
||||
lines = nfiles[0].read_text(encoding="utf-8").splitlines()
|
||||
assert lines[:3] == ["quagr", "xquagr", f"[Quagr] {message}"], lines
|
||||
|
||||
rx_log = (home / ".local/share/sxmo/quagr/rx.log").read_text(encoding="utf-8")
|
||||
assert message in rx_log, rx_log
|
||||
assert "Noise ignore me" not in rx_log, rx_log
|
||||
finally:
|
||||
state.stop_stream.set()
|
||||
state.chunks.put(None)
|
||||
proc.terminate()
|
||||
try:
|
||||
proc.wait(timeout=3)
|
||||
except subprocess.TimeoutExpired:
|
||||
proc.kill()
|
||||
proc.wait()
|
||||
cover_rx.close()
|
||||
srv.shutdown()
|
||||
srv.server_close()
|
||||
for p in ("/tmp/dwm_plugin_quagr.lock", "/tmp/dwm_plugin_quagr.fifo",
|
||||
"/tmp/dwm_plugin_quagr.daemon.pid"):
|
||||
if os.path.exists(p):
|
||||
os.unlink(p)
|
||||
|
||||
|
||||
def test_cover_quagr_integration(cover_exe: pathlib.Path, root: pathlib.Path):
|
||||
cov_dir = root / "cover-test"
|
||||
cov_dir.mkdir()
|
||||
cov = CoverHarness(cov_dir, cover_exe)
|
||||
try:
|
||||
# Start closed and dark
|
||||
cov.set_lid("closed")
|
||||
assert wait_for(lambda: cov.status().get("visible") == "0")
|
||||
assert cov.backlight_value() == "0"
|
||||
|
||||
# Full 30-byte ASCII message with punctuation
|
||||
msg = "Meet @ gate #4 = 19:30! [OK!!]"
|
||||
assert len(msg.encode("utf-8")) == 30
|
||||
cov.send("QUAGR " + msg)
|
||||
assert wait_for(lambda: cov.status().get("visible") == "1")
|
||||
st = cov.status()
|
||||
assert st.get("quagr") == "1", st
|
||||
assert cov.backlight_value() == "160"
|
||||
rows = cov.frame_nonzero_rows()
|
||||
# Header (~y 0..30), timestamp (~y 38..45), wrapped message (~y 60..170), footer (~y 222)
|
||||
msg_rows = [y for y in rows if 58 <= y <= 185]
|
||||
assert len(msg_rows) >= 24, f"expected multi-line message rows on cover, got {msg_rows}"
|
||||
|
||||
# Concurrent NOTIFY Notification from sxmo_hook_notification.sh + waiting
|
||||
# past wake_blank_timeout=1 must NOT cancel or auto-blank the Quagr alert
|
||||
cov.send("NOTIFY Notification")
|
||||
time.sleep(1.35)
|
||||
st = cov.status()
|
||||
assert st.get("visible") == "1" and st.get("quagr") == "1", st
|
||||
assert cov.backlight_value() == "160"
|
||||
|
||||
# Dismiss with BUTTON VOLUP + trailing WAKE race -> must blank & clear
|
||||
cov.send("BUTTON VOLUP")
|
||||
time.sleep(0.03)
|
||||
cov.send("WAKE")
|
||||
assert wait_for(lambda: cov.status().get("visible") == "0" and
|
||||
cov.status().get("quagr") == "0")
|
||||
assert cov.backlight_value() == "0"
|
||||
time.sleep(0.2)
|
||||
assert cov.status().get("visible") == "0", "trailing WAKE should stay dismissed"
|
||||
|
||||
# Dismiss with BUTTON VOLDOWN
|
||||
cov.send("QUAGR Second page & test $42!")
|
||||
assert wait_for(lambda: cov.status().get("quagr") == "1" and
|
||||
cov.status().get("visible") == "1")
|
||||
cov.send("BUTTON VOLDOWN")
|
||||
assert wait_for(lambda: cov.status().get("visible") == "0" and
|
||||
cov.status().get("quagr") == "0")
|
||||
|
||||
# Dismiss with BUTTON POWER without spawning hangup-call
|
||||
cov.send("QUAGR Power key dismiss check")
|
||||
assert wait_for(lambda: cov.status().get("quagr") == "1" and
|
||||
cov.status().get("visible") == "1")
|
||||
cov.send("BUTTON POWER")
|
||||
assert wait_for(lambda: cov.status().get("visible") == "0" and
|
||||
cov.status().get("quagr") == "0")
|
||||
time.sleep(0.15)
|
||||
assert "hangup-call" not in cov.events(), f"unexpected call event: {cov.events()}"
|
||||
|
||||
# Opening flip clears quagr alert so next close + button shows normal clock
|
||||
cov.send("QUAGR Clear on flip open")
|
||||
assert wait_for(lambda: cov.status().get("quagr") == "1")
|
||||
cov.set_lid("open")
|
||||
assert wait_for(lambda: cov.status().get("visible") == "0" and
|
||||
cov.status().get("quagr") == "0")
|
||||
cov.set_lid("closed")
|
||||
cov.send("BUTTON VOLUP")
|
||||
assert wait_for(lambda: cov.status().get("visible") == "1")
|
||||
assert cov.status().get("quagr") == "0"
|
||||
|
||||
# Incoming phone call still takes side-button priority over held Quagr alert
|
||||
cov.send("QUAGR Behind incoming call")
|
||||
cov.send("CALL incoming|+1234567|Alice|SIM1")
|
||||
assert wait_for(lambda: cov.status().get("call") == "incoming" and
|
||||
cov.status().get("quagr") == "1")
|
||||
cov.send("BUTTON VOLUP")
|
||||
assert wait_for(lambda: cov.status().get("call") == "muted")
|
||||
assert wait_for(lambda: "mute-ring" in cov.events())
|
||||
print("[ok] closed-flip cover wakes on QUAGR, holds full message, and dismisses on any side button")
|
||||
finally:
|
||||
cov.close()
|
||||
|
||||
|
||||
def main():
|
||||
if not QUAGR_CPP.is_file() or not COVER_C.is_file():
|
||||
sys.stderr.write("FAIL: missing quagr_plugin.cpp or bananarchy-cover-idle.c\n")
|
||||
return 1
|
||||
with tempfile.TemporaryDirectory(prefix="bananarchy-quagr-test-") as tmp:
|
||||
root = pathlib.Path(tmp)
|
||||
so_path, runner_path, cover_exe = build_host_binaries(root)
|
||||
|
||||
test_init_and_autostart_gating(so_path, runner_path, root)
|
||||
|
||||
run_preload_stream_case(
|
||||
so_path, runner_path, root / "case-pass",
|
||||
rx_mode="pass", rx_secret="bananarchy-test-pass",
|
||||
decrypt_key=derive_quagr_pass_key("bananarchy-test-pass"),
|
||||
message="Meet @ gate #4 = 19:30! [OK!!]",
|
||||
)
|
||||
print("[ok] --preload chunked stream + passphrase Rx + notif + cover dgram")
|
||||
|
||||
hex_key_str = "00112233445566778899aabbccddeeff" * 2
|
||||
run_preload_stream_case(
|
||||
so_path, runner_path, root / "case-hex",
|
||||
rx_mode="hex", rx_secret=hex_key_str,
|
||||
decrypt_key=bytes.fromhex(hex_key_str),
|
||||
message="Привет #7: OK!",
|
||||
)
|
||||
print("[ok] --preload raw 64-hex Rx key + UTF-8 decryption + notif + cover dgram")
|
||||
|
||||
test_cover_quagr_integration(cover_exe, root)
|
||||
print("quagr integration tests: all checks passed")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -303,6 +303,13 @@ static const struct glyph font[] = {
|
||||
{'!', {0x00, 0x00, 0x5f, 0x00, 0x00}}, {'?', {0x02, 0x01, 0x51, 0x09, 0x06}},
|
||||
{'_', {0x40, 0x40, 0x40, 0x40, 0x40}}, {'[', {0x00, 0x7f, 0x41, 0x41, 0x00}},
|
||||
{']', {0x00, 0x41, 0x41, 0x7f, 0x00}}, {'\'', {0x00, 0x05, 0x03, 0x00, 0x00}},
|
||||
{'@', {0x32, 0x49, 0x79, 0x41, 0x3e}}, {'$', {0x24, 0x2a, 0x7f, 0x2a, 0x12}},
|
||||
{'&', {0x36, 0x49, 0x55, 0x22, 0x50}}, {'=', {0x14, 0x14, 0x14, 0x14, 0x14}},
|
||||
{'"', {0x00, 0x07, 0x00, 0x07, 0x00}}, {';', {0x00, 0x56, 0x36, 0x00, 0x00}},
|
||||
{'<', {0x08, 0x14, 0x22, 0x41, 0x00}}, {'>', {0x00, 0x41, 0x22, 0x14, 0x08}},
|
||||
{'~', {0x08, 0x04, 0x08, 0x10, 0x08}}, {'^', {0x04, 0x02, 0x01, 0x02, 0x04}},
|
||||
{'`', {0x00, 0x01, 0x02, 0x04, 0x00}}, {'\\', {0x02, 0x04, 0x08, 0x10, 0x20}},
|
||||
{'{', {0x00, 0x08, 0x36, 0x41, 0x00}}, {'}', {0x00, 0x41, 0x36, 0x08, 0x00}},
|
||||
{' ', {0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
};
|
||||
|
||||
@@ -515,6 +522,73 @@ static void draw_fit_centered(struct frame *fb, const char *text, int y,
|
||||
frame_text_centered(fb, buf, y, scale, color);
|
||||
}
|
||||
|
||||
static void draw_wrapped_centered(struct frame *fb, const char *text,
|
||||
int area_top, int area_bottom,
|
||||
int pref_scale, uint32_t color)
|
||||
{
|
||||
char clean[192];
|
||||
char lines[6][48];
|
||||
int scale = pref_scale > 0 ? pref_scale : 2;
|
||||
int max_lines;
|
||||
int line_count = 0;
|
||||
int i;
|
||||
if(!text || !*text)
|
||||
return;
|
||||
sanitize_cover_text(text, clean, sizeof(clean));
|
||||
if(!clean[0])
|
||||
return;
|
||||
for(;; scale = 1) {
|
||||
int max_chars = ((int)fb->width - 16) / (6 * scale);
|
||||
int row_h = 7 * scale + (scale > 1 ? 8 : 5);
|
||||
const char *p = clean;
|
||||
if(max_chars < 1)
|
||||
max_chars = 1;
|
||||
if(max_chars >= (int)sizeof(lines[0]))
|
||||
max_chars = (int)sizeof(lines[0]) - 1;
|
||||
max_lines = (area_bottom - area_top) / row_h;
|
||||
if(max_lines < 1)
|
||||
max_lines = 1;
|
||||
if(max_lines > 6)
|
||||
max_lines = 6;
|
||||
line_count = 0;
|
||||
while(*p && line_count < max_lines) {
|
||||
int rem = (int)strlen(p);
|
||||
int take = rem <= max_chars ? rem : max_chars;
|
||||
if(rem > max_chars) {
|
||||
int sp = -1;
|
||||
int k;
|
||||
for(k = take; k > 0; k--) {
|
||||
if(p[k] == ' ') {
|
||||
sp = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sp > 0)
|
||||
take = sp;
|
||||
}
|
||||
memcpy(lines[line_count], p, (size_t)take);
|
||||
lines[line_count][take] = '\0';
|
||||
while(take > 0 && lines[line_count][take - 1] == ' ')
|
||||
lines[line_count][--take] = '\0';
|
||||
line_count++;
|
||||
p += take;
|
||||
while(*p == ' ')
|
||||
p++;
|
||||
}
|
||||
if(*p == '\0' || scale <= 1)
|
||||
break;
|
||||
}
|
||||
{
|
||||
int row_h = 7 * scale + (scale > 1 ? 8 : 5);
|
||||
int total_h = line_count * row_h - (scale > 1 ? 8 : 5);
|
||||
int start_y = area_top + ((area_bottom - area_top) - total_h) / 2;
|
||||
if(start_y < area_top)
|
||||
start_y = area_top;
|
||||
for(i = 0; i < line_count; i++)
|
||||
frame_text_centered(fb, lines[i], start_y + i * row_h, scale, color);
|
||||
}
|
||||
}
|
||||
|
||||
static int read_uint_file(const char *path, unsigned int *value)
|
||||
{
|
||||
FILE *handle = fopen(path, "r");
|
||||
@@ -603,6 +677,9 @@ struct state {
|
||||
char call_sim[16];
|
||||
char message[128];
|
||||
char network[96];
|
||||
int quagr_active;
|
||||
char quagr_msg[128];
|
||||
char quagr_time[16];
|
||||
int enabled;
|
||||
int battery;
|
||||
int sms;
|
||||
@@ -610,6 +687,7 @@ struct state {
|
||||
int visible;
|
||||
long long last_input_ms;
|
||||
long long closed_since_ms;
|
||||
long long quagr_dismissed_ms;
|
||||
long long blank_ms;
|
||||
long long wake_blank_ms;
|
||||
int wake_capped;
|
||||
@@ -618,12 +696,17 @@ struct state {
|
||||
int backlight_level;
|
||||
};
|
||||
|
||||
static int cover_hold_awake(const struct state *state)
|
||||
static int call_hold_awake(const struct state *state)
|
||||
{
|
||||
return strcmp(state->call, "incoming") == 0 ||
|
||||
strcmp(state->call, "muted") == 0;
|
||||
}
|
||||
|
||||
static int cover_hold_awake(const struct state *state)
|
||||
{
|
||||
return call_hold_awake(state) || state->quagr_active;
|
||||
}
|
||||
|
||||
/* A lit cover needs a lit framebuffer, a lit backlight and an unblanked fbdev;
|
||||
* everything else is "fully off". TEST modes are diagnostic overrides. */
|
||||
static int cover_is_lit(const struct state *state)
|
||||
@@ -684,7 +767,7 @@ static void render_frame(struct frame *fb, const struct state *state)
|
||||
rgb888(245, 245, 245));
|
||||
} else if(!cover_is_lit(state)) {
|
||||
frame_rect(fb, 0, 0, (int)width, (int)height, rgb888(0, 0, 0));
|
||||
} else if(cover_hold_awake(state)) {
|
||||
} else if(call_hold_awake(state)) {
|
||||
int muted = strcmp(state->call, "muted") == 0;
|
||||
char subhdr[48];
|
||||
char name_san[64];
|
||||
@@ -720,6 +803,22 @@ static void render_frame(struct frame *fb, const struct state *state)
|
||||
(int)height - 34, 1, rgb888(250, 210, 60));
|
||||
frame_text_centered(fb, "PWR: HANG UP",
|
||||
(int)height - 18, 1, rgb888(255, 110, 110));
|
||||
} else if(state->quagr_active) {
|
||||
uint32_t accent = rgb888(0, 220, 245);
|
||||
frame_rect(fb, 0, 0, (int)width, (int)height, rgb888(8, 12, 26));
|
||||
frame_rect(fb, 0, 0, (int)width, 4, accent);
|
||||
frame_text_centered(fb, "QUAGR PAGE", 16, 2, accent);
|
||||
frame_text_centered(fb, state->quagr_time[0] ? state->quagr_time : clock,
|
||||
38, 1, rgb888(140, 180, 240));
|
||||
draw_wrapped_centered(fb, state->quagr_msg, 58, (int)height - 48,
|
||||
2, rgb888(245, 248, 255));
|
||||
if(state->battery >= 0) {
|
||||
snprintf(battery, sizeof(battery), "BAT %d%%", state->battery);
|
||||
frame_text_centered(fb, battery, (int)height - 34, 1,
|
||||
rgb888(250, 210, 60));
|
||||
}
|
||||
frame_text_centered(fb, "ANY KEY: DISMISS",
|
||||
(int)height - 18, 1, rgb888(250, 210, 60));
|
||||
} else {
|
||||
int clock_scale = width >= 220 ? 5 : 3;
|
||||
int clock_h = 7 * clock_scale;
|
||||
@@ -2394,7 +2493,7 @@ static void cover_wake(struct state *state, int *redraw)
|
||||
refresh_blank_timeout(state);
|
||||
if(strcmp(state->lid, "closed") == 0 && state->enabled && !state->test) {
|
||||
state->visible = 1;
|
||||
state->wake_capped = 1;
|
||||
state->wake_capped = cover_hold_awake(state) ? 0 : 1;
|
||||
state->last_input_ms = now_ms();
|
||||
*redraw = 1;
|
||||
}
|
||||
@@ -2455,6 +2554,11 @@ static void handle_command(char *buffer, struct state *state,
|
||||
state->wake_capped = 0;
|
||||
state->last_input_ms = now;
|
||||
state->closed_since_ms = new_closed ? now : 0;
|
||||
if(!new_closed) {
|
||||
state->quagr_active = 0;
|
||||
state->quagr_msg[0] = '\0';
|
||||
state->quagr_time[0] = '\0';
|
||||
}
|
||||
*redraw = 1;
|
||||
}
|
||||
} else if(strcmp(command, "BUTTON") == 0 ||
|
||||
@@ -2463,13 +2567,19 @@ static void handle_command(char *buffer, struct state *state,
|
||||
/* Trusted external side button, or a main-panel wake request that the
|
||||
* closed-lid gate forwarded to the cover display. Ignore WAKE (never
|
||||
* BUTTON) during the 450 ms close-settle window so dwm's spurious
|
||||
* SW_KEYPAD_SLIDE wake on close does not light the cover by itself. */
|
||||
if(!hw->sim && strcmp(command, "WAKE") == 0 &&
|
||||
state->closed_since_ms > 0 &&
|
||||
now_ms() - state->closed_since_ms < 450)
|
||||
* SW_KEYPAD_SLIDE wake on close does not light the cover by itself, or
|
||||
* right after dismissing a held Quagr page. */
|
||||
if(strcmp(command, "WAKE") == 0) {
|
||||
long long now = now_ms();
|
||||
if(!hw->sim && state->closed_since_ms > 0 &&
|
||||
now - state->closed_since_ms < 450)
|
||||
return;
|
||||
if(strcmp(command, "BUTTON") == 0 && sub &&
|
||||
strcmp(state->lid, "closed") == 0 && cover_hold_awake(state)) {
|
||||
if(state->quagr_dismissed_ms > 0 &&
|
||||
now - state->quagr_dismissed_ms < 600)
|
||||
return;
|
||||
}
|
||||
if(strcmp(command, "BUTTON") == 0 && strcmp(state->lid, "closed") == 0) {
|
||||
if(sub && call_hold_awake(state)) {
|
||||
upper_string(sub);
|
||||
if(strcmp(sub, "VOLUP") == 0 || strcmp(sub, "VOLDOWN") == 0) {
|
||||
if(strcmp(state->call, "incoming") == 0) {
|
||||
@@ -2490,8 +2600,51 @@ static void handle_command(char *buffer, struct state *state,
|
||||
*redraw = 1;
|
||||
return;
|
||||
}
|
||||
} else if(state->quagr_active) {
|
||||
state->quagr_active = 0;
|
||||
state->quagr_msg[0] = '\0';
|
||||
state->quagr_time[0] = '\0';
|
||||
state->quagr_dismissed_ms = now_ms();
|
||||
state->visible = 0;
|
||||
state->wake_capped = 0;
|
||||
*redraw = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
cover_wake(state, redraw);
|
||||
} else if(strcmp(command, "QUAGR") == 0) {
|
||||
char *rest = save;
|
||||
while(rest && (*rest == ' ' || *rest == '\t'))
|
||||
rest++;
|
||||
if(!rest || !*rest) {
|
||||
state->quagr_active = 0;
|
||||
state->quagr_msg[0] = '\0';
|
||||
state->quagr_time[0] = '\0';
|
||||
if(state->visible)
|
||||
*redraw = 1;
|
||||
} else {
|
||||
time_t now_t;
|
||||
struct tm tm_now;
|
||||
ba_refresh_tz();
|
||||
now_t = time(NULL);
|
||||
localtime_r(&now_t, &tm_now);
|
||||
strftime(state->quagr_time, sizeof(state->quagr_time), "%H:%M", &tm_now);
|
||||
safe_copy(state->quagr_msg, sizeof(state->quagr_msg), rest);
|
||||
trim(state->quagr_msg);
|
||||
if(state->quagr_msg[0]) {
|
||||
state->quagr_active = 1;
|
||||
state->quagr_dismissed_ms = 0;
|
||||
cover_wake(state, redraw);
|
||||
if(state->visible)
|
||||
*redraw = 1;
|
||||
}
|
||||
}
|
||||
} else if(strcmp(command, "QUAGR_CLEAR") == 0) {
|
||||
state->quagr_active = 0;
|
||||
state->quagr_msg[0] = '\0';
|
||||
state->quagr_time[0] = '\0';
|
||||
if(state->visible)
|
||||
*redraw = 1;
|
||||
} else if(strcmp(command, "NETWORK") == 0) {
|
||||
char *rest = save;
|
||||
while(rest && (*rest == ' ' || *rest == '\t'))
|
||||
@@ -2774,11 +2927,11 @@ static void reply_for(char *buffer, const struct state *state,
|
||||
snprintf(reply, len,
|
||||
"OK lid=%s backend=%s enabled=%d visible=%d blank_ms=%lld "
|
||||
"battery=%d call=%s sms=%d network=%s spi=%d mux=%s "
|
||||
"bits=%d probe=%s\n",
|
||||
"bits=%d quagr=%d probe=%s\n",
|
||||
state->lid, state->backend, state->enabled, state->visible,
|
||||
state->blank_ms, state->battery, state->call, state->sms,
|
||||
state->network, hw->spi_enabled, mux,
|
||||
hw->word_bits, hw->probe_desc);
|
||||
hw->word_bits, state->quagr_active, hw->probe_desc);
|
||||
} else if(strcmp(command, "LID") == 0) {
|
||||
snprintf(reply, len, "OK lid=%s\n", state->lid);
|
||||
} else if(strcmp(command, "TEST") == 0) {
|
||||
|
||||
@@ -332,6 +332,9 @@ static const char *resolve_plugin_name_from_argv0(const char *argv0) {
|
||||
if (strcasecmp(base, "xprivacy") == 0 || strcasecmp(base, "privacy") == 0) {
|
||||
return "privacy";
|
||||
}
|
||||
if (strcasecmp(base, "xquagr") == 0 || strcasecmp(base, "quagr") == 0) {
|
||||
return "quagr";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -430,7 +433,8 @@ int main(int argc, char **argv) {
|
||||
strcmp(plugin_name, "irc") == 0 ||
|
||||
strcmp(plugin_name, "sip") == 0 ||
|
||||
strcmp(plugin_name, "engmenu") == 0 ||
|
||||
strcmp(plugin_name, "privacy") == 0)) {
|
||||
strcmp(plugin_name, "privacy") == 0 ||
|
||||
strcmp(plugin_name, "quagr") == 0)) {
|
||||
const char *a1 = (sub_argc >= 2 && sub_argv[1]) ? sub_argv[1] : "";
|
||||
if (strcmp(a1, "--preload") != 0 && strcmp(a1, "close") != 0) {
|
||||
return 1;
|
||||
|
||||
@@ -2080,6 +2080,7 @@ inline void closeOtherPlugins(const char* selfPluginName,
|
||||
{"xpasscode.pid", "passcode"},
|
||||
{"xengmenu.pid", "engmenu"},
|
||||
{"xprivacy.pid", "privacy"},
|
||||
{"xquagr.pid", "quagr"},
|
||||
};
|
||||
for (const auto& p : kAllPlugins) {
|
||||
if ((selfPluginName && std::strcmp(p.name, selfPluginName) == 0) ||
|
||||
@@ -2135,6 +2136,7 @@ inline bool isAnotherPluginActive(const char* selfPluginName) {
|
||||
{"xpasscode.pid", "passcode"},
|
||||
{"xengmenu.pid", "engmenu"},
|
||||
{"xprivacy.pid", "privacy"},
|
||||
{"xquagr.pid", "quagr"},
|
||||
};
|
||||
for (const auto& p : kAllPlugins) {
|
||||
if (selfPluginName && std::strcmp(p.name, selfPluginName) == 0) {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+14
-2
@@ -981,7 +981,8 @@ trigger_plugin_open(const char *plugin_spec)
|
||||
strcmp(plugin_name, "irc") == 0 ||
|
||||
strcmp(plugin_name, "sip") == 0 ||
|
||||
strcmp(plugin_name, "engmenu") == 0 ||
|
||||
strcmp(plugin_name, "privacy") == 0)) {
|
||||
strcmp(plugin_name, "privacy") == 0 ||
|
||||
strcmp(plugin_name, "quagr") == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2406,9 +2407,11 @@ add_parsed_choice_line(const char *line)
|
||||
if (access("/tmp/bananarchy_duress_mode", F_OK) == 0) {
|
||||
if (strstr(label, "Bantam") || strstr(label, "SIP") ||
|
||||
strstr(label, "IRC") || strstr(label, "Tox") ||
|
||||
strstr(label, "Quagr") ||
|
||||
strstr(label, "Passcode") || strstr(label, "Terminal") ||
|
||||
strstr(cmd, "xsip") || strstr(cmd, "xirc") ||
|
||||
strstr(cmd, "xtox") || strstr(cmd, "xpasscode") ||
|
||||
strstr(cmd, "xtox") || strstr(cmd, "xquagr") ||
|
||||
strstr(cmd, "xpasscode") ||
|
||||
strstr(cmd, "sxmo_terminal.sh") || strncmp(cmd, "st ", 3) == 0 ||
|
||||
strcmp(cmd, "st") == 0)
|
||||
return;
|
||||
@@ -2434,6 +2437,8 @@ add_parsed_choice_line(const char *line)
|
||||
return;
|
||||
if (items[i].text && strstr(label, "Tox Messenger") && strstr(items[i].text, "Tox Messenger"))
|
||||
return;
|
||||
if (items[i].text && strstr(label, "Quagr") && strstr(items[i].text, "Quagr"))
|
||||
return;
|
||||
if (items[i].text && strstr(label, "Kopher") && strstr(items[i].text, "Kopher"))
|
||||
return;
|
||||
if (items[i].text && strstr(label, "GPS & Maps") && strstr(items[i].text, "GPS & Maps"))
|
||||
@@ -2798,6 +2803,9 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
|
||||
snprintf(label, sizeof(label), "%s Tox Messenger", ICON_MSG);
|
||||
add_menu_item(label, "@plugin:tox", 0);
|
||||
|
||||
snprintf(label, sizeof(label), "%s Quagr Pager", ICON_BEL);
|
||||
add_menu_item(label, "@plugin:quagr", 0);
|
||||
}
|
||||
|
||||
snprintf(label, sizeof(label), "%s Webarchy Browser", ICON_GLB);
|
||||
@@ -2887,6 +2895,8 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
add_menu_item(label, "@plugin:irc", 0);
|
||||
snprintf(label, sizeof(label), "%s Tox Messenger", ICON_MSG);
|
||||
add_menu_item(label, "@plugin:tox", 0);
|
||||
snprintf(label, sizeof(label), "%s Quagr Pager", ICON_BEL);
|
||||
add_menu_item(label, "@plugin:quagr", 0);
|
||||
snprintf(label, sizeof(label), "%s Privacy Center", ICON_SHD);
|
||||
add_menu_item(label, "@plugin:privacy", 0);
|
||||
}
|
||||
@@ -3359,6 +3369,7 @@ any_other_plugin_active(void)
|
||||
"xpasscode.pid",
|
||||
"xengmenu.pid",
|
||||
"xprivacy.pid",
|
||||
"xquagr.pid",
|
||||
};
|
||||
const char *rdir = getenv("XDG_RUNTIME_DIR");
|
||||
const char *base = (rdir && rdir[0]) ? rdir : "/run/user/10000";
|
||||
@@ -3413,6 +3424,7 @@ close_other_active_plugins(void)
|
||||
{ "xpasscode.pid", "/tmp/dwm_plugin_passcode.fifo" },
|
||||
{ "xengmenu.pid", "/tmp/dwm_plugin_engmenu.fifo" },
|
||||
{ "xprivacy.pid", "/tmp/dwm_plugin_privacy.fifo" },
|
||||
{ "xquagr.pid", "/tmp/dwm_plugin_quagr.fifo" },
|
||||
};
|
||||
const char *rdir = getenv("XDG_RUNTIME_DIR");
|
||||
const char *base = (rdir && rdir[0]) ? rdir : "/run/user/10000";
|
||||
|
||||
@@ -1102,6 +1102,7 @@ static int xdrawer_run_main(int argc, char** argv) {
|
||||
"xthemes.pid", "xmodem.pid", "xnetworks.pid", "xringtones.pid",
|
||||
"xwallpapers.pid", "xmusic.pid", "xsip.pid", "xemail.pid",
|
||||
"xirc.pid", "xtox.pid", "xsmallweb.pid", "xwebarchy.pid", "xgps.pid",
|
||||
"xquagr.pid",
|
||||
};
|
||||
for (const char* pf : kPids) {
|
||||
int p = readIntFile(getRuntimeFile(pf), -1);
|
||||
@@ -1140,6 +1141,7 @@ static int xdrawer_run_main(int argc, char** argv) {
|
||||
closeOtherPlugin("xsmallweb.pid", "/tmp/dwm_plugin_smallweb.fifo");
|
||||
closeOtherPlugin("xwebarchy.pid", "/tmp/dwm_plugin_webarchy.fifo");
|
||||
closeOtherPlugin("xgps.pid", "/tmp/dwm_plugin_gps.fifo");
|
||||
closeOtherPlugin("xquagr.pid", "/tmp/dwm_plugin_quagr.fifo");
|
||||
if (::access("/tmp/dwm_plugin_dmenu.active", F_OK) == 0) {
|
||||
int dfd = ::open("/tmp/dwm_plugin_dmenu.fifo", O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
if (dfd >= 0) {
|
||||
|
||||
Reference in new issue
Block a user