Open
Conversation
- Document all CLI tools (phomemo-filter.py, format-checker.py) - Document CUPS backend and filters architecture - Add protocol reference for M02/T02 and M110/M220 printers - Provide detailed macOS Apple Silicon CUPS compatibility analysis - Include step-by-step macOS installation guide for USB printing - Document required code changes for full macOS support https://claude.ai/code/session_01WBHE6TN5hyNn6pNDFTRMis
docs: add comprehensive tool documentation and macOS CUPS guide
This commit implements complete macOS support for phomemo-tools,
including Bluetooth connectivity via IOBluetooth framework.
## Architecture Changes
- Introduced platform abstraction layer for cross-platform support
- Created modular bluetooth/ and usb/ packages with platform-specific
implementations for Linux (BlueZ/D-Bus) and macOS (IOBluetooth/PyObjC)
- Refactored phomemo.py backend to use the new abstraction layer
## New Files
Backend modules:
- cups/backend/platform.py - Platform detection utilities
- cups/backend/bluetooth/{__init__,base,linux,darwin}.py
- cups/backend/usb/{__init__,base,linux,darwin}.py
Installation:
- scripts/install-macos.sh - Automated macOS installer
- requirements.txt, requirements-{macos,linux}.txt
## macOS Features
- Full Bluetooth discovery via IOBluetoothDevice.pairedDevices()
- RFCOMM connections via IOBluetoothRFCOMMChannel
- USB device detection via PyUSB with /dev/cu.usbmodem* paths
- CUPS integration using /usr/local/lib/cups/ (SIP-friendly)
- Automatic platform detection and backend selection
## Compatibility
- Maintains full backwards compatibility with Linux
- Supports Apple Silicon (arm64) and Intel Macs
- Requires macOS 11.0+ and Python 3.9+
https://claude.ai/code/session_01WBHE6TN5hyNn6pNDFTRMis
Add test build for macOS USB printing support: - USB-only backend (phomemo-usb.py) without dbus dependency - macOS install script with proper CUPS paths - Makefile with check, install, uninstall, and test targets - Comprehensive README with setup and troubleshooting This is an experimental build for testing USB connectivity. Bluetooth is not supported on macOS due to different stack. https://claude.ai/code/session_01TxFkTuQwkdnPzGU5g57h3C
feat: add full macOS Apple Silicon support with Bluetooth and USB
feat(macos): add experimental USB support for macOS
macOS CUPS sandbox blocks Python filters due to xcode-select checks. This adds a native C filter that works around the restriction. Changes: - Add cups/filter/rastertopm110.c - native C CUPS filter for M110/M220 - Update Makefile to compile C filter on macOS - Fix bug in Python filters (stdout.write -> file.write) - Add macos/print-usb.py for direct USB printing - Add uncompressed PPD files The C filter links with libcups and libcupsimage, bypassing the Python sandbox issues on macOS. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add print-bluetooth.py for direct Bluetooth printing on macOS using IOBluetooth framework via PyObjC. Features: - Auto-detect paired Phomemo printers (by name or serial pattern) - RFCOMM connection with proper chunked data transfer - Same image processing as USB printing Usage: python3 print-bluetooth.py <image> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
macOS TCC privacy restrictions prevent CUPS (running as root) from accessing Bluetooth directly. This implements a helper daemon approach: - phomemo-bt-helper.py: Runs as user LaunchAgent with Bluetooth access - phomemo-bt-socket: CUPS backend that connects to helper via Unix socket - install-bt-helper.sh: Installation script for the helper daemon The helper daemon listens on /tmp/phomemo-bt.sock and forwards print data to Bluetooth printers using IOBluetooth/PyObjC. Also includes phomemo-bt.m as reference implementation showing direct IOBluetooth usage (works standalone, blocked by TCC under CUPS). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The CUPS sandbox blocks both system Python (xcode-select issues) and Homebrew Python (framework library blocked). Switch to pure bash+nc approach for socket communication with the helper daemon. Changes: - Use netcat (nc) for Unix socket communication - Implement binary protocol header in bash (uint32_be function) - Handle SIGPIPE (exit 141) as success since data was sent - Remove Python discovery (can't run in sandbox) The helper daemon still uses Python with PyObjC for Bluetooth, but runs outside the CUPS sandbox as a user LaunchAgent. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update all documentation to reflect current feature set: - docs/README.MD: Complete rewrite with updated macOS section, simplified structure, and accurate feature descriptions - macos/README.md: Full rewrite showing USB, Bluetooth, and CUPS support with helper daemon architecture - cups/README.md: Add proper documentation for filters and backends Key changes documented: - Native C filter for macOS (bypasses sandbox) - Bluetooth helper daemon for CUPS printing - Direct printing scripts (print-usb.py, print-bluetooth.py) - Troubleshooting guides for common issues Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rewrite root README.md to be concise and reference detailed documentation in subdirectories: - docs/README.MD for complete documentation - macos/README.md for macOS-specific guide - cups/README.md for CUPS driver details Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
|
Hi @arnoutzw, |
Author
|
@vivier Hi Vivier, sorry no the c implementation was necessary to avoid permission problems on MacOS |
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.
Thanks for your work, Added MacOS support together with Claude. Works great for USB & Bluetooth now. Have not been able to regression test linux.