hiti: Get rid of nonfunctional legacy windows spool parsing code
It was never finished and, absent real docs, probably never will be.
This commit is contained in:
parent
33a8693f25
commit
8edc6a6f68
184
backend_hiti.c
184
backend_hiti.c
|
@ -1150,151 +1150,6 @@ static void hiti_interp33_256(uint8_t *dst, uint8_t *src, const uint8_t *pTable)
|
|||
|
||||
}
|
||||
|
||||
#if 0
|
||||
struct hiti_jobhdr { /* based on p525l, others should be similar */
|
||||
uint8_t queuename[32];
|
||||
uint8_t octname[32];
|
||||
|
||||
uint8_t zero_a[11];
|
||||
uint8_t unk_a[2]; // 6c 1b for 6x6, 6c 00 for others
|
||||
uint8_t zero_b[7];
|
||||
uint8_t unk_b[4]; // 06 00 05 00
|
||||
uint8_t zero_c[8];
|
||||
|
||||
uint8_t unk_c[8]; // 64 00 00 00 00 00 64 00
|
||||
uint8_t matte; // 01 for enabled, 00 for disabled.
|
||||
uint8_t unk_d[11]; // 00 06 00 05 00 06 00 05 00 01 00
|
||||
uint8_t zero_d[4];
|
||||
uint8_t unk_e[2]; // 05 00
|
||||
|
||||
uint8_t zero_e[114];
|
||||
|
||||
uint8_t unk_f[2]; // 32 00 for 6", 00 00 for 5"
|
||||
uint8_t unk_g[2]; // 64 00
|
||||
uint8_t zero_g[24];
|
||||
|
||||
uint8_t unk_h[8]; // 02 00 03 00 01 01 00 05
|
||||
uint8_t unk_i[2]; // 00 00 on 6", 02 00 on 5" (ribbon code?)
|
||||
uint8_t zero_i[136];
|
||||
|
||||
uint8_t printsize; // 00 = 6x4, 09 = 6x9, 0b = 5x7, 0d = 6x4-cut2, 14 = 6x6
|
||||
uint8_t unk_k[5]; // 02 01 00 01 00
|
||||
uint8_t copies;
|
||||
uint8_t unk_l[5]; // 00 00 00 03 01
|
||||
uint16_t rows; // LE!
|
||||
uint16_t cols; // LE!
|
||||
/* 0x1a2 */
|
||||
uint8_t unk_m[10]; // 2d 01 01 00 00 00 00 00 01 00
|
||||
} __attribute__((packed)); // 436 bytes
|
||||
|
||||
#define MAX_JOB_LEN (1844*2730*3+10480)
|
||||
|
||||
int hiti_read_parse_legacy(void *vctx, const void **vjob, int data_fd, int copies)
|
||||
{
|
||||
struct hiti_ctx *ctx = vctx;
|
||||
struct hiti_printjob *job = NULL;
|
||||
int i;
|
||||
|
||||
if (!ctx)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
job = malloc(sizeof(*job));
|
||||
if (!job) {
|
||||
ERROR("Memory allocation failure!\n");
|
||||
return CUPS_BACKEND_RETRY_CURRENT;
|
||||
}
|
||||
memset(job, 0, sizeof(*job));
|
||||
|
||||
job->copies = copies;
|
||||
|
||||
uint32_t job_size = 0;
|
||||
struct hiti_jobhdr hdr;
|
||||
|
||||
/* Read in data */
|
||||
while (1) {
|
||||
uint32_t remain;
|
||||
uint16_t blocktype;
|
||||
uint8_t blocksubtype;
|
||||
|
||||
int i;
|
||||
|
||||
/* Read in block header */
|
||||
i = read(data_fd, job->databuf + job->datalen, 5);
|
||||
/* If we're done, we're done! */
|
||||
if (i == 0)
|
||||
break;
|
||||
if (i < 0) {
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
if (job->databuf[job->datalen] != 0xa6) {
|
||||
ERROR("Bad header @ %d\n", job->datalen);
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
memcpy(&remain, job->databuf + job->datalen + 1, sizeof(remain));
|
||||
remain = be32_to_cpu(remain);
|
||||
if (remain < 2) {
|
||||
ERROR("Bad block length %d\n", remain);
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
job->datalen += 5;
|
||||
|
||||
/* Read in block sub-header */
|
||||
i = read(data_fd, job->databuf + job->datalen, 3);
|
||||
if (i < 0) {
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
memcpy(&blocktype, job->databuf + job->datalen, sizeof(blocktype));
|
||||
blocksubtype = job->databuf[job->datalen + 2];
|
||||
blocktype = be16_to_cpu(blocktype);
|
||||
|
||||
DEBUG("Block len %05d type %04x %02x @%d\n", remain - 3, blocktype, blocksubtype, job->datalen - 5);
|
||||
|
||||
remain -= 3;
|
||||
job->datalen += 3;
|
||||
|
||||
uint32_t blocklen = remain;
|
||||
|
||||
/* Read in block */
|
||||
while (remain) {
|
||||
i = read(data_fd, job->databuf + job->datalen, remain);
|
||||
if (i < 0) {
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
remain -= i;
|
||||
job->datalen += i;
|
||||
}
|
||||
|
||||
switch (blocktype) {
|
||||
case 0x40a1: /* Job header */
|
||||
if (blocklen != sizeof(hdr)) {
|
||||
ERROR("Header mismatch (%d vs %ld)\n", blocklen, sizeof(hdr));
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
memcpy(&hdr, job->databuf + job->datalen - blocklen, blocklen);
|
||||
job->datalen -= (blocklen + 3 + 5); /* Rewind the entire block */
|
||||
break;
|
||||
case 0x40a2: /* Page header/footer? (subtype 00/01 respectively) */
|
||||
break;
|
||||
case 0x40a3: /* Image data. Subtype matters, see end! */
|
||||
job->blocks++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEBUG("Job data blocks: %d (%d)\n", job->blocks, job_size);
|
||||
|
||||
/* Byteswap header fields! */
|
||||
hdr.rows = le16_to_cpu(hdr.rows);
|
||||
hdr.cols = le16_to_cpu(hdr.cols);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copies)
|
||||
{
|
||||
struct hiti_ctx *ctx = vctx;
|
||||
|
@ -2087,42 +1942,3 @@ struct dyesub_backend hiti_backend = {
|
|||
{ 0, 0, 0, NULL, NULL}
|
||||
}
|
||||
};
|
||||
|
||||
/* HiTi windows spool file format
|
||||
|
||||
File is organized into a series of blocks. Each has this header:
|
||||
|
||||
A6 LL LL LL LL # LL is number of bytes that follow. (32-bit BE)
|
||||
|
||||
Blocks are organized as follows:
|
||||
|
||||
40 II II <payload>
|
||||
|
||||
Known block IDs:
|
||||
|
||||
A1 xx <Initial job header block>
|
||||
A2 xx <Unknown, seen after header block and as final block>
|
||||
A3 xx <Data chunk, presumably>
|
||||
|
||||
Block A1 xx: <TBD/WIP>
|
||||
|
||||
See struct hiti_jobhdr
|
||||
|
||||
Block A2 00: START PAGE
|
||||
|
||||
a6 00 00 00 13 40 a2 00
|
||||
|
||||
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
Block A2 01: END PAGE
|
||||
|
||||
a6 00 00 00 05 40 a2 01
|
||||
|
||||
00 00 [jobid? pageid?]
|
||||
|
||||
Block A3 01: ?? page setup? 1136 byte header, 48 byte payload.
|
||||
Block A3 02: ?? 12 byte header?
|
||||
Block A3 04: ?? 292 byte header
|
||||
Block A3 05: raw BGR bitmap, to be blitted over? 384 byte header.
|
||||
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue