Input · input
Portal Input — Touch, Keyboard & Fusion Engine
Complete input pipeline for the Spaceboard: touch event normalization, multi-touch fusion engine (tracking → intent classification → action generation), QWERTY keyboard layout, and virtual keyboard/pointer via /dev/uinput. Includes portal-keyboardd, a standalone DRM/KMS binary that owns the eDP-1 display.
Architecture
Overview
portal-input is the input subsystem for the Spaceboard tactile surface. It implements the complete pipeline from raw touch events to virtual device output: touch events from the ELAN hid-over-i2c touchscreen are parsed via evdev Protocol B, normalized to [0,1] coordinates, fed into a fusion engine that tracks finger positions/velocities, classifies intent (Typing, Pointing, Gesture, or RestingPalm), and generates InputActions (KeyPress, PointerMove, Scroll, etc.). These actions are dispatched to virtual keyboard and pointer devices via /dev/uinput, which Wayfire sees as real input devices. The crate also includes portal-keyboardd, a standalone binary that directly owns the eDP-1 display via DRM/KMS dumb-buffer scanout, renders the QWERTY keyboard using Cairo/Pango, and handles the complete input loop without compositor involvement for the keyboard screen.
Key Types
Modules
touch
Touch event types and coordinate normalization — TouchEvent, TouchEventType, normalizer maps to [0,1].
keyboard
QWERTY keyboard layout with pixel-accurate key regions, key state management, VirtualKey enum.
fusion
Fusion engine — TouchTracker (position/velocity/distance), IntentClassifier (Typing/Pointing/Gesture/Palm rules), ActionGenerator.
gesture
Gesture recognition — multi-touch gesture detection (swipes, pinches, edge gestures).
haptic
Haptic feedback — vibration motor control for touch confirmation.
layout_engine
Layout engine — positions keyboard keys, calculates key regions for hit-testing.
output
Output handling — display surface management for keyboard rendering.
zones
Zone definitions — screen regions with different input behaviors (keyboard zone, trackpad zone, edges).
special_keys
Special key definitions — Backspace, Enter, Shift, Space, modifier combinations.
channels
Channel-based communication between input threads.
telemetry
Input telemetry — latency tracking, classification accuracy metrics.
thread_lifecycle
Thread lifecycle management — graceful shutdown of input processing threads.
Data Flow
ELAN touchscreen /dev/input/event2 → evdev Protocol B parsing → normalize to [0,1] → FusionEngine (tracker → classifier → actions) → VirtualKeyboard/Pointer → /dev/uinput → Wayfire (GLASSES-1). Keyboard rendering: Cairo/Pango → DRM dumb-buffer blit → eDP-1 scanout
Dependencies
External (17)
External: evdev/rustix (raw input), drm/gbm (direct display), cairo/pango (keyboard rendering), glow (GLES shaders, Orange Pi only). portal-keyboardd requires --features keyboardd.