roadie

command module
v0.0.0-...-0e5d3d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 30 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

🎸 Roadie

USB KVM (⌨️ Keyboard / 🖥️ Video / 🗣️ Voice / 🖱️ Mouse / 👆🏽 Multi-touch) controllable over HTTP.

Controlling an Android phone over USB with touch and keyboard Roadie controlling an Android phone browsing Hacker News

Automating a Mac Setup Assistant Roadie controlling a Mac Setup Assistant

Roadie turns a low-cost HDMI capture dongle, plus either a Raspberry Pi 4 or a pair of microcontroller boards, into a browser-based KVM that works with anything that has a screen and a USB port: laptops, desktops, phones, tablets, servers, embedded devices. View the target's display in a browser, and send keyboard, mouse, and multi-touch input back to it — no software required on the target.

Automate Roadie with Vibium or any browser automation library — Selenium, Puppeteer, WebDriverIO, etc.

Sound, Both Ways

Roadie is also the device's speaker and microphone, both at once: full duplex. It hears everything the device plays while it speaks into the device's microphone, so you can test what screen-only tools can't: voice assistants, voice agents, calls, and any app where sound matters.

  • Hear the device: its sound comes over HDMI, or over USB when a Pi 4 is the device's USB audio.
  • Talk to it: your microphone in the viewer, or a script, reaches the device's microphone. It works in live phone calls.
  • Automate and check it with Vibium: vibium say speaks text into the device, and vibium listen turns what the device says back into text, with how long it took to answer. Speech runs on your own machine (Piper, whisper.cpp) or through OpenAI (say and listen).
  • Keep it: a recording keeps both sides of the conversation, each in its own file on one timeline, and both mixed into the video.
# With a Vibium session open on the device:
vibium say "What's the weather tomorrow?"   # spoken into the device's microphone
vibium listen --json                        # its answer as text, with the reply time

Use Cases

  • Voice apps and agents: talk to a voice assistant, voice agent or call on the device, and check its spoken answers and how fast it replies
  • Device provisioning: automate OS setup assistants with an AI agent before SSH or VNC exist on the target
  • Mobile device testing: drive phones and tablets from a browser without touching them (wiring and iOS setup)
  • Your own phone, from anywhere: leave your real phone at home on a Roadie, enrolled with a station in the cloud, and use it from any browser: read and send texts, and make and take calls. The phone you carry can be a blank one with nothing on it, which helps when you travel. All you need to remember is the station's address and your sign-in
  • Remote tech support: view and control someone's device from another room or across the network
  • General IP-KVM: same idea as PiKVM or TinyPilot, but with multi-touch support and off-the-shelf parts

How It Works

Roadie uses one device to set up or control another. It grabs video from an HDMI-to-USB capture dongle and serves it over HTTP, turning a remote device's physical display into a web page. Input goes back to the target over USB, as its keyboard, mouse, touchscreen and microphone, in one of two ways: a Raspberry Pi 4 does it through its own USB-C port, or a pair of microcontroller boards does it for any host. An AI agent (or a human) can view the screen in a browser, grab frames for vision analysis, and send input back — all over HTTP.

On a Raspberry Pi 4
flowchart TB
    B["Browser<br/>HTTP · WebSocket · WebRTC"]
    S["Go server (roadie)<br/>Raspberry Pi 4"]
    D["HDMI capture dongle"]
    A["USB-C multiport adapter<br/>HDMI · USB-A · power in"]
    T["Target device<br/>phone or tablet, USB-C"]

    B <--> S
    S ---|"USB 3: video + audio"| D
    D ---|"HDMI"| A
    S -- "USB, the Pi as a USB device: keyboard, mouse,<br/>touch, microphone, speaker, network" --> A
    A ---|"USB-C"| T

