Skip to content

Replace periph.io with direct i2c-dev access; make the module dependency-free#64

Merged
cafedomingo merged 3 commits into
mainfrom
claude/remove-periph
Jun 13, 2026
Merged

Replace periph.io with direct i2c-dev access; make the module dependency-free#64
cafedomingo merged 3 commits into
mainfrom
claude/remove-periph

Conversation

@cafedomingo

@cafedomingo cafedomingo commented Jun 10, 2026

Copy link
Copy Markdown
Owner

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 one I2C_SLAVE ioctl plus write(2) — the display protocol never reads, never scans the bus, never changes address. Meanwhile host.Init() registered GPIO/SPI/sysfs drivers this project never touches.

For a binary users curl | sudo bash onto 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 in sysinfo, so this doesn't introduce a new style.

Notes for review:

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
cafedomingo force-pushed the claude/remove-periph branch from 4e67616 to 206db81 Compare June 10, 2026 18:43
@cafedomingo
cafedomingo merged commit 4a34d9f into main Jun 13, 2026
4 checks passed
@cafedomingo
cafedomingo deleted the claude/remove-periph branch June 13, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants