Files
chandra/docs/handset.md
T
nandiandClaude Opus 5.5 019c9ada6c
CI / test (push) Failing after 49s
Camera: cut viewfinder CPU use
- Decode half-size frames at 24 fps (15 on the raw front camera) for the viewfinder; full frames only for photos, video, focusing and QR scans
- Swap channels with OpenCV instead of numpy; 2 OpenCV threads for live frames; OpenMP threads sleep when idle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 01:14:29 -08:00

10 KiB
Raw Blame History

Handset & Touch Support

Chandra includes KMS/libinput/compositor adaptations tailored for mainline Linux smartphones (verified on OnePlus 6T oneplus,fajita at 1080x2340).

Display Scaling (CHANDRA_SCALE)

  • Integer scaling lives in compositor/kms/kms_stub.c.
  • Setting CHANDRA_SCALE=N (or the default automatic 2x scaling on dense portrait phone panels such as 1080x2340) runs the compositor at a legible 540x1170 logical resolution while presenting Nx nearest pixels to hardware dumb buffers and cursor planes.

Icon Desktop & Compact Panel

  • Icon desktop default: Portrait handset layouts prioritize the touch-friendly icon desktop launcher aesthetic.
  • Compact panel layout: Panel items (launcher, dock, session-settings, network, battery, clock-digital, screenshot) size compactly so all controls fit cleanly within 540px portrait width without clipping, with fuel-gauge support (e.g. bq27411-0).

Touch Input & On-Screen Keyboard

  • Long-press right-click: In compositor/kms/kms_stub.c, a stationary touch held for 500 ms converts to a synthetic right-click (BTN_RIGHT) via a timerfd, allowing context menus and secondary actions without a mouse.
  • Built-in OSK: compositor/host/osk.mbt provides a 5-row virtual keyboard that opens automatically when Wayland text input (zwp_text_input_v3) gains focus and can also be toggled manually from the bottom-right KB pill. It sits directly above the panel, so the panel stays visible and usable while typing (a strict kiosk has no panel: there it reaches the bottom edge).

Display Rotation, Flip, and Auto-Rotate

  • 4-way transform (0°, 90° CW, 180°, 270° CW): Handled end-to-end across compositor/kms/kms_stub.c, wit/host/display.wit, wasmhost/bin/display.mbt, and the compositor event loop (CHANDRA_ROTATE sets the initial orientation). Both scanout rows and libinput touch/pointer coordinates transform to match the active orientation.
  • Touch Rot pill: Sitting left of the KB pill in compositor/host/osk.mbt:
    • Tap: rotate 90° clockwise (0 -> 90 -> 180 -> 270 -> 0).
    • Long-press / right-click: flip 180° (0 <-> 180, 90 <-> 270).
  • CLI control: chandra-ctl rotate [cw|ccw|flip|0|90|180|270|status] queries or changes rotation live (0 portrait, 90 / 270 landscape, 180 inverted).
  • Sensor auto-rotate: When running on the DRM backend (chandra-session) with monitor-sensor (iio-sensor-proxy) installed, session/chandra-auto-rotate runs inside the active seat0 session and applies orientation change events (normal -> 0, right-up -> 90, bottom-up -> 180, left-up -> 270) without fighting manual Rot taps while stationary. Set CHANDRA_AUTO_ROTATE=0 in the session environment to disable auto-rotate.

Client-Side Window Controls (Chromium / GTK)

  • compositor/wayland/server.mbt emits xdg_toplevel.wm_capabilities (window_menu, maximize, fullscreen, minimize) for xdg_wm_base v5+ clients so client-decorated apps expose Maximize alongside Close.
  • On GTK/Chromium setups where GNOME defaults (org.gnome.desktop.wm.preferences button-layout) omit maximize/minimize (e.g. 'appmenu:close'), configure GTK and gsettings:
    • ~/.config/gtk-3.0/settings.ini and ~/.config/gtk-4.0/settings.ini: gtk-decoration-layout=:minimize,maximize,close
    • gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'

Keyring Unlock

  • session/chandra-session starts gnome-keyring-daemon --start --components=secrets and unlocks an unencrypted default login.keyring at login over D-Bus (org.freedesktop.Secret.Service.Unlock) so apps such as Chromium store credentials without blocking prompts.

Power Button & Brightness

  • Power key blank/wake: Pressing KEY_POWER (116) in compositor/host/compositor.mbt toggles manual screen blanking (DPMS off/on + touch cancellation in compositor/kms/kms_stub.c) while ignoring stray touches during blanking. Also controllable via chandra-ctl screen [on|off|toggle|status]. (Set HandlePowerKey=ignore in /etc/systemd/logind.conf.d/ so logind does not power off immediately.)
  • Settings Brightness slider: compositor/shell/backlight.mbt reads /sys/class/backlight/ (ae94000.dsi.0, CHANDRA_BACKLIGHT override) and writes changes via sysfs or org.freedesktop.login1.Session.SetBrightness. When a backlight device exists, Settings > Power > Brightness shows a - / slider / + control (5%..100%), also accessible via chandra-ctl brightness [PCT|status].

Audio & Volume Buttons

  • Audio stack (PipeWire + WirePlumber + OnePlus 6T UCM2): pipewire, wireplumber, pipewire-pulse, and pipewire-alsa drive the OnePlus 6T (fajita) ALSA UCM2 HiFi profile (Speaker, Headphones, Mic1/Mic2, Headset), with Qualcomm buffer tuning from 51-qcom.conf.
  • Hardware volume keys: compositor/host/volume.mbt binds VolumeUp (KEY_VOLUMEUP / 115), VolumeDown (KEY_VOLUMEDOWN / 114), and Mute (KEY_MUTE / 113) in compositor/shell/shortcuts.mbt to async wpctl (with pactl fallback) commands:
    • 5% step per press, unmuting on volume up and capping hardware button increases at 100%.
    • Hold-to-repeat after 400 ms (90 ms cadence) until key release.
    • Works while the display is blanked (screen_off / manual_screen_off) without waking the screen.
    • Passes VolumeUp / VolumeDown straight through to chandra-camera when it is the active foreground window (with no modal/popup/modifier) so the hardware buttons keep acting as the camera shutter.
    • Shows a floating top-center Volume OSD pill (1.8 s) when the screen is on, and exposes chandra-ctl volume [up|down|mute|unmute|toggle|PCT|status].
  • Mixer GUI (moonmix): org.latha.moonmix provides a GTK4 + libwireplumber volume mixer (Playback, Recording, Output Devices, Input Devices) integrated into the launcher.

Face Unlock (libcamera)

  • On phones whose MIPI sensors (imx371, imx519, imx376) require libcamera SoftISP rather than raw V4L2 nodes, face/chandra-face supports libcamera:<camera-id> entries via python-libcamera and applies libcamera.properties.Rotation. face/install.py supports --system-python to run with system python-opencv + python-numpy on aarch64, and face/polkit-agent-helper.conf grants char-video4linux, char-media, and char-dma_heap access to polkit's helper sandbox.

Camera App (chandra-camera)

  • camera/chandra-camera, camera/chandra-camera-ui.c, and camera/chandra-camera-isp.c provide a native GTK3/Cairo Wayland camera app with a C/OpenMP Quad-Bayer ISP library (libchandra-camera-isp.so) installed via session/install.py with its desktop launcher and icon (Camera).
  • Heat: the viewfinder decodes half-size frames at 24 fps (15 on the raw front camera); photos, video, focusing and QR scans take full frames (CameraEngine.grab_full_frame).
  • QR scanner: in photo mode the camera reads QR codes with OpenCV's own detectors about twice a second (the QR pill turns it off). A card shows the text with Open (web links), Join (WPA and open WIFI: codes, through NetworkManager) and Copy; nothing is opened or joined before a tap.
  • Supports multi-sensor libcamera discovery and live switching (Back · imx519, Front · imx371, Back 2 · imx376 on OnePlus 6T, with automatic V4L2 fallback on desktops), sensor orientation transform + front-camera mirror preview, libcamera SoftISP CCM tuning (camera/ipa/simple/*.yaml), VCM contrast autofocus with tap-to-focus (lc898217xc), Photo mode (HD instant / Full high-resolution StillCapture or 3-frame raw burst merge on Quad-Bayer, 0/3s/10s self-timer, 3×3 rule-of-thirds grid) saving JPEGs to ~/Pictures/Camera, Video mode recording exact-PTS VFR H.264 MP4s (MatroskaI420Muxer + ffmpeg) to ~/Videos/Camera, an in-app photo gallery viewer, rear flash/torch LED control (/sys/class/leds/white:flash) through org.freedesktop.login1.Session.SetBrightness, and hardware volume-button or Space/Return shutter control.

Remote Control Over Tailscale (chandra-remote)

  • remote/chandra-remote.c provides a zero-overhead shared-memory framebuffer mirror (fb.shm in wasmhost/bin/raster_stub.c) feeding both:
    • VNC (RFB 3.8, port 5900) with Tight-JPEG (libturbojpeg), Zlib, Raw, dynamic rotation resize (ExtendedDesktopSize), clipboard sync, and 1:1 pointer/touch/keyboard input (tested for Android AVNC).
    • Mobile Web UI / PWA (HTTP + WebSocket, port 6080) with 1:1 touch gestures (tap, drag, long-press right-click, two-finger scroll/right-click), optional trackpad mode, Android keyboard bridge, live rotation/brightness/OLED-off toggles, and adaptive JPEG streaming.
  • By default (~/.config/chandra/remote.conf), bind=tailscale, bind_loopback=1, and auth=none, binding strictly to the Tailscale 100.64.0.0/10 interface + 127.0.0.1 so any device on the same Tailscale tailnet can connect directly with zero password prompt (http://<tailscale-dns>:6080/ or <tailscale-dns>:5900), even while the handset's physical OLED screen is turned off (chandra-ctl screen off). Run chandra-remote status to inspect endpoints or chandra-remote passwd [PASS|--none] to configure optional password auth.