seedhammer.com

module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Unlicense

README

SeedHammer controller program

This repository contains the source code to run the controller program for the SeedHammer engraving machine. It runs on the same hardware as the SeedSigner: Raspberry Pi Zero or Zero W, a WaveShare 1.3 inch 240x240 LCD hat and a Pi Zero compatible camera with a OV5647 sensor.

Installation

Write seedhammer-vX.Y.X.img to an SD-card and insert that into the SD-card slot on the Raspberry Pi.

Linux

The dd command writes the image to the block device /dev/sdX:

$ dd if=result/seedhammer-vX.Y.Z.img of=/dev/sdX bs=1M
macOS

Use a similar command as for Linux or a GUI tool such as balenaEtcher.

Building from source

To build a complete seedhammer.img image, Nix with flakes enabled is required. The default Nix package in flake.nix builds the image:

$ nix build github:seedhammer/seedhammer
$ ls result/seedhammer.img

The seedhammer.img image contains the Pi Zero firmware, the Linux kernel and drivers, and the controller program that drives the Pi hardware and engraver.

To build a versioned image, use the mkrelease script and specify a tag:

$ nix run github:seedhammer/seedhammer#mkrelease vx.y.z

the resulting image will embed the version. The command also accepts git branches or commits.

Reproducible builds

The build process is designed to be deterministic; that is, images produced with the above steps should match the released images bit-for-bit. If not, please open an issue.

To reproduce a release named vX.Y.Z, use the following command to produce seedhammer-vX.Y.Z.img in the current directory.

$ nix run github:seedhammer/seedhammer#mkrelease vX.Y.Z

Use a tool such as shasum or sha256sum to verify that the release binary matches.

Development

Replacing the controller binary

To replace just the controller program, re-build it with Go and replace the initial RAM filesystem. For example, if boot is mounted on /Volumes/boot:

$ CGO_ENABLED=0 GOARCH=arm GOARM=6 GOOS=linux go build ./cmd/controller
$ echo "controller" | cpio -H newc -o --quiet | gzip > /Volumes/boot/initramfs.cpio.gz

Update through USB

There is a crude facility to replace and restart the controller binary on a running device. First, build and prepare a debug build of the image

$ nix build .#image-debug

from a local clone of this repository. Then write result/seedhammer-debug.img to an SD-card. Connect the device to your machine with a USB cable to the USB port closest to the mini-HDMI port of the device; that is, the port usually used to communicate with the engraver.

Then, to upload and run a new version of the controller binary, run

$ export USBDEV=/dev/cu.usbmodem101 # Or (usually) /dev/ttyUSB0 on Linux.
$ nix run .#reload $USBDEV

In debug mode, logging output from the controller is routed through the USB serial device. Use

$ cat $USBDEV

to show the log on your terminal. The nix .#reload command automatically does this after reloading.

Remote control

There are few commands available to remote control, or script, the device in debug mode.

$ echo "input up" > $USBDEV

sends one or more button events to the device. Available buttons are: up, down, left, right, center, b1, b2, b3.

$ echo "runes ACCIDENT" > $USBDEV

sends text to the device, where every space and the newline sends an implicit input b2. Useful for scripting the input of seeds.

$ echo "screenshot" > $USBDEV

instructs the controller to dump a screenshot to the SD card.

Dry-run engraving

Testing the engraving process without actually spending a plate can be done in dry-run mode. It's activated by long-pressing the middle button on the engraving screen. When dry-run is enabled, a small notice is shown in the lower right corner of the screen.

License

The files is this repository are in the public domain as described in the LICENSE file, except files in directories with their own LICENSE files.

Directories

Path Synopsis
package address derives recieve and change addresses from output descriptors.
package address derives recieve and change addresses from output descriptors.
package affine implements mathematical operations on the golang.org/x/image/math/f32 data types.
package affine implements mathematical operations on the golang.org/x/image/math/f32 data types.
package backup implements the SeedHammer backup scheme.
package backup implements the SeedHammer backup scheme.
bc
bytewords
Package bytewords implements the the bytewords standard as described in [BCR-2020-012].
Package bytewords implements the the bytewords standard as described in [BCR-2020-012].
fountain
Package fountain implements the fountain encoding used by the Uniform Resources (UR) format described in [BCR-2020-005].
Package fountain implements the fountain encoding used by the Uniform Resources (UR) format described in [BCR-2020-005].
ur
Package ur implements the Uniform Resources (UR) encoding specified in [BCR-2020-005].
Package ur implements the Uniform Resources (UR) encoding specified in [BCR-2020-005].
urtypes
Package urtypes implements decoders for UR types specified in [BCR-2020-006].
Package urtypes implements decoders for UR types specified in [BCR-2020-006].
xoshiro256
Package xoshiro256 implements the xoshiro256** pseudo-random number generator.
Package xoshiro256 implements the xoshiro256** pseudo-random number generator.
package bip32 contains helper functions for operating on bitcoin bip32 extended keys.
package bip32 contains helper functions for operating on bitcoin bip32 extended keys.
package bip39 represents and converts bitcoin bip39 mnemonic phrases.
package bip39 represents and converts bitcoin bip39 mnemonic phrases.
cmd
cli
command cli is the internal tool for testing the SeedHammer engraver.
command cli is the internal tool for testing the SeedHammer engraver.
controller
command controller is the user interface for engraving SeedHammer plates.
command controller is the user interface for engraving SeedHammer plates.
markers
package markers is the tools for marking the top plate of the SeedHammer machine.
package markers is the tools for marking the top plate of the SeedHammer machine.
package engrave transforms shapes such as text and QR codes into line and move commands for use with an engraver.
package engrave transforms shapes such as text and QR codes into line and move commands for use with an engraver.
package font converts an OpenType font into a form usable for engraving.
package font converts an OpenType font into a form usable for engraving.
constant
Code generated DO NOT EDIT.
Code generated DO NOT EDIT.
gui
package gui implements the SeedHammer controller user interface.
package gui implements the SeedHammer controller user interface.
op
package input implements an input driver for the joystick and buttons on the Waveshare 1.3" 240x240 HAT.
package input implements an input driver for the joystick and buttons on the Waveshare 1.3" 240x240 HAT.
package lcd implements a display on top of dumb DRM devices.
package lcd implements a display on top of dumb DRM devices.
package mjolnir implements a driver for the MarkingWay engraving machine.
package mjolnir implements a driver for the MarkingWay engraving machine.
package ninepatch contains an image.Image implementation of stretchable images in 9-patch format.
package ninepatch contains an image.Image implementation of stretchable images in 9-patch format.
package nonstandard implements parsing of non-standard bitcoin output descriptors.
package nonstandard implements parsing of non-standard bitcoin output descriptors.
package rgb16 contains an image.Image implementation of a 16-bit RGB image.
package rgb16 contains an image.Image implementation of a 16-bit RGB image.
Package seedqr encodes and decodes [SeedQR] and CompactSeedQR formats.
Package seedqr encodes and decodes [SeedQR] and CompactSeedQR formats.

Jump to

Keyboard shortcuts

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