With --hid-backend linux-gadget, the Pi's USB-C port becomes the phone's keyboard, mouse, touchscreen, microphone, speaker and Ethernet adapter, and the phone's internet is shared from the Pi's Ethernet. A splitter powers the Pi from its own supply and keeps the phone's 5 V off it. The wiring is in Drive a Phone from a Raspberry Pi 4.

With the QT Py boards
flowchart TB
    B["Browser<br/>HTTP · WebSocket · WebRTC"]
    S["Go server (roadie)<br/>Host: Pi, Mac, Linux"]
    R["Relay board — QT Py<br/>JSON → binary"]
    H["HID board — QT Py<br/>binary → USB HID"]
    D["HDMI capture dongle"]
    T["Target device<br/>Mac, PC, Android, iOS"]

    B <--> S
    S -- "USB serial · JSON" --> R
    S ---|"USB: video + audio"| D
    R -- "UART" --> H
    H -- "USB HID: keyboard, mouse, touch" --> T
    H -- "USB audio: microphone" --> T
    D ---|"HDMI"| T

The boards are the default input, and they work with any host that runs roadie: a Raspberry Pi, a Mac or a Linux PC. The relay board takes commands from roadie over USB serial and passes them to the HID board, which is the target's keyboard, mouse, touchscreen and microphone.

Why not VNC/KVM/MDM?

VNC and remote desktop require software running on the target. If the target is mid-setup, locked out, or doesn't have an OS yet, they can't help.

Other hardware KVMs also work at the hardware level, but generally don't target mobile devices or multi-touch, and aren't designed for programmatic control by automation tools or AI agents. Roadie adds multi-touch alongside keyboard and mouse, and includes a WebDriver BiDi endpoint so browser automation libraries can drive it.

MDM tools manage devices over the network but require enrollment, platform-specific agents, and an already-configured OS. Roadie works at the hardware level — it doesn't care what OS is running or whether the device is enrolled in anything.

Parts Needed

Raspberry Pi 4 (about $383)

This is the reference setup: a Raspberry Pi 4 drives a USB-C iPhone and acts as its USB keyboard, mouse and microphone itself, with no microcontroller boards. The wiring is in Drive a Phone from a Raspberry Pi 4.

For the phone (about $129):

Qty Part What it's for Price Link
1x Apple USB-C Digital AV Multiport Adapter Plugs into the phone: HDMI out, a USB-A port and USB-C power in $69.00 apple.com
1x UGREEN HDMI to USB 3.0 video capture card Captures the phone's screen, on one of the Pi's USB 3 ports $22.99 amazon.com
1x HDMI male-to-male coupler (pack of 2, one needed) Joins the multiport adapter's HDMI port to the capture card $6.89 amazon.com
1x USB-C OTG splitter cable Lets the Pi's USB-C port take power from its own supply and data from the phone $9.99 amazon.com
1x PortaPow USB power blocker Cuts the phone's 5 V from the data line, so it never meets the Pi's supply $9.99 amazon.com
1x USB-A male-to-male adapter (pack of 4, one needed) Joins the multiport adapter's USB-A port to the splitter's data input $9.99 amazon.com

The Pi (about $254):

Qty Part Price Link
1x Raspberry Pi 4, 8 GB $165.00 raspberrypi.com
1x Raspberry Pi 27W USB-C power supply $12.00 raspberrypi.com
1x Samsung PRO Endurance microSD card, 128 GB $76.99 samsung.com

To keep the phone charged while it's connected, plug a USB-C charger into the multiport adapter's power input.

With the QT Py boards (about $86, plus a host computer)

The two QT Py RP2040 boards send the keyboard, mouse and multi-touch input instead of the Pi. They work with any host that runs the roadie server, such as a Raspberry Pi 4 (2 GB or more), a Mac or a Linux PC, and they are the default input backend.

