From d683bf983a1e4c79f3dc3e1341ea4df2f6989573 Mon Sep 17 00:00:00 2001 From: knb Date: Thu, 16 Apr 2026 13:54:36 +0900 Subject: [PATCH] =?UTF-8?q?internal=E3=83=98=E3=83=83=E3=83=80=E3=81=AB?= =?UTF-8?q?=E9=96=A2=E6=95=B0=E8=AA=AC=E6=98=8E=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libptouch_internal.h の内部関数宣言に用途と戻り値の簡潔な説明を付け、実装読解時の確認コストを下げる。 Made-with: Cursor --- src/lib/libptouch_internal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/libptouch_internal.h b/src/lib/libptouch_internal.h index ec4f454..4c27026 100644 --- a/src/lib/libptouch_internal.h +++ b/src/lib/libptouch_internal.h @@ -25,13 +25,18 @@ struct libptouch_ctx { uint16_t usb_pid; /* 0 if USB not open; used to pick 128- vs 560-dot raster */ }; +/* ctx に最終エラー(コードとメッセージ)を記録する。公開 API のエラー返却前に使う。 */ void ptouch_set_error(libptouch_ctx *ctx, libptouch_err_t code, const char *msg); +/* libusb のエラー番号を人が読めるメッセージにして ptouch_set_error に渡す。 */ void ptouch_set_error_usb(libptouch_ctx *ctx, int libusb_err, const char *what); +/* bulk OUT 転送。成功時 0、失敗時 libusb の負のエラーコード。 */ int ptouch_bulk_out(libusb_device_handle *h, uint8_t ep, const uint8_t *data, int len, unsigned int timeout_ms); +/* bulk IN で len バイトを揃えるまで読む。成功時 0、失敗時 libusb の負のエラーコード。 */ int ptouch_bulk_in_exact(libusb_device_handle *h, uint8_t ep, uint8_t *buf, int len, unsigned int timeout_ms); +/* ctx の bulk OUT エンドポイントへ buf を送る。印刷ジョブのチャンク送信用。 */ libptouch_err_t ptouch_bulk_send_job(libptouch_ctx *ctx, const uint8_t *buf, size_t len, const char *what);