Replace periph.io with direct i2c-dev access; make the module dependency-free#64
Merged
Conversation
The driver's entire use of periph.io was opening /dev/i2c-1 and issuing plain writes to a fixed device address — one I2C_SLAVE ioctl plus write(2), which the kernel's i2c-dev interface provides directly. The periph host.Init() call also registered GPIO/SPI/sysfs drivers this project never touches. Talking to i2c-dev directly removes the project's only module dependencies (periph.io/x/conn, periph.io/x/host, and clockwork transitively), shrinking both the supply-chain surface of a binary that users install as a privileged service and the binary itself. The display's command framing and burst-chunk limits, previously exercised only on hardware, are now covered by tests against a fake bus.
cafedomingo
force-pushed
the
claude/remove-periph
branch
from
June 10, 2026 18:43
4e67616 to
206db81
Compare
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.
The driver's entire use of periph.io reduces to: open
/dev/i2c-1, latch a fixed slave address, write. The kernel's i2c-dev interface gives exactly that with oneI2C_SLAVEioctl pluswrite(2)— the display protocol never reads, never scans the bus, never changes address. Meanwhilehost.Init()registered GPIO/SPI/sysfs drivers this project never touches.For a binary users
curl | sudo bashonto their machines and run as a long-lived service, every dependency is supply-chain surface to trust, update, and audit. This takes the module from three dependencies to zero: the entire codebase is now this repo plus the Go standard library. The project already does raw ioctl work for the VideoCore mailbox insysinfo, so this doesn't introduce a new style.Notes for review:
I2C_RDWRforTx(w, nil)rather thanI2C_SLAVE+write(2), but for a single write-only transaction to one fixed address the two are wire-equivalent. A smoke test on real hardware before the next release is still prudent.