# An LED strip, a serial port and Wayland: notes from hyper-sync

> hyper-sync drives a Skydimo LED strip from Linux. Most of the work went into four limits: a serial line that caps the frame rate, screen capture on Wayland, colour that looks wrong without gamma, and the delay from sound to light.

Source: https://ouzx.me/blog/hyper-sync-led-sync-on-wayland  
Published: 2026-11-13T10:34:15.471Z  
Updated: 2026-11-13T10:34:49.045Z

---

hyper-sync is a hobby project: a Rust daemon that drives a Skydimo LED strip around a monitor, from Linux on Wayland. The [project page](/en/portfolio/hyper-sync) lists what it does. This post is about the four limits that shaped it.
## The wire sets the frame rate

The controller speaks a variant of the Adalight protocol: the bytes `Ada`, two zero bytes, the LED count, then red, green and blue for each LED. There is no checksum. For 65 LEDs that is 201 bytes per frame.

It only answers at 115200 baud; every rate from 230400 up to 2 Mbaud gets no reply. With 8N1 framing each byte costs ten bits on the line, so a frame takes about 17 ms, and roughly 57 frames per second is the ceiling.

hyper-sync caps the rate at 55. Writes do not wait for the wire, so asking for more than the line carries would not make anything faster: frames would queue up and show as lag. The frame loop sleeps only what is left of each interval, and the measured rates come out at 45.0 for a setting of 45 and 55.1 for 55.
## Wayland does not hand out the screen

On Wayland a program cannot simply read the screen. hyper-sync asks xdg-desktop-portal for a ScreenCast session, the desktop shows its picker, and frames arrive over PipeWire. When the permission is granted with "without asking next time" ticked, the portal returns a restore token, which hyper-sync saves so later starts skip the picker. If nobody answers, the picker closes after 30 seconds and the daemon opens it again a few seconds later, up to 12 times.

From each frame it samples only the edges. Each LED averages the whole stretch of edge up to its neighbours.
## Colour needs gamma

Screen colours are encoded for monitors, and LEDs are linear. Sent straight to the strip, the screen's values wash out the mid-tones. hyper-sync applies a gamma of 2.2 by default, and 1.0 turns it off. An optional smoothing setting eases between frames to calm flicker, at the cost of some lag.
## Sound to light in 30 to 45 ms

The sound modes read the default PipeWire output through `parec`, at 48 kHz stereo. Asking `parec` for buffers of about 5 ms drops PipeWire's cycle from 1024 to about 256 samples while audio is in use. A low-pass around 100 Hz weights the bass, so kicks pump the brightness without the treble making it flicker.

The estimate from sound to light is 30 to 45 ms: the 5 ms PipeWire cycle, a fast-attack envelope, the wait for the next frame and 17 ms on the serial line.
## One process owns the strip

Only the daemon opens the serial port. The TUI, the tray menu and the KDE Plasma widget are clients over a Unix socket, and `hyper-sync ctl` gives scripts the same controls. That kept the rest simple: settings reload when the config file changes, an unplugged strip is retried every two seconds, and the LEDs go dark while the screen is locked.

New hardware plugs in behind one trait, `Device`, whose `show` method receives a finished frame of RGB values. With `driver = "none"` there is no hardware at all and frames only appear in the TUI's preview; the demo in the README was recorded that way.

The code is [on GitHub](https://github.com/Ouzx/hyper-sync) under the MIT licence.