Qty Part Price Link
2x Adafruit QT Py RP2040 $9.95 ea adafruit.com
1x Tiny premium breadboard $3.95 adafruit.com
1x Breadboarding wire bundle $4.95 adafruit.com
1x USB adapter kit (A↔C) $6.99 amazon.com
1x HDMI-to-USB-C 1080p capture $16.99 amazon.com
1x HDMI male-to-male adapter $5.99 amazon.com
1x USB-C to HDMI + USB-A + USB-C PD hub $17.99 amazon.com
1x USB-A to USB-C cable $8.99 amazon.com

Quick Start

New Raspberry Pi? Install the OS, then run one set-up script that installs, builds and configures everything — for the boards, or with the Pi itself as the phone's USB devices.

Prerequisites: macOS or Linux, Go 1.21 or newer, a C compiler, Python 3.10+. The build uses Go 1.27.4, which go.mod names. An older Go downloads it on the first build, so that build needs internet access.

A Raspberry Pi is the usual development machine, but nothing assumes a particular display: make setup installs what the browser test needs to run without a monitor attached, and warns if your user is missing the input group membership the hardware tests need.

git clone https://github.com/VibiumDev/roadie.git && cd roadie
make setup          # one-time: python venv, dependencies, udev rules
make flash-hid      # flash first board, then unplug it
make flash-relay    # flash second board

Connect the two boards with jumper wires (TX-to-RX, RX-to-TX, GND-to-GND). Plug the relay board into your host and the HID board into the target, and plug the HDMI capture dongle between the target's video output and the host. Then:

make                # build
./roadie            # run

Open http://localhost:8080/drive to see and control the target's screen. Without --auth, Roadie listens on localhost only; to reach it from other machines, run it with --auth token and sign in at /login with the token roadie token prints (see Run Roadie).

To drive more than one device from the same host, see Running Multiple Targets.

Features

  • HID control: absolute mouse, multi-touch digitizer, and keyboard input via USB, controllable over HTTP/WebSocket
  • Interactive viewer: /drive page with live feed and full HID control (mouse, touch, keyboard) directly on the stream
  • WebRTC: the viewer's default where the host can encode H.264 (the Pi 4's hardware encoder, or VideoToolbox, VAAPI, NVENC or libx264 through ffmpeg elsewhere). One peer connection carries the picture, the phone's sound as G.722, your microphone back, and input, at a fraction of MJPEG's bandwidth and CPU, and the viewer falls back to MJPEG and the WebSockets by itself
  • Vibium Station: roadie enroll joins a station that brokers access from anywhere over an outbound tunnel, with signed holds the Pi checks itself. The station's viewer is this same shared shell, with Roadie's extras loaded through the relay. --label "Dev iPhone 15" names the device on the station's pages, --device-name iphone_1 sets the name in its station address (rig/<name>, phone by default), --model "iPhone 15 Pro Max" and --os-version 26.6 say what the device is and runs, and --platform tells it what the device runs. Enrolled with roadie enroll --record, every hold is recorded on the Pi and kept in the station's Record Store.
  • Local login: --auth token (a local admin token, a one-field /login page, Authorization: Bearer for agents) or --auth tailscale (whoever your tailnet says); without --auth, Roadie listens on localhost only
  • HTTPS: --tls-cert and --tls-key serve TLS directly, reloading the files when they change; or put tailscale serve in front for a *.ts.net name with no certificate files (how)
  • Auto-detection: finds external capture devices, skips built-in cameras
  • Hot-swap: plug/unplug devices without restarting
  • Auto-crop: detects and removes black bars from HDMI capture (pillarbox/letterbox), remaps touch coordinates to match
  • Runtime settings: adjust quality, FPS, and resolution on the fly from the viewer
  • Sound both ways: the device's sound to the browser (WebRTC, or PCM over a WebSocket) and to scripts, and voice into its USB microphone from the viewer's mic button or from roadie:audio.play over WebDriver BiDi, which also captures what the device plays, timed by its own samples. It works in live phone calls, and a hold's recording keeps both sides
  • Bonjour/mDNS: discoverable as roadie.local on your network when it listens beyond localhost (with --auth)
  • Multiple targets: run one instance per target on a single host, each pinned to its own capture dongle and relay board, with a /grid page to view and drive them together
  • Platform-aware input: --platform adapts pointer mapping and input mode to Android, iOS, macOS, Windows, or Linux targets
  • Two HID backends: the RP2040 boards, or a Raspberry Pi 4's USB-C port as a composite USB gadget (input, audio both ways, and USB Ethernet) with --hid-backend linux-gadget
  • Cross-platform: runs on macOS and Linux (Raspberry Pi, Ubuntu, etc.)
  • Resilient: automatic reconnection with exponential backoff, signal loss detection

