Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

sprocket-cli logo

sprocket-cli

Print instant photos from your terminal.

Python 3.11 or newer Managed with uv MIT license

HP Sprocket 200 · Linux, macOS, and Windows · 640 × 1002 JPEG

Discover and pair your printer, check its battery and print status, and send photos over Bluetooth Classic using HPLPP on RFCOMM channel 2.

Official Website


Setup

Install uv and use Python 3.11 or newer. Enable Bluetooth and turn on the printer. Run these commands from the repository.

System Install Bluetooth backend
Linux uv sync --locked --python /usr/bin/python3 BlueZ (bluetoothctl) and Python RFCOMM sockets
macOS uv sync --locked IOBluetooth through PyObjC
Windows uv sync --locked WinRT for discovery and pairing, Windows RFCOMM sockets for printing

On Linux, use a Python build that exposes socket.AF_BLUETOOTH and socket.BTPROTO_RFCOMM. Some uv-managed interpreters omit these constants. If macOS asks for Bluetooth access, allow it for your terminal in System Settings > Privacy & Security > Bluetooth.

Discover, pair, and print

uv run sprocket scan
uv run sprocket pair
uv run sprocket status
uv run sprocket print photo.jpg

scan shows the address and pairing state. Run pair in an interactive terminal and respond to any pairing prompt. On Linux the prompt comes from the system's default BlueZ pairing agent. You can also pair the printer in your operating system's Bluetooth settings. A printer that accepts RFCOMM without pairing can go straight from scan to status.

For manual pairing from a Linux terminal, use these commands in bluetoothctl.

bluetoothctl
scan bredr
agent DisplayYesNo
pair XX:XX:XX:XX:XX:XX
scan off
quit

Supply the address reported by scan to skip discovery, select one of multiple printers, or use a printer whose Bluetooth name was changed. The CLI prefers a sole paired printer for status and print. Replace the placeholder with your printer's address.

uv run sprocket pair --address XX:XX:XX:XX:XX:XX
uv run sprocket status --address XX:XX:XX:XX:XX:XX
uv run sprocket print photo.jpg --address XX:XX:XX:XX:XX:XX

Set SPROCKET_ADDRESS to use that printer by default. An explicit --address takes precedence. For example, on Linux or macOS use export SPROCKET_ADDRESS=XX:XX:XX:XX:XX:XX. In PowerShell use $env:SPROCKET_ADDRESS = "XX:XX:XX:XX:XX:XX".

status reports the printer's model name, battery percentage, and print state. print applies the image's EXIF orientation, center-crops it to a 640 × 1002 JPEG, and checks printer readiness before sending the job. Success means the printer acknowledged the whole JPEG. The printer then finishes the physical print. Use --timeout SECONDS with status or print to change the connection and reply timeouts.

Verification

uv run --locked python -m unittest discover -s tests -v

The tests run without a printer. Real hardware verification has covered Linux discovery, status (including out of paper), and a print transfer. Pairing and the macOS and Windows backends still need hardware validation.

The implementation follows openZinkBooth's Sprocket 200 protocol notes and the Python RFCOMM print demonstration on macOS.

License

This project is released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages