Fix PT-P710BT raster protocol handling and add regression coverage.

Align print command payload generation with model-specific protocol requirements, add verbose CLI diagnostics and robust status retries, and introduce protocol regression tests to prevent future GF/ESC i z regressions.

Made-with: Cursor
This commit is contained in:
knb
2026-04-17 03:24:00 +09:00
parent e92273a747
commit 42a785f086
8 changed files with 219 additions and 39 deletions

View File

@@ -8,14 +8,16 @@ Brother P-touch シリーズ向けのラベル印刷用 **C コアライブラ
## レイアウト
| パス | 内容 |
|------|------|
| `include/libptouch.h` | 公開 API |
| `src/lib/libptouch_*.c` | ライブラリ本体core / usb / print / status / png / svg |
| `src/cli/main.c` | `ptouch-print` エントリ |
| `samples/` | 試験用サンプル画像の置き場PNG/SVG 等) |
| `ruby/` | Ruby FFI gem`libptouch`)・コマンド `ptouch-print-png`PNG のみ)— `ruby/README.md` |
| `reference/` | 仕様・参考資料(例: ラスター PDF |
| パス | 内容 |
| ----------------------- | --------------------------------------------------------------------------- |
| `include/libptouch.h` | 公開 API |
| `src/lib/libptouch_*.c` | ライブラリ本体core / usb / print / status / png / svg |
| `src/cli/main.c` | `ptouch-print` エントリ |
| `samples/` | 試験用サンプル画像の置き場PNG/SVG 等) |
| `ruby/` | Ruby FFI gem`libptouch`)・コマンド `ptouch-print-png`PNG のみ)— `ruby/README.md` |
| `reference/` | 仕様・参考資料(例: ラスター PDF |
## ビルド
@@ -24,6 +26,7 @@ Brother P-touch シリーズ向けのラベル印刷用 **C コアライブラ
```bash
cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure
```
成果物(`build/` 以下):
@@ -96,7 +99,7 @@ cmake --build build
- 接続は **libusb-1.0** のみ。機種ごとに **VID/PID**`lsusb` 等)を調べ、`libptouch_open_usb_vid_pid` に渡すか、既定の PT-P900W なら `libptouch_open_usb` を使います。PT-P750W は **04f9:2062**、PT-P710BT は **04f9:20af**`include/libptouch.h` の定数参照)。
- PT-P750W / PT-P710BT ではラスター幅方向は **180 dpi**P900W は 360 dpi。PNG から印刷する場合は解像度に合わせて画像を用意してください。
- ラスターコマンドの詳細は **`reference/` の PDF** および Brother 公開資料に沿って `src/lib/libptouch_*.c` に実装してください。
- ラスターコマンドの詳細は `**reference/` の PDF** および Brother 公開資料に沿って `src/lib/libptouch_*.c` に実装してください。
### Ubuntu で sudo なしで USB を開くudev
@@ -115,4 +118,4 @@ sudo usermod -aG plugdev "$USER"
## ライセンス
[MIT License](LICENSE)`LICENSE` ファイルを参照)。
[MIT License](LICENSE)`LICENSE` ファイルを参照)。