Skip to content

Audio, Haptics, Sensors & Optics

Beyond compute and cameras, a Pixel phone packs studio-grade audio, calibrated MEMS sensors, a laser distance ranger, high-output dual-tone LEDs, precision LRA haptics, and physical buttons — all usable directly from standard Debian CLI tools.


Stereo Audio & MEMS Microphones (audio-ctl)

Section titled “Stereo Audio & MEMS Microphones (audio-ctl)”

Drives google,aoc-snd-card (dual Cirrus CS35L41 stereo speakers + 3× MEMS microphones over AoC DSP) via ALSA MMAP (aplay -M / arecord -M). Works without sudo for the default user (audio group). Always disables speaker amps and unroutes mixer paths on exit or SIGTERM so the CS35L41 amps return to hibernate.

Terminal window
# Detect ALSA card and stream counts
audio-ctl status --json
# Play an 880 Hz stereo test tone
audio-ctl tone --freq 880 --duration 0.5 --output stereo --gain 12
# Play a WAV/audio file (uses ffmpeg to resample if not 48 kHz 16-bit stereo)
audio-ctl play alert.wav --output bottom --gain 14 --volume 760
# Record 5 seconds from all 3 built-in MEMS microphones (48 kHz stereo)
audio-ctl record -o capture.wav --duration 5 --mics 0,1,2 --gain-db 6
# Acoustic speaker-to-mic self-test (verified 498.2x SNR at 880 Hz on raven)
audio-ctl loopback-test --freq 880 --gain 12 --json

Top-level option: --card <INT> (-1 = auto-detect google,aoc-snd-card).

Subcommand Flags & Defaults
status --json
play <file>, --output {stereo,top,bottom} (stereo), --gain 12 (0..20), --volume 760 (0..817, 817 = 0 dB)
tone --freq 880.0, --duration 0.5 ((0, 60]), --amplitude 0.25 ((0, 1]), --output stereo, --gain 12, --volume 760
record -o/--output <PATH> (required), --duration 5, --rate 48000, --channels {1,2} (2), --mics 0,1,2 (IDs 0..3), --gain-db 0 (-60..24)
loopback-test --freq 880.0, --gain 12, --json (exits 0 iff Goertzel SNR >= 3.0)

Controls the Cirrus Logic CS40L25A linear resonant actuator (/sys/class/leds/vibrator) with exclusive flock serialization (/run/headless-haptics.lock) and fail-safe activate=0 teardown on exit or SIGTERM.

Terminal window
# Inspect firmware version, wavetable count, and resonant frequency calibration (unprivileged)
haptics-ctl info --json
# Play a crisp preloaded ROM waveform (indices 1..num_waves-1; index 0 is reserved/continuous)
sudo haptics-ctl effect 1 --gain 25
# Timed buzz (milliseconds, 1..10000)
sudo haptics-ctl buzz --duration 120 --gain 60
# Built-in haptic patterns: click, double, triple, alert, heartbeat
sudo haptics-ctl pattern double --gain 70
# Custom on/off millisecond cadence (up to 32 segments)
sudo haptics-ctl pattern 40,80,40,80,150 --gain 80
# Emergency stop
sudo haptics-ctl stop

Top-level option: --led-dir <PATH> (default /sys/class/leds/vibrator). --gain accepts 1..100% (default 80).


Exposes all 38 Always-On Compute (AoC) Context Hub sensors (LSM6DSR IMU, ICP-10101 barometer, MMC56X3X magnetometer, TMD3719 ambient light/proximity, VD6282 rear light, IMU/baro temperatures, step counter, rotation vectors) via /dev/acd-com.google.usf and /run/headless-bionic.