Documentation

Doc Description
API Reference HTTP/WebSocket endpoints, HID commands, USB keycodes
Protocol Reference Binary wire format between relay and HID boards
Board Reference Hardware specs, wiring, USB identifiers, LED behavior
Architecture System design, pipeline, and design decisions
Where Roadie Sits Driving a phone from inside it, from its cables, or from in front of it
MJPEG vs WebRTC What each way of sending the picture costs in bandwidth, data and CPU, with pictures, and who should care; the .html next to it adds a calculator
Nostr Keys In the Station repo: why the rig's key and the station's are Nostr keys, what the signed grants and announcements do today, and what they leave open
Install Raspberry Pi OS Step 1 of setting up a new Pi: Imager settings for a Roadie
Configure Raspberry Pi OS Step 2: the one-shot setup/machine-setup script, and updating with it
Run Roadie The roadie service: start, stop, its log, its flags, and running a build by hand
Harden the Pi The sandboxed service and the phone's walled-off link, then SSH with keys only, unneeded services, the hardware watchdog, and notes on a read-only root
Flash Boards Flashing, re-flashing, and syncing board code
Connect a Phone Wiring a phone through a hub, and the iOS AssistiveTouch settings a mouse needs
Drive a Phone from a Pi 4 The linux-gadget backend: power, install, audio, USB Ethernet, recovery, hardware checklist
Linux Gadget Plan Design and decisions behind the linux-gadget backend
Testing Checking keyboard, mouse, touch, and voice input against real hardware
Measure the Encoder encbench: what the capture dongle and the hardware H.264 encoder cost, for the WebRTC path
Running Multiple Targets Driving several devices from one host, and viewing them together
Troubleshooting Common problems and fixes
Automate with Vibium Drive the phone from the CLI, a script or an AI agent, on the LAN or through a station, with a recording at the end
REPL Tutorial Interactive debugging via CircuitPython REPL
Roadie Remote Spec WebRTC, the Pi tunnel, holds and Vibium Station: the plan for using a Roadie from anywhere (in the Station repo)

Development

make                  # build binary
make help             # list every target
make status           # what's connected: boards, input, audio, displays
make test             # unit tests, plus the hardware tests if the boards are here
make test-unit        # only the Go unit tests
make rtcprobe         # a headless WebRTC viewer: ./rtcprobe/rtcprobe -url http://roadie.local:8080 -token ... [-hid '{...}'] [-mic]
make test-hid         # do the boards inject correct input?
make test-e2e-pi      # full stack into a browser on this machine
make start-vnc-server # watch runs on a Pi with no monitor
make test-e2e-android # full stack into Chrome on an Android phone
make test-e2e-iphone  # full stack into Safari on an iPhone
make demo-iphone      # the same, as a sci-fi HUD for a screen recording
make clean            # remove binary

No monitor required: make test-hid needs no display, and make test-e2e-pi uses this machine's desktop if it has one — taking over the screen so you can watch over VNC — or makes its own display if it doesn't.

See Flash Boards for re-flashing and syncing board code, and Testing for what each test covers.

