-
Notifications
You must be signed in to change notification settings - Fork 16
SPECS: CAPT Protocol Executive Summary
CAPT is a proprietary full-time bi-directional printing protocol used by select Canon laser printers. The protocol's main design goal appears to be to circumvent limitations of traditional send-and-forget printing protocols, allowing devices to service jobs larger than the device's physical memory.
As an example, the LBP3000 is officially claimed to have only 2MB of memory but is still able to process jobs significantly larger than its memory size. This is accomplished by streaming the job, page-by-page, to the device. This approach makes constant two-way communication with the printer necessary.
Canon appears to have deprecated CAPT since the early 2010s in favour of newer protocols and/or PCL support in order to make better use of increasing memory capacities and processing power on devices.
CAPT streams are always binary (8 bits/byte) for efficiency. While commands are not compressed, page data is encoded in one of two different proprietary compression formats:
-
SCoA (Smart Compression Architecture): a line-by-line format which encodes the image, line by line, with run-length compression. Similarities between lines are compressed with delta encoding.
-
HiSCoA: a band-by-band (compressing multiple lines at once) format using LZ77 and Elias coding. Introduced in the mid-2000s.
-
The
SPECS
file currently claims that Elias gamma coding is used in HiSCoA compression, but this is not completely accurate. While an Elias-style universal coding method is used, the codes are different from Peter Elias' original gamma code. -
TODO: Does any device support both formats?
A typical conversation with the printer device during a print job goes like this:
define wait_for_printer as:
while not printer.ready_to_receive:
check if printer.ready_to_receive
# 1
setup printer
wait_for_printer
send job.prologue
foreach page in job:
# 2
wait_for_printer
send page.prologue
foreach packet in page:
wait_for_printer
send packet
print page
wait_for_printer
send page.epilogue
wait_for_printer
send job.epilogue
Pages are often broken down into multiple packets, to be sent to the device over multiple transmissions.
Ideally, the page data should be prepared ahead of time, at #1
, or in the background.
Studies suggest that CAPT devices are able to begin receiving the next page before a page has finished printing. This capability is essential for full-speed printing.
Note: captdriver currently prepares only the first page of the job at
#1
; subsequent pages are processed at#2
. Page rendering and printing are not performed at the same time. This causes long pauses in the print job. A remedy to this shortcoming is an ongoing long-term project goal.
Commands are multi-byte binary packets that begin with an opcode, followed the total size of the packet, in turn followed by the payload containing command parameters or page data.
The exact command set varies between devices, but all devices should have the following types of commands:
-
Printer Status: check the state of the printer, including readiness to receive data as well as problems preventing normal operation.
-
Job Prologue: tells a printer to start receiving pages from a particular job.
-
Page Prologue: indicates the start of a page and its size, and other print settings
-
Page Epilogue: indicates the end of a page
-
Job Epilogue: tells a printer that the job has concluded and that the next job may be sent.
Four major versions of the protocol are known at time of writing:
-
1: First version, used by devices including the LBP800, LBP1120 and LBP3200.
-
2.0: Enhancement of CAPT 1 that adds colour support and introduces HiSCoA compression. Used by devices including the LBP5200 (and probably the LBP2410).
-
2.1: Major revision improving network support when using the Axis plug-in adaptors or cards. Used by devices including the LBP2900 and LBP3000.
-
3: Enhancement of CAPT 2.1 further improving network support, while adding support for print quality features such as Special Print Mode intended to make barcode printing more reliable. Used by devices including the LBP3010, LBP3100, LBP6000 and LBP7200.
The CAPT protocol version used by the printer is explicitly declared in the IEEE 1284 identification string communicated by the printer device when it is first attached to a host by USB.
Device-specific commands have been found on some devices, presumably to cater for its capabilities and characteristics. This appears to be an implementation of the Remote Procedure Call pattern, where the host system executes programs on the printer device. CAPT is a very host-dependent protocol, and printer devices often rely on the host to decide when to execute programs on the device.
Content in this wiki is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Any errors, omissions or suggestions? File an issue and apply the wiki
label.
Bookmarks
Unofficial Introduction to CAPT (Executive Summary)
Rootless Write Access To USB Devices
Other Canon Printer-Related Projects
SPECS: 0xA1A1
Command and Response Format
Search for pages starting with
-
SPECS
for notes on the operation of the CAPT data formats and communications protocol -
TESTING
for guidelines on testing Captdriver -
TIPS
for potentially helpful information on studying the project or the CAPT format-protocol