Skip to content

Commit

Permalink
Update specs
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
  • Loading branch information
agalakhov committed Sep 19, 2013
1 parent a0751b3 commit a8f0e15
Showing 1 changed file with 89 additions and 5 deletions.
94 changes: 89 additions & 5 deletions SPECS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ inside "ccpd" daemon.


1.1. General format of CAPT commands
------------------------------------

All transmit are in 16-bit, little-endian words. Each command has the HEADER
of 4 bytes followed:
Expand Down Expand Up @@ -54,9 +55,89 @@ Example: decimal 57 may be encoded as 0x57 0x00 and not as 0x39 0x00.


1.2. Common printer control commands


1.3. Compression control commands
------------------------------------

* 0xA0A0
NOP? Get status?

* 0xA0A1
Get printer status. See section 1.3.

* 0xA0A8
Get printer extended status. See section 1.3.

* 0xA1A0
Get printer identification string (IEEE-1284). This command does NOT use the
common reply format and just returns raw string data.

* 0xA1A1
Get printer capabitilies?


1.3. Printer status
-------------------

Extended status record (reply to the 0xA0A8 command):

0-1: uint16_t bits STATUS0
2-7: ? 00 00 0f 00 00 00 (constant sequence)
8-9: uint16_t bits STATUS1
10-11: uint16_t bits STATUS2
12-13: uint16_t bits STATUS3
14-15: uint16_t page number being decoded
16-17: uint16_t page number being printed
18-19: uint16_t page number being pushed out
20-21: uint16_t page number completed
22-23: 00 00
24-25: uint16_t bits STATUS4
26-27: 00 00
28-29: uint16_t job number being processed
30-31: uint16_t bits STATUS5
32: ? 55
33: uint8_t number of 0xE0A5 commands sent
34-35: uint16_t number of received pages
36-37: 00 00
38-39: uint16_t bits STATUS6
40-41: uint16_t number of pages in job (set by user 0xE1A1)
42-43: 00 00
44-45: uint16_t number of page printed in job
46-63: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00
64-65: uint16_t event counter
66-83: 00 00 00 ...

Status bits:

STATUS0
15: ? 0 initially, 1 after UPLOAD_0
14-12: ? 0 0 0
11: ? 0 initially, 1 after UPLOAD_0
10: ?
9: 0xA0A1 result changed
8: XSTATUS changed
7: Busy, try to get status again
6: ? 0
5-4: Uninitialized (not ready), reset by 0xE0A5
3: ?
2: 1 = buffer full (do not send data), 0 = buffer empty
1: Paper out?
0: Processing job

STATUS1

STATUS2

STATUS3

STATUS4

STATUS5

STATUS6

(to be done)

1.4. Compression control commands
---------------------------------

All 0xD0xx commands have no reply. They all are one-way.

Expand Down Expand Up @@ -121,6 +202,7 @@ of others. Band size may vary. It seems that most printers may work with
different band sizes. The algorithm is known completely.

3.1. Data encoding
------------------

Hi-SCoA data are represented as a bit stream. Bits are written MSB first. The
entire stream is always 4-byte aligned by adding 1s up to 32-bit boundary. On a
Expand All @@ -134,6 +216,7 @@ The above example becomes CE A8 BC BC.


3.2. Command encoding
---------------------

Hi-SCoA bit stream consists of commands. Command opcodes are written using
unary coding. There are 8 commands. Some commands have two subcommands which are
Expand All @@ -155,6 +238,7 @@ Bit sequence 11111111 used for alignment only and seems to be NOP.


3.3. Number encoding
--------------------

LONGREP commands use number parameter that is encoded in Elias gamma coding.
First, order is encoded by putting [order] 1s and one 0 to the stream. The order
Expand Down Expand Up @@ -187,8 +271,8 @@ The resulting value is given by: prefix = 128 * ((1 << order) - 1 - N).

Numbers of more than 512 are not encoded this way.


3.4. Command description
------------------------

Hi-SCoA uses a significantly simplified and limited variant of LZ77 compression.
In addition to the usual window it maintains a stash of no more than 16 bytes.
Expand Down Expand Up @@ -225,7 +309,7 @@ The stream consists of the following commands:
11 - unknown/never seen

Compression constants L0, L2, L3, L4, L5 and LINESIZE are sent to the
decompressor in 0xD0A0 and 0xD0A4 commands (see section 1.3). L0 is always 0,
decompressor in 0xD0A0 and 0xD0A4 commands (see section 1.4). L0 is always 0,
other values are typically
L2 = -7, L3 = 1, L4 = (not used), L5 = 4, LINESIZE = 592 or 608
L2 = -5, L3 = 4, L4 = 384, L5 = 12, LINESIZE = 592
Expand Down

0 comments on commit a8f0e15

Please sign in to comment.