fix: plasmactl checks for FIFO before writing - #22
Open
iksaif wants to merge 8 commits into
Open
Conversation
- Skip redundant plasma.show() calls when color/brightness hasn't changed (solid colors now only update once instead of every frame) - Skip pattern re-rendering when the animation row hasn't advanced - Replace FIFO readline busy-wait (time.time() polling loop) with select.select() for proper blocking I/O - Cache loaded PNG patterns instead of re-parsing on every switch
Clearing the flag inside the set_all() branch meant the buffer was written but never latched to the hardware, so solid colours never displayed. Patterns were unaffected because that branch leaves the flag set.
iksaif
force-pushed
the
fix/plasma-fifo-safety
branch
from
August 25, 2026 12:21
2d98fe8 to
9a6eb5d
Compare
Tests cover: - FIFO.readline uses select.select for blocking I/O - Pattern caching avoids re-reading from disk - needs_update flag ensures show() only fires on state changes - Static color: show() called once, not every frame - Color/brightness changes trigger show() - FPS clamped to minimum 1
Add pipe protocol for external apps to control individual LEDs: - set <index> <r> <g> <b> / set <index> <color> — set a single pixel - unset <index> — clear a per-pixel override - clear — clear all per-pixel overrides - off — turn all LEDs off - <color_name> — set all LEDs to a named color Named colors: off, black, white, red, green, blue, yellow, cyan, purple, magenta, orange, dim_white. Hex colors (#ff0000) also supported. plasmactl gains --set, --unset, --clear, --off, --color (alias for --colour).
Tests cover: - parse_color: named colors, hex colors, integer colors, invalid inputs - Per-pixel overrides: set, unset, clear, off, out-of-range indices - plasmactl: NAMED_COLORS, Color function, send writes to FIFO
- Check stat.S_ISFIFO before opening in plasmactl - Remove stale non-FIFO file before mkfifo in daemon - Add ExecStop to systemd service to turn LEDs off on shutdown - Fix needs_update logic for static colors and per-pixel overrides
iksaif
force-pushed
the
fix/plasma-fifo-safety
branch
from
August 25, 2026 13:14
9a6eb5d to
5554b27
Compare
Tests cover: - plasmactl open_fifo rejects regular files and missing files - plasmactl open_fifo accepts real FIFOs - daemon FIFO removes stale non-FIFO file before mkfifo - daemon FIFO preserves existing FIFO (does not remove) - daemon FIFO creates new FIFO when no file exists
iksaif
force-pushed
the
fix/plasma-fifo-safety
branch
from
August 25, 2026 13:25
5554b27 to
2b597cd
Compare
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: plasmactl checks for FIFO before writing
plasmactlusedopen(filename, 'wb')which creates a regular file if/tmp/plasmadoesn't exist as a FIFO (e.g. the daemon is down). This prevents the daemon from receiving commands on next start becauseos.mkfifosilently fails when a regular file already exists.Changes
stat.S_ISFIFObefore opening — rejects regular files and missing paths with a clear error messageos.mkfifofails and a stale non-FIFO file exists, remove it and retry instead of silently ignoringExecStopto sendoffcommand before shutdown so LEDs turn off cleanlyneeds_updatelogic so static colour changes actually reach the LEDs and per-pixel overrides don't fire every frame (regression introduced in an earlier version of this PR)Tests
6 new unit tests covering
open_fiforejects regular files / missing files / accepts real FIFOs, daemon removes stale non-FIFO file, daemon preserves existing FIFO, and daemon creates new FIFO. All pass alongside the existing test suite.Includes from #20 and #21
All performance optimizations, per-pixel control, named colors, and pattern caching from the stacked PRs below.