Terminal window
# Check AoC USF driver binding & runtime readiness (unprivileged)
sensors-ctl status
# List all 38 sensors (handle, Android type ID, minDelay us, name)
sudo sensors-ctl list
# Take 3 samples across IMU, magnetometer, barometer, light, proximity, and temperatures
sudo sensors-ctl read \
--sensors accel,gyro,mag,baro,light,prox,imu_temp,baro_temp \
--samples 3 --rate 20
# Continuous NDJSON telemetry stream (press Ctrl+C to stop)
sudo sensors-ctl --json stream --sensors accel,gyro,baro --rate 10 --duration 30

Built-in --sensors aliases (or pass numeric handles, Android type IDs, name substrings, or all): accel, mag, orientation, gyro, light/als, baro/pressure, prox/proximity, gravity, linear_accel, rotation, game_rotation, step_detector, step_counter, tilt, imu_temp, baro_temp, rear_light.

Top-level options (must precede subcommand): --runtime-dir /run/headless-bionic, --lib-dir /usr/local/lib/headless-sensors, --json.

Subcommand Flags & Defaults
setup / teardown / status / list setup [--force]; status unprivileged
read --sensors accel,gyro,mag,baro,light,prox, --samples 3, --rate 20.0, --timeout 3.0
stream --sensors accel,gyro,baro, --rate 10.0, --duration 0.0 (infinite), --count 0 (infinite)

Drives the rear ST VL53L3 multi-object (up to 2 targets) 30 Hz laser Time-of-Flight sensor (/dev/ispolin_ranging1 + I2C 1-0029 stmvl53l1), reporting distance (mm), sigma, SPAD count, and signal/ambient MCPS. Automatically stops and powers down the laser on exit or SIGTERM.

Terminal window
# Check I2C binding and input event node (unprivileged)
tof-range info
# Take 5 millimeter distance readings (auto-binds stmvl53l1 unless --no-auto-bind)
sudo tof-range read --samples 5
sudo tof-range --json read --samples 10 --timeout 2.0
# Stream real-time distance readings as NDJSON
sudo tof-range --json stream --duration 10

Top-level options (must precede subcommand): --device /dev/ispolin_ranging1, --i2c-dev 1-0029, --no-auto-bind, --json.


Controls the TI LM3644 / LM3644TT dual-tone rear LED flash directly over /dev/lwis-flash-lm3644 LWIS ioctls (zero Android HAL). Closing the file descriptor immediately drops the LWIS power vote, providing fail-safe hardware shutoff even if the process crashes.

Terminal window
# Inspect chip ID (LM3644 / LM3644TT) and hardware fault flags
sudo flashlight info
# Turn on both LEDs at 20% brightness for 5 seconds
sudo flashlight on --brightness 20 --duration 5
# Independently control warm/cool LED channels (0..100%) and daemonize until `off`
sudo flashlight on --led1 40 --led2 15 --duration 0 --daemon
sudo flashlight off
# Status indicator blink pattern
sudo flashlight blink --count 4 --on-ms 120 --off-ms 120 --brightness 30

Top-level options (must precede subcommand): --device /dev/lwis-flash-lm3644, --pidfile /run/headless-torch.pid, --json.


Monitors the physical Power, Volume Up, and Volume Down buttons (gpio_keys evdev), automatically classifying short_press vs. long_press (--long-press-ms 1000 default) and ignoring kernel autorepeat. Ideal for triggering custom local actions (e.g., blinking status LEDs, triggering snapshots, or safe shutdown).

Terminal window
# Verify gpio_keys evdev node (unprivileged)
hw-buttons info
# Watch all press/release events (requires sudo unless user is in `input` group)
sudo hw-buttons watch
sudo hw-buttons --json watch --duration 60
# Block in a shell script until Power or Vol+ is pressed (exit 0 = pressed, 124 = timeout)
sudo hw-buttons wait --key vol_up --timeout 30

Top-level options (must precede subcommand): --device <PATH> (auto-detects gpio_keys), --long-press-ms 1000, --json.

  • watch: --duration 0.0 (infinite), --count 0 (infinite)
  • wait: --key {any,power,vol_up,vol_down} (any), --timeout 30.0 (0 = infinite; exits 124 on timeout)