The code is one binary from main.go and commands.go, with the work in packages under internal/: capture (the dongle, crops, settling, the no-signal frame), hid (input backends, settling, glide, HID reports), gadget (the USB gadget's HID and audio functions), alsa (PCM streams, the resampler, the dongle's audio), audio (the broadcaster and the mux), devices (device info, sysfs reads, USB resets), platform (platform names and rules), web (the HTTP server, pages, local auth, BiDi, recording, rotation) and remote (the rig's link to its stations). encoder, v4l2, rtc and audio/* are the codec and transport packages they build on.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package aac encodes 16 kHz mono sound as AAC-LC, the audio every MP4 player takes.
Package aac encodes 16 kHz mono sound as AAC-LC, the audio every MP4 player takes.
audio
g711
Package g711 is the µ-law half of ITU-T G.711 (PCMU): 8 kHz narrowband speech at 64 kbit/s, one byte per sample, the codec every WebRTC endpoint must support.
Package g711 is the µ-law half of ITU-T G.711 (PCMU): 8 kHz narrowband speech at 64 kbit/s, one byte per sample, the codec every WebRTC endpoint must support.
g722
Package g722 is an ITU-T G.722 codec in pure Go: 16 kHz wideband speech at 64 kbit/s, the codec every browser offers for WebRTC.
Package g722 is an ITU-T G.722 codec in pure Go: 16 kHz wideband speech at 64 kbit/s, the codec every browser offers for WebRTC.
pcm
Package pcm converts between the capture's audio and what the speech codecs take: 48 kHz stereo float samples down to 16 kHz or 8 kHz mono 16-bit, and 8 kHz back up to 16 kHz.
Package pcm converts between the capture's audio and what the speech codecs take: 48 kHz stereo float samples down to 16 kHz or 8 kHz mono 16-bit, and 8 kHz back up to 16 kHz.
encbench measures the capture-to-H.264 pipeline on a Roadie host: it captures YUYV from the dongle, crops to the phone, feeds the hardware encoder one of several ways, and reports CPU, frame rate, drops, bitrate and capture-to-encoded latency.
encbench measures the capture-to-H.264 pipeline on a Roadie host: it captures YUYV from the dongle, crops to the phone, feeds the hardware encoder one of several ways, and reports CPU, frame rate, drops, bitrate and capture-to-encoded latency.
Package encoder turns captured frames into H.264 for WebRTC.
Package encoder turns captured frames into H.264 for WebRTC.
internal
hid
web
Package mp4 stores an encoder's H.264 in an MP4 file as it comes, without encoding it again.
Package mp4 stores an encoder's H.264 in an MP4 file as it comes, without encoding it again.
Package rtc sends the captured picture to browsers over WebRTC.
Package rtc sends the captured picture to browsers over WebRTC.
rtcprobe is a headless WebRTC viewer: it joins a Roadie's signaling endpoint, receives the H.264 and G.722 tracks and reports what arrives, can send one input command over the "hid" data channel and a tone as its microphone, so the remote path can be checked from a script.
rtcprobe is a headless WebRTC viewer: it joins a Roadie's signaling endpoint, receives the H.264 and G.722 tracks and reports what arrives, can send one input command over the "hid" data channel and a tone as its microphone, so the remote path can be checked from a script.
Command soundcheck serves the soundcheck page, index.html, and a plain white page, white.html, both built into the binary: deploying it is copying one file.
Command soundcheck serves the soundcheck page, index.html, and a plain white page, white.html, both built into the binary: deploying it is copying one file.
Package v4l2 talks to Video4Linux2 devices with plain ioctls, in pure Go: UVC capture (the HDMI dongle) and memory-to-memory codecs (the Pi 4's H.264 encoder on /dev/video11 and its ISP on /dev/video12).
Package v4l2 talks to Video4Linux2 devices with plain ioctls, in pure Go: UVC capture (the HDMI dongle) and memory-to-memory codecs (the Pi 4's H.264 encoder on /dev/video11 and its ISP on /dev/video12).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL