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);