Fix up bad whitespacing.
This commit is contained in:
parent
49f7e227d2
commit
487ccc9f71
|
@ -92,7 +92,7 @@ struct printer_data {
|
|||
int16_t pgcode_offset; /* Offset into printjob for paper type */
|
||||
int16_t paper_code_offset; /* Offset in readback for paper type */
|
||||
int (*error_detect)(uint8_t *rdbuf);
|
||||
char *(*pgcode_names)(uint8_t pgcode);
|
||||
char *(*pgcode_names)(uint8_t pgcode);
|
||||
};
|
||||
|
||||
static char *generic_pgcode_names(uint8_t pgcode)
|
||||
|
@ -137,7 +137,7 @@ static int es2_error_detect(uint8_t *rdbuf)
|
|||
ERROR("Printer cover open!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (rdbuf[0] == 0x02 &&
|
||||
rdbuf[4] == 0x05 &&
|
||||
rdbuf[5] == 0x05 &&
|
||||
|
@ -165,13 +165,13 @@ static int es3_error_detect(uint8_t *rdbuf)
|
|||
ATTR("marker-levels=%d\n", 0);
|
||||
ERROR("No media loaded!\n");
|
||||
} else {
|
||||
ERROR("Unknown error - %02x + %02x\n",
|
||||
ERROR("Unknown error - %02x + %02x\n",
|
||||
rdbuf[8], rdbuf[10]);
|
||||
}
|
||||
return 1;
|
||||
} else if (rdbuf[8] == 0x03 &&
|
||||
rdbuf[10] == 0x02) {
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ERROR("No media loaded!\n");
|
||||
return 1;
|
||||
} else if (rdbuf[8] == 0x08 &&
|
||||
|
@ -185,11 +185,11 @@ static int es3_error_detect(uint8_t *rdbuf)
|
|||
}
|
||||
|
||||
if (rdbuf[8] || rdbuf[10]) {
|
||||
ERROR("Unknown error - %02x + %02x\n",
|
||||
ERROR("Unknown error - %02x + %02x\n",
|
||||
rdbuf[8], rdbuf[10]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static int es40_error_detect(uint8_t *rdbuf)
|
|||
/* ES40 */
|
||||
if (!rdbuf[3])
|
||||
return 0;
|
||||
|
||||
|
||||
if (rdbuf[3] == 0x01)
|
||||
ERROR("Generic communication error\n");
|
||||
else if (rdbuf[3] == 0x32) {
|
||||
|
@ -206,7 +206,7 @@ static int es40_error_detect(uint8_t *rdbuf)
|
|||
ERROR("Cover open or media empty!\n");
|
||||
} else
|
||||
ERROR("Unknown error - %02x\n", rdbuf[3]);
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ static int cp790_error_detect(uint8_t *rdbuf)
|
|||
if ((rdbuf[3] & 0xf) == 0x02) { // 0x12 0x22
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ERROR("No paper tray loaded!\n");
|
||||
} else if ((rdbuf[3] & 0xf) == 0x03) { // 0x13 0x23
|
||||
} else if ((rdbuf[3] & 0xf) == 0x03) { // 0x13 0x23
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ERROR("Empty paper tray or feed error!\n");
|
||||
} else if (rdbuf[3] == 0x11)
|
||||
|
@ -253,7 +253,7 @@ static int cp10_error_detect(uint8_t *rdbuf)
|
|||
return 0;
|
||||
|
||||
if (rdbuf[2] == 0x80) {
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ERROR("No ribbon loaded\n");
|
||||
} else if (rdbuf[2] == 0x08) {
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
|
@ -272,7 +272,7 @@ static int cpxxx_error_detect(uint8_t *rdbuf)
|
|||
return 0;
|
||||
|
||||
if (rdbuf[2] == 0x01) {
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ATTR("marker-levels=%d\n", 0);
|
||||
ERROR("Paper feed problem!\n");
|
||||
} else if (rdbuf[2] == 0x04)
|
||||
ERROR("Ribbon problem!\n");
|
||||
|
@ -363,7 +363,7 @@ static struct printer_data selphy_printers[] = {
|
|||
.pgcode_offset = 2,
|
||||
.paper_code_offset = -1, /* Uses a different technique */
|
||||
.error_detect = cp790_error_detect,
|
||||
.pgcode_names = generic_pgcode_names,
|
||||
.pgcode_names = generic_pgcode_names,
|
||||
},
|
||||
{ .type = P_CP_XXX,
|
||||
.model = "SELPHY CP Series (!CP-10/CP790)",
|
||||
|
@ -379,7 +379,7 @@ static struct printer_data selphy_printers[] = {
|
|||
.pgcode_offset = 3,
|
||||
.paper_code_offset = 6,
|
||||
.error_detect = cpxxx_error_detect,
|
||||
.pgcode_names = generic_pgcode_names,
|
||||
.pgcode_names = generic_pgcode_names,
|
||||
},
|
||||
{ .type = P_CP10,
|
||||
.model = "SELPHY CP-10",
|
||||
|
@ -395,7 +395,7 @@ static struct printer_data selphy_printers[] = {
|
|||
.pgcode_offset = 2,
|
||||
.paper_code_offset = -1,
|
||||
.error_detect = cp10_error_detect,
|
||||
.pgcode_names = cp10_pgcode_names,
|
||||
.pgcode_names = cp10_pgcode_names,
|
||||
},
|
||||
{ .type = -1 },
|
||||
};
|
||||
|
@ -411,7 +411,7 @@ static void setup_paper_codes(void)
|
|||
if (selphy_printers[i].type == -1)
|
||||
break;
|
||||
/* Default all to IGNORE */
|
||||
for (j = 0 ; j < 256 ; j++)
|
||||
for (j = 0 ; j < 256 ; j++)
|
||||
selphy_printers[i].paper_codes[j] = -1;
|
||||
|
||||
/* Set up specifics */
|
||||
|
@ -467,10 +467,10 @@ enum {
|
|||
S_FINISHED,
|
||||
};
|
||||
|
||||
static int fancy_memcmp(const uint8_t *buf_a, const int16_t *buf_b, uint len)
|
||||
static int fancy_memcmp(const uint8_t *buf_a, const int16_t *buf_b, uint len)
|
||||
{
|
||||
uint i;
|
||||
|
||||
|
||||
for (i = 0 ; i < len ; i++) {
|
||||
if (buf_b[i] == -1)
|
||||
continue;
|
||||
|
@ -482,7 +482,7 @@ static int fancy_memcmp(const uint8_t *buf_a, const int16_t *buf_b, uint len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int parse_printjob(uint8_t *buffer, uint8_t *bw_mode, uint32_t *plane_len)
|
||||
static int parse_printjob(uint8_t *buffer, uint8_t *bw_mode, uint32_t *plane_len)
|
||||
{
|
||||
int printer_type = -1;
|
||||
|
||||
|
@ -490,7 +490,7 @@ static int parse_printjob(uint8_t *buffer, uint8_t *bw_mode, uint32_t *plane_len
|
|||
buffer[1] != 0x00) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
if (buffer[12] == 0x40 &&
|
||||
buffer[13] == 0x01) {
|
||||
*plane_len = *(uint32_t*)(&buffer[16]);
|
||||
|
@ -599,7 +599,7 @@ static void *canonselphy_init(void)
|
|||
|
||||
extern struct dyesub_backend canonselphy_backend;
|
||||
|
||||
static void canonselphy_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static void canonselphy_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct canonselphy_ctx *ctx = vctx;
|
||||
|
@ -678,7 +678,7 @@ static int canonselphy_read_parse(void *vctx, int data_fd)
|
|||
if (i != MAX_HEADER - offset) {
|
||||
if (i == 0)
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
ERROR("Read failed (%d/%d)\n",
|
||||
ERROR("Read failed (%d/%d)\n",
|
||||
i, MAX_HEADER - offset);
|
||||
perror("ERROR: Read failed");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -691,9 +691,9 @@ static int canonselphy_read_parse(void *vctx, int data_fd)
|
|||
if (ctx->type == P_CP790)
|
||||
printer_type = P_CP790;
|
||||
else
|
||||
printer_type = P_ES40;
|
||||
printer_type = P_ES40;
|
||||
}
|
||||
|
||||
|
||||
/* Look up the printer entry */
|
||||
for (i = 0; selphy_printers[i].type != -1; i++) {
|
||||
if (selphy_printers[i].type == printer_type) {
|
||||
|
@ -758,7 +758,7 @@ static int canonselphy_read_parse(void *vctx, int data_fd)
|
|||
|
||||
/* Move over chunks already read in */
|
||||
memcpy(ctx->header, ctx->buffer, ctx->printer->init_length);
|
||||
memcpy(ctx->plane_y, ctx->buffer+ctx->printer->init_length,
|
||||
memcpy(ctx->plane_y, ctx->buffer+ctx->printer->init_length,
|
||||
MAX_HEADER-ctx->printer->init_length);
|
||||
|
||||
/* Read in YELLOW plane */
|
||||
|
@ -864,7 +864,7 @@ top:
|
|||
INFO("Waiting for printer idle\n");
|
||||
if (fancy_memcmp(rdbuf, ctx->printer->init_readback, READBACK_LEN))
|
||||
break;
|
||||
|
||||
|
||||
/* Make sure paper/ribbon is correct */
|
||||
if (ctx->paper_code != -1) {
|
||||
if (ctx->type == P_CP_XXX) {
|
||||
|
@ -892,7 +892,7 @@ top:
|
|||
} else {
|
||||
if (rdbuf[ctx->printer->paper_code_offset] !=
|
||||
ctx->paper_code) {
|
||||
ERROR("Incorrect media/ribbon loaded (%02x vs %02x), aborting job!\n",
|
||||
ERROR("Incorrect media/ribbon loaded (%02x vs %02x), aborting job!\n",
|
||||
ctx->paper_code,
|
||||
rdbuf[ctx->printer->paper_code_offset]);
|
||||
return CUPS_BACKEND_HOLD; /* Hold this job, don't stop queue */
|
||||
|
@ -904,7 +904,7 @@ top:
|
|||
|
||||
if (ribbon == 0xf) {
|
||||
ERROR("No ribbon loaded, aborting!\n");
|
||||
return CUPS_BACKEND_STOP;
|
||||
return CUPS_BACKEND_STOP;
|
||||
} else if (ribbon != ctx->paper_code) {
|
||||
ERROR("Incorrect ribbon loaded, aborting job!\n");
|
||||
return CUPS_BACKEND_HOLD;
|
||||
|
@ -977,7 +977,7 @@ top:
|
|||
if (!fancy_memcmp(rdbuf, ctx->printer->done_c_readback, READBACK_LEN)) {
|
||||
if (ctx->cp900)
|
||||
state = S_PRINTER_CP900_FOOTER;
|
||||
else
|
||||
else
|
||||
state = S_FINISHED;
|
||||
}
|
||||
break;
|
||||
|
@ -985,7 +985,7 @@ top:
|
|||
uint32_t empty = 0;
|
||||
|
||||
INFO("Sending CP900 Footer\n");
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
(uint8_t*)&empty, sizeof(empty))))
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
|
@ -1002,7 +1002,7 @@ top:
|
|||
state = S_FINISHED;
|
||||
/* Intentional Fallthrough */
|
||||
case S_FINISHED:
|
||||
INFO("All data sent to printer!\n");
|
||||
INFO("All data sent to printer!\n");
|
||||
break;
|
||||
}
|
||||
if (state != S_FINISHED)
|
||||
|
@ -1177,7 +1177,7 @@ struct dyesub_backend canonselphy_backend = {
|
|||
16 01 00 00 [pg] 00 [pg2] 00 00 00 00 00 [error, cover open]
|
||||
02 00 00 00 05 05 02 00 00 00 00 00 [error, no media]
|
||||
|
||||
[xx] can be 0x00 or 0xff, depending on if a previous print job has
|
||||
[xx] can be 0x00 or 0xff, depending on if a previous print job has
|
||||
completed or not.
|
||||
|
||||
[pg] is: 0x01 for P-papers
|
||||
|
@ -1193,7 +1193,7 @@ struct dyesub_backend canonselphy_backend = {
|
|||
Selphy ES3/30:
|
||||
|
||||
Init func: 40 00 [pgcode] [type] 00 00 00 00 00 00 00 00 [length, 32-bit LE]
|
||||
Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00
|
||||
Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00
|
||||
|
||||
End func: 40 20 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
|
@ -1232,7 +1232,7 @@ struct dyesub_backend canonselphy_backend = {
|
|||
Selphy ES40:
|
||||
|
||||
Init func: 40 00 [pgcode] [type] 00 00 00 00 00 00 00 00 [length, 32-bit LE]
|
||||
Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00
|
||||
Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00
|
||||
|
||||
End func: 40 20 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
|
@ -1276,7 +1276,7 @@ struct dyesub_backend canonselphy_backend = {
|
|||
Selphy CP790:
|
||||
|
||||
Init func: 40 00 [pgcode] 00 00 00 00 00 00 00 00 00 [length, 32-bit LE]
|
||||
Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00
|
||||
Plane func: 40 01 [plane] 00 00 00 00 00 00 00 00 00
|
||||
|
||||
End func: 40 20 00 00 00 00 00 00 00 00 00 00
|
||||
|
||||
|
@ -1293,7 +1293,7 @@ struct dyesub_backend canonselphy_backend = {
|
|||
|
||||
00 00 ff 00 [pg1] [pg2] 00 00 00 00 00 02
|
||||
00 00 00 00 [pg1] [pg2] 00 00 00 00 00 02 [idle, ready for header]
|
||||
00 00 01 00 [pg1] [pg2] 00 00 00 00 00 02
|
||||
00 00 01 00 [pg1] [pg2] 00 00 00 00 00 02
|
||||
00 01 01 00 [pg1] [pg2] 00 00 00 00 00 02 [ready for Y data]
|
||||
00 03 01 00 [pg1] [pg2] 00 00 00 00 00 02 [transitions to this]
|
||||
00 03 02 00 [pg1] [pg2] 00 00 00 00 00 02 [ready for M data]
|
||||
|
@ -1326,7 +1326,7 @@ struct dyesub_backend canonselphy_backend = {
|
|||
Selphy CP-10:
|
||||
|
||||
Init func: 40 00 00 00 00 00 00 00 00 00 00 00
|
||||
Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00
|
||||
Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00
|
||||
|
||||
plane codes are 0x00, 0x01, 0x02 for Y, M, and C, respectively.
|
||||
|
||||
|
@ -1353,13 +1353,13 @@ struct dyesub_backend canonselphy_backend = {
|
|||
|
||||
***************************************************************************
|
||||
Selphy CP-series (except for CP790 & CP-10):
|
||||
|
||||
|
||||
This is known to apply to:
|
||||
CP-100, CP-200, CP-300, CP-330, CP400, CP500, CP510, CP710,
|
||||
CP720, CP730, CP740, CP750, CP760, CP770, CP780, CP800, CP900
|
||||
|
||||
Init func: 40 00 00 [pgcode] 00 00 00 00 00 00 00 00
|
||||
Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00
|
||||
Plane func: 40 01 00 [plane] [length, 32-bit LE] 00 00 00 00
|
||||
End func: 00 00 00 00 # NOTE: Present (and necessary) on CP900 only.
|
||||
|
||||
Error clear: 40 10 00 00 00 00 00 00 00 00 00 00
|
||||
|
|
|
@ -154,7 +154,7 @@ static void *selphyneo_init(void)
|
|||
|
||||
extern struct dyesub_backend selphyneo_backend;
|
||||
|
||||
static void selphyneo_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static void selphyneo_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct selphyneo_ctx *ctx = vctx;
|
||||
|
@ -197,7 +197,7 @@ static int selphyneo_read_parse(void *vctx, int data_fd)
|
|||
if (i != sizeof(hdr)) {
|
||||
if (i == 0)
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
ERROR("Read failed (%d/%d)\n",
|
||||
ERROR("Read failed (%d/%d)\n",
|
||||
i, (int)sizeof(hdr));
|
||||
perror("ERROR: Read failed");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -215,19 +215,19 @@ static int selphyneo_read_parse(void *vctx, int data_fd)
|
|||
hdr.data[10], le32_to_cpu(hdr.cols), le32_to_cpu(hdr.rows));
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a buffer */
|
||||
ctx->datalen = 0;
|
||||
ctx->databuf = malloc(remain + sizeof(hdr));
|
||||
if (!ctx->databuf) {
|
||||
ERROR("Memory allocation failure!\n");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Store the read-in header */
|
||||
memcpy(ctx->databuf, &hdr, sizeof(hdr));
|
||||
ctx->datalen += sizeof(hdr);
|
||||
|
||||
|
||||
/* Read in data */
|
||||
while (remain > 0) {
|
||||
i = read(data_fd, ctx->databuf + ctx->datalen, remain);
|
||||
|
@ -243,7 +243,7 @@ static int selphyneo_read_parse(void *vctx, int data_fd)
|
|||
static int selphyneo_main_loop(void *vctx, int copies) {
|
||||
struct selphyneo_ctx *ctx = vctx;
|
||||
struct selphyneo_readback rdback;
|
||||
|
||||
|
||||
int ret, num;
|
||||
|
||||
/* Read in the printer status to clear last state */
|
||||
|
@ -261,13 +261,13 @@ static int selphyneo_main_loop(void *vctx, int copies) {
|
|||
|
||||
ATTR("marker-types=ribbonWax\n");
|
||||
|
||||
top:
|
||||
top:
|
||||
INFO("Waiting for printer idle\n");
|
||||
|
||||
do {
|
||||
ret = read_data(ctx->dev, ctx->endp_up,
|
||||
(uint8_t*) &rdback, sizeof(rdback), &num);
|
||||
|
||||
|
||||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
|
@ -294,7 +294,7 @@ top:
|
|||
|
||||
ATTR("marker-levels=%d\n", -3); /* ie Unknown but OK */
|
||||
|
||||
INFO("Sending spool data\n");
|
||||
INFO("Sending spool data\n");
|
||||
/* Send the data over in 256K chunks */
|
||||
{
|
||||
int chunk = 256*1024;
|
||||
|
@ -318,7 +318,7 @@ top:
|
|||
do {
|
||||
ret = read_data(ctx->dev, ctx->endp_up,
|
||||
(uint8_t*) &rdback, sizeof(rdback), &num);
|
||||
|
||||
|
||||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
|
@ -374,7 +374,7 @@ static int selphyneo_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
GETOPT_PROCESS_GLOBAL
|
||||
case 'R':
|
||||
selphyneo_send_reset(ctx);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (j) return j;
|
||||
|
@ -443,7 +443,7 @@ struct dyesub_backend canonselphyneo_backend = {
|
|||
L == 5087264 == 1695744 * 3 + 32 (1472*1152)
|
||||
C == 2180384 == 726784 * 3 + 32 (1088*668)
|
||||
|
||||
It is worth mentioning that the Y'CbCr image data is surmised to use the
|
||||
It is worth mentioning that the Y'CbCr image data is surmised to use the
|
||||
JPEG coefficients, although we realistically have no way of confirming this.
|
||||
|
||||
Other questions:
|
||||
|
@ -474,7 +474,7 @@ struct dyesub_backend canonselphyneo_backend = {
|
|||
|
||||
ZZ == Media?
|
||||
|
||||
01
|
||||
01
|
||||
10
|
||||
11
|
||||
^-- Ribbon
|
||||
|
|
|
@ -310,7 +310,7 @@ static void cw01_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
|
||||
device = libusb_get_device(dev);
|
||||
libusb_get_device_descriptor(device, &desc);
|
||||
|
||||
|
||||
ctx->type = lookup_printer_type(&cw01_backend,
|
||||
desc.idVendor, desc.idProduct);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ static int cw01_read_parse(void *vctx, int data_fd) {
|
|||
}
|
||||
|
||||
i = read(data_fd, (uint8_t*) &ctx->hdr, sizeof(struct cw01_spool_hdr));
|
||||
|
||||
|
||||
if (i < 0)
|
||||
return i;
|
||||
if (i == 0)
|
||||
|
@ -347,7 +347,7 @@ static int cw01_read_parse(void *vctx, int data_fd) {
|
|||
|
||||
if (i < (int)sizeof(struct cw01_spool_hdr))
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
|
||||
|
||||
if (ctx->hdr.type > 0x06 || ctx->hdr.res > 0x01) {
|
||||
ERROR("Unrecognized header data format!\n");
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
|
@ -409,7 +409,7 @@ top:
|
|||
if (!resp)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
cw01_cleanup_string((char*)resp, len);
|
||||
|
||||
|
||||
/* Check to see if we have sufficient buffers */
|
||||
// XXX audit these rules...?
|
||||
if (!strcmp("FBP00", (char*)resp) ||
|
||||
|
@ -620,7 +620,7 @@ static int cw01_get_info(struct cw01_ctx *ctx)
|
|||
|
||||
cw01_cleanup_string((char*)resp, len);
|
||||
|
||||
INFO("Media Lot Code: '%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x'\n",
|
||||
INFO("Media Lot Code: '%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x'\n",
|
||||
*(resp+2), *(resp+3), *(resp+4), *(resp+5), *(resp+6), *(resp+7),
|
||||
*(resp+8), *(resp+9), *(resp+10), *(resp+11), *(resp+12), *(resp+13));
|
||||
|
||||
|
@ -874,7 +874,7 @@ struct dyesub_backend cw01_backend = {
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
Basic spool file format:
|
||||
|
||||
|
@ -888,7 +888,7 @@ TT RR NN 00 XX XX XX XX 00 00 00 00 <- FILE header.
|
|||
|
||||
Followed by three planes, each with this header:
|
||||
|
||||
28 00 00 00 00 08 00 00 RR RR 00 00 01 00 08 00
|
||||
28 00 00 00 00 08 00 00 RR RR 00 00 01 00 08 00
|
||||
00 00 00 00 00 00 00 00 5a 33 00 00 YY YY 00 00
|
||||
00 01 00 00 00 00 00 00
|
||||
|
||||
|
@ -897,7 +897,7 @@ Followed by three planes, each with this header:
|
|||
|
||||
Followed by 1024 bytes of color tables:
|
||||
|
||||
ff ff ff 00 ... 00 00 00 00
|
||||
ff ff ff 00 ... 00 00 00 00
|
||||
|
||||
1024+40 = 1064 bytes of header per plane.
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int send_data(struct libusb_device_handle *dev, uint8_t endp,
|
||||
int send_data(struct libusb_device_handle *dev, uint8_t endp,
|
||||
uint8_t *buf, int len)
|
||||
{
|
||||
int num = 0;
|
||||
|
@ -318,7 +318,7 @@ static char *url_encode(char *str) {
|
|||
}
|
||||
|
||||
while (*pstr) {
|
||||
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
|
||||
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
|
||||
*pbuf++ = *pstr;
|
||||
else if (*pstr == ' ')
|
||||
*pbuf++ = '+';
|
||||
|
@ -410,7 +410,7 @@ static int print_scan_output(struct libusb_device *device,
|
|||
break;
|
||||
}
|
||||
|
||||
/* Query IEEE1284 info only if it's a PRINTER class */
|
||||
/* Query IEEE1284 info only if it's a PRINTER class */
|
||||
if (desc->bDeviceClass == LIBUSB_CLASS_PRINTER ||
|
||||
(desc->bDeviceClass == LIBUSB_CLASS_PER_INTERFACE &&
|
||||
config->interface[iface].altsetting[altset].bInterfaceClass == LIBUSB_CLASS_PRINTER)) {
|
||||
|
@ -519,7 +519,7 @@ static int print_scan_output(struct libusb_device *device,
|
|||
strncpy(buf + k, product, sizeof(buf)-k);
|
||||
|
||||
fprintf(stdout, "direct %s://%s?serial=%s&backend=%s \"%s\" \"%s\" \"%s\" \"\"\n",
|
||||
prefix, buf, serial, backend->uri_prefix,
|
||||
prefix, buf, serial, backend->uri_prefix,
|
||||
descr, descr,
|
||||
ieee_id? ieee_id : "");
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ extern struct dyesub_backend cw01_backend;
|
|||
|
||||
static struct dyesub_backend *backends[] = {
|
||||
&canonselphy_backend,
|
||||
&canonselphyneo_backend,
|
||||
&canonselphyneo_backend,
|
||||
&kodak6800_backend,
|
||||
&kodak605_backend,
|
||||
&kodak1400_backend,
|
||||
|
@ -588,7 +588,7 @@ static struct dyesub_backend *backends[] = {
|
|||
&updr150_backend,
|
||||
&mitsu70x_backend,
|
||||
&mitsu9550_backend,
|
||||
&mitsup95d_backend,
|
||||
&mitsup95d_backend,
|
||||
&dnpds40_backend,
|
||||
&cw01_backend,
|
||||
NULL,
|
||||
|
@ -952,7 +952,7 @@ int main (int argc, char **argv)
|
|||
endp_down = config->interface[iface].altsetting[altset].endpoint[i].bEndpointAddress;
|
||||
}
|
||||
if (endp_up && endp_down)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (config)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
//#define DNP_ONLY
|
||||
|
||||
/* Enables caching of last print type to speed up
|
||||
/* Enables caching of last print type to speed up
|
||||
job pipelining. Without this we always have to
|
||||
assume the worst */
|
||||
//#define STATE_DIR "/tmp"
|
||||
|
@ -88,7 +88,7 @@ struct dnpds40_ctx {
|
|||
uint32_t last_multicut;
|
||||
int last_matte;
|
||||
|
||||
int fullcut;
|
||||
int fullcut;
|
||||
int matte;
|
||||
int cutter;
|
||||
int can_rewind;
|
||||
|
@ -105,7 +105,7 @@ struct dnpds40_ctx {
|
|||
int supports_3x5x2;
|
||||
int supports_matte;
|
||||
int supports_finematte;
|
||||
int supports_luster;
|
||||
int supports_luster;
|
||||
int supports_advmatte;
|
||||
int supports_fullcut;
|
||||
int supports_rewind;
|
||||
|
@ -419,7 +419,7 @@ static int dnpds40_do_cmd(struct dnpds40_ctx *ctx,
|
|||
(uint8_t*)cmd, sizeof(*cmd))))
|
||||
return ret;
|
||||
|
||||
if (data && len)
|
||||
if (data && len)
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
data, len)))
|
||||
return ret;
|
||||
|
@ -881,10 +881,10 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
|
|||
}
|
||||
|
||||
/* There's no way to figure out the total job length in advance, we
|
||||
have to parse the stream until we get to the image plane data,
|
||||
have to parse the stream until we get to the image plane data,
|
||||
and even then the stream can contain arbitrary commands later.
|
||||
|
||||
So instead, we allocate a buffer of the maximum possible length,
|
||||
So instead, we allocate a buffer of the maximum possible length,
|
||||
then parse the incoming stream until we hit the START command at
|
||||
the end of the job.
|
||||
*/
|
||||
|
@ -910,7 +910,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
|
|||
while (run) {
|
||||
int remain, i, j;
|
||||
/* Read in command header */
|
||||
i = read(data_fd, ctx->databuf + ctx->datalen,
|
||||
i = read(data_fd, ctx->databuf + ctx->datalen,
|
||||
sizeof(struct dnpds40_cmd));
|
||||
if (i < 0)
|
||||
return i;
|
||||
|
@ -932,7 +932,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
|
|||
/* Read in data chunk as quickly as possible */
|
||||
remain = j;
|
||||
while (remain > 0) {
|
||||
i = read(data_fd, ctx->databuf + ctx->datalen + sizeof(struct dnpds40_cmd),
|
||||
i = read(data_fd, ctx->databuf + ctx->datalen + sizeof(struct dnpds40_cmd),
|
||||
remain);
|
||||
if (i < 0) {
|
||||
ERROR("Data Read Error: %d (%d/%d @%d)\n", i, remain, j, ctx->datalen);
|
||||
|
@ -948,7 +948,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
|
|||
/* Check for some offsets */
|
||||
if(!memcmp("CNTRL QTY", ctx->databuf + ctx->datalen+2, 9)) {
|
||||
/* Ignore this. We will insert our own later on */
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
if(!memcmp("CNTRL CUTTER", ctx->databuf + ctx->datalen+2, 12)) {
|
||||
memcpy(buf, ctx->databuf + ctx->datalen + 32, 8);
|
||||
|
@ -1125,7 +1125,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
|
|||
case P_DNP_DS80D:
|
||||
if (ctx->matte) {
|
||||
int mcut = ctx->multicut;
|
||||
|
||||
|
||||
if (mcut > MULTICUT_S_BACK)
|
||||
mcut -= MULTICUT_S_BACK;
|
||||
else if (mcut > MULTICUT_S_FRONT)
|
||||
|
@ -1945,7 +1945,7 @@ static int dnpds40_get_info(struct dnpds40_ctx *ctx)
|
|||
|
||||
dnpds40_cleanup_string((char*)resp, len);
|
||||
i = atoi((char*)resp);
|
||||
|
||||
|
||||
INFO("Standby Transition time: %d minutes\n", i);
|
||||
|
||||
free(resp);
|
||||
|
@ -1960,7 +1960,7 @@ static int dnpds40_get_info(struct dnpds40_ctx *ctx)
|
|||
dnpds40_cleanup_string((char*)resp, len);
|
||||
i = atoi((char*)resp);
|
||||
INFO("Media End kept across power cycles: %s\n",
|
||||
i ? "Yes" : "No");
|
||||
i ? "Yes" : "No");
|
||||
|
||||
free(resp);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ static int send_plane(struct kodak1400_ctx *ctx,
|
|||
cmdbuf[1] = 0x74;
|
||||
cmdbuf[2] = 0x00;
|
||||
cmdbuf[3] = 0x50;
|
||||
|
||||
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
cmdbuf, CMDBUF_LEN)))
|
||||
return ret;
|
||||
|
@ -127,7 +127,7 @@ static int send_plane(struct kodak1400_ctx *ctx,
|
|||
int i;
|
||||
for (i = 0 ; i < ctx->hdr.rows ; i++) {
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
planedata + i * ctx->hdr.columns,
|
||||
planedata + i * ctx->hdr.columns,
|
||||
ctx->hdr.columns)))
|
||||
return ret;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ static int send_plane(struct kodak1400_ctx *ctx,
|
|||
cmdbuf[1] = 0x74;
|
||||
cmdbuf[2] = 0x01;
|
||||
cmdbuf[3] = 0x50;
|
||||
|
||||
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
cmdbuf, CMDBUF_LEN)))
|
||||
return ret;
|
||||
|
@ -194,10 +194,10 @@ static int kodak1400_set_tonecurve(struct kodak1400_ctx *ctx, char *fname)
|
|||
ret = -3;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
ret = read_data(dev, endp_up,
|
||||
respbuf, sizeof(respbuf), &num);
|
||||
|
||||
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
if (num != 8) {
|
||||
|
@ -231,7 +231,7 @@ static int kodak1400_set_tonecurve(struct kodak1400_ctx *ctx, char *fname)
|
|||
/* get the response */
|
||||
ret = read_data(dev, endp_up,
|
||||
respbuf, sizeof(respbuf), &num);
|
||||
|
||||
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
if (num != 8) {
|
||||
|
@ -288,11 +288,11 @@ static void *kodak1400_init(void)
|
|||
return NULL;
|
||||
}
|
||||
memset(ctx, 0, sizeof(struct kodak1400_ctx));
|
||||
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static void kodak1400_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static void kodak1400_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct kodak1400_ctx *ctx = vctx;
|
||||
|
@ -352,7 +352,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) {
|
|||
if (ret < 0 || ret != sizeof(ctx->hdr)) {
|
||||
if (ret == 0)
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ret, 0, (int)sizeof(ctx->hdr));
|
||||
perror("ERROR: Read failed");
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
|
@ -367,7 +367,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) {
|
|||
ctx->hdr.planesize = le32_to_cpu(ctx->hdr.planesize);
|
||||
ctx->hdr.rows = le16_to_cpu(ctx->hdr.rows);
|
||||
ctx->hdr.columns = le16_to_cpu(ctx->hdr.columns);
|
||||
|
||||
|
||||
/* Set up plane data */
|
||||
ctx->plane_r = malloc(ctx->hdr.planesize);
|
||||
ctx->plane_g = malloc(ctx->hdr.planesize);
|
||||
|
@ -392,7 +392,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) {
|
|||
do {
|
||||
ret = read(data_fd, ptr, remain);
|
||||
if (ret < 0) {
|
||||
ERROR("Read failed (%d/%d/%u) (%d/%u @ %d)\n",
|
||||
ERROR("Read failed (%d/%d/%u) (%d/%u @ %d)\n",
|
||||
ret, remain, ctx->hdr.columns,
|
||||
i, ctx->hdr.rows, j);
|
||||
perror("ERROR: Read failed");
|
||||
|
@ -437,7 +437,7 @@ top:
|
|||
/* Read in the printer status */
|
||||
ret = read_data(ctx->dev, ctx->endp_up,
|
||||
rdbuf, READBACK_LEN, &num);
|
||||
|
||||
|
||||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
if (memcmp(rdbuf, rdbuf2, READBACK_LEN)) {
|
||||
|
@ -454,7 +454,7 @@ top:
|
|||
return CUPS_BACKEND_STOP; // HOLD/CANCEL/FAILED? XXXX parse error!
|
||||
}
|
||||
|
||||
fflush(stderr);
|
||||
fflush(stderr);
|
||||
|
||||
switch (state) {
|
||||
case S_IDLE:
|
||||
|
@ -650,14 +650,14 @@ struct dyesub_backend kodak1400_backend = {
|
|||
XX 01 to laminate, 00 to not.
|
||||
01 Unknown, always set to 01
|
||||
XX Lamination Strength:
|
||||
|
||||
|
||||
3c Glossy
|
||||
28 Matte +5
|
||||
2e Matte +4
|
||||
34 Matte +3
|
||||
3a Matte +2
|
||||
40 Matte +1
|
||||
46 Matte
|
||||
46 Matte
|
||||
52 Matte -1
|
||||
5e Matte -2
|
||||
6a Matte -3
|
||||
|
@ -674,7 +674,7 @@ struct dyesub_backend kodak1400_backend = {
|
|||
All readback values are 8 bytes long.
|
||||
|
||||
Multi-byte numbers are sent BIG ENDIAN.
|
||||
|
||||
|
||||
Image data is sent via planes, one scanline per URB.
|
||||
|
||||
<-- 1b 72 # Status query
|
||||
|
@ -682,7 +682,7 @@ struct dyesub_backend kodak1400_backend = {
|
|||
|
||||
<-- 1b 00 # Reset/attention?
|
||||
<-- 1b 5a 53 0a 00 0b c2 # Setup (ie hdr.columns and hdr.rows)
|
||||
<-- 1b 59 01 # ?? hdr.matte ?
|
||||
<-- 1b 59 01 # ?? hdr.matte ?
|
||||
<-- 1b 60 XX # hdr.lamination
|
||||
<-- 1b 62 XX # hdr.lam_strength
|
||||
<-- 1b 61 01 # ?? hdr.unk1 ?
|
||||
|
@ -693,7 +693,7 @@ struct dyesub_backend kodak1400_backend = {
|
|||
<-- row last
|
||||
|
||||
<-- 1b 74 01 50 # ??
|
||||
|
||||
|
||||
<-- 1b 72 # Status query
|
||||
--> e4 72 00 00 00 00 50 59 # Printing plane 1
|
||||
[ repeats until...]
|
||||
|
@ -765,21 +765,21 @@ struct dyesub_backend kodak1400_backend = {
|
|||
Calibration data:
|
||||
|
||||
<-- 1b a2 # ?? Reset cal tables?
|
||||
--> 00 01 00 00 00 00 00 00
|
||||
--> 00 01 00 00 00 00 00 00
|
||||
|
||||
<-- 1b a0 02 03 06 10 # 06 10 == 1552 bytes aka the CAL data.
|
||||
<-- cal data
|
||||
|
||||
[[ Data is organized as three blocks of 512 bytes followed by
|
||||
16 NULL bytes.
|
||||
[[ Data is organized as three blocks of 512 bytes followed by
|
||||
16 NULL bytes.
|
||||
|
||||
Each block appears to be 256 entries of 16-bit LE data,
|
||||
Each block appears to be 256 entries of 16-bit LE data,
|
||||
so each input value is translated into a 16-bit number in the printer.
|
||||
|
||||
Assuming blocks are ordered BGR.
|
||||
|
||||
]]
|
||||
]]
|
||||
|
||||
--> 00 00 00 00 00 00 00 00
|
||||
--> 00 00 00 00 00 00 00 00
|
||||
|
||||
*/
|
||||
|
|
|
@ -291,7 +291,7 @@ static int kodak605_read_parse(void *vctx, int data_fd) {
|
|||
if (ret < 0 || ret != sizeof(ctx->hdr)) {
|
||||
if (ret == 0)
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ret, 0, (int)sizeof(ctx->hdr));
|
||||
perror("ERROR: Read failed");
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
|
@ -683,7 +683,7 @@ struct dyesub_backend kodak605_backend = {
|
|||
.teardown = kodak605_teardown,
|
||||
.read_parse = kodak605_read_parse,
|
||||
.main_loop = kodak605_main_loop,
|
||||
.devices = {
|
||||
.devices = {
|
||||
{ USB_VID_KODAK, USB_PID_KODAK_605, P_KODAK_605, "Kodak"},
|
||||
{ 0, 0, 0, ""}
|
||||
}
|
||||
|
|
|
@ -930,7 +930,7 @@ static int kodak6850_send_unk(struct kodak6800_ctx *ctx)
|
|||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
// XXX No particular idea what this actually is
|
||||
if (rdbuf[1] != 0x01 && rdbuf[1] != 0x00) {
|
||||
ERROR("Unexpected status code (0x%02x)!\n", rdbuf[1]);
|
||||
|
@ -947,7 +947,7 @@ static void kodak6800_cmdline(void)
|
|||
DEBUG("\t\t[ -m ] # Query media\n");
|
||||
DEBUG("\t\t[ -s ] # Query status\n");
|
||||
DEBUG("\t\t[ -R ] # Reset printer\n");
|
||||
DEBUG("\t\t[ -X jobid ] # Cancel Job\n");
|
||||
DEBUG("\t\t[ -X jobid ] # Cancel Job\n");
|
||||
}
|
||||
|
||||
static int kodak6800_cmdline_arg(void *vctx, int argc, char **argv)
|
||||
|
@ -1009,7 +1009,7 @@ static void *kodak6800_init(void)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static void kodak6800_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
static void kodak6800_attach(void *vctx, struct libusb_device_handle *dev,
|
||||
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
|
||||
{
|
||||
struct kodak6800_ctx *ctx = vctx;
|
||||
|
@ -1095,7 +1095,7 @@ static int kodak6800_read_parse(void *vctx, int data_fd) {
|
|||
do {
|
||||
ret = read(data_fd, ptr, remain);
|
||||
if (ret < 0) {
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ERROR("Read failed (%d/%d/%d)\n",
|
||||
ret, remain, ctx->datalen);
|
||||
perror("ERROR: Read failed");
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#if defined(USE_DLOPEN)
|
||||
#define WITH_DYNAMIC
|
||||
#include <dlfcn.h>
|
||||
#define DL_INIT() do {} while(0)
|
||||
#define DL_INIT() do {} while(0)
|
||||
#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
|
||||
#define DL_SYM(__x, __y) dlsym(__x, __y)
|
||||
#define DL_CLOSE(__x) dlclose(__x)
|
||||
|
@ -175,7 +175,7 @@ struct mitsu70x_ctx {
|
|||
int sharpen; /* ie mhdr.sharpen - 1 */
|
||||
|
||||
uint8_t rew[2]; /* 1 for rewind ok (default!) */
|
||||
|
||||
|
||||
struct BandImage output;
|
||||
};
|
||||
|
||||
|
@ -350,7 +350,7 @@ struct mitsu70x_memorystatus_resp {
|
|||
uint8_t rsvd;
|
||||
} __attribute__((packed));
|
||||
|
||||
// XXX also seen commands 0x67, 0x72, 0x54, 0x6e
|
||||
// XXX also seen commands 0x67, 0x72, 0x54, 0x6e
|
||||
|
||||
struct mitsu70x_hdr {
|
||||
uint8_t hdr[4]; /* 1b 5a 54 XX */ // XXX also, seen 1b 5a 43!
|
||||
|
@ -411,14 +411,14 @@ static char *mitsu70x_jobstatuses(uint8_t *sts)
|
|||
return "Data transfer";
|
||||
case JOB_STATUS0_QUEUE:
|
||||
return "Queued for printing";
|
||||
case JOB_STATUS0_PRINT:
|
||||
case JOB_STATUS0_PRINT:
|
||||
switch(sts[1]) {
|
||||
case JOB_STATUS1_PRINT_MEDIALOAD:
|
||||
return "Media loading";
|
||||
case JOB_STATUS1_PRINT_PRE_Y:
|
||||
return "Waiting to print yellow plane";
|
||||
case JOB_STATUS1_PRINT_Y:
|
||||
return "Printing yellow plane";
|
||||
return "Printing yellow plane";
|
||||
case JOB_STATUS1_PRINT_PRE_M:
|
||||
return "Waiting to print magenta plane";
|
||||
case JOB_STATUS1_PRINT_M:
|
||||
|
@ -698,7 +698,7 @@ static void mitsu70x_attach(void *vctx, struct libusb_device_handle *dev,
|
|||
ctx->dl_handle = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ctx->Get3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Get3DColorTable");
|
||||
ctx->Load3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Load3DColorTable");
|
||||
ctx->Destroy3DColorTable = DL_SYM(ctx->dl_handle, "CColorConv3D_Destroy3DColorTable");
|
||||
|
@ -1465,7 +1465,7 @@ top:
|
|||
mitsu70x_media_types(resp.lower.media_brand, resp.lower.media_type));
|
||||
ATTR("marker-types=ribbonWax\n");
|
||||
}
|
||||
|
||||
|
||||
/* FW sanity checking */
|
||||
if (ctx->type == P_KODAK_305) {
|
||||
if (be16_to_cpu(resp.vers[0].checksum) != EK305_0104_M_CSUM)
|
||||
|
@ -1502,7 +1502,7 @@ skip_status:
|
|||
{
|
||||
int i;
|
||||
struct mitsu70x_jobs jobs;
|
||||
|
||||
|
||||
ret = mitsu70x_get_jobs(ctx, &jobs);
|
||||
if (ret)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -1658,7 +1658,7 @@ skip_status:
|
|||
}
|
||||
|
||||
/* Update cache for the next round */
|
||||
memcpy(last_status, jobstatus.job_status, 4);
|
||||
memcpy(last_status, jobstatus.job_status, 4);
|
||||
} while(1);
|
||||
|
||||
/* Clean up */
|
||||
|
@ -1706,7 +1706,7 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_printerstatus_resp *resp
|
|||
type, buf, be16_to_cpu(resp->vers[i].checksum));
|
||||
}
|
||||
INFO("Standby Timeout: %d minutes\n", resp->sleeptime);
|
||||
INFO("iSerial Reporting: %s\n", resp->iserial ? "No" : "Yes" );
|
||||
INFO("iSerial Reporting: %s\n", resp->iserial ? "No" : "Yes" );
|
||||
|
||||
INFO("Lower Mechanical Status: %s\n",
|
||||
mitsu70x_mechastatus(resp->lower.mecha_status));
|
||||
|
@ -1758,7 +1758,7 @@ static int mitsu70x_query_status(struct mitsu70x_ctx *ctx)
|
|||
struct mitsu70x_printerstatus_resp resp;
|
||||
#if 0
|
||||
struct mitsu70x_jobs jobs;
|
||||
#endif
|
||||
#endif
|
||||
struct mitsu70x_jobstatus jobstatus;
|
||||
|
||||
int ret;
|
||||
|
|
|
@ -526,7 +526,7 @@ static char *mitsu9550_media_types(uint8_t type, uint8_t is_s)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
switch (type & 0xf) { /* values can be 0x0? or 0x4? */
|
||||
case 0x01:
|
||||
return "CK9035 (3.5x5)";
|
||||
|
@ -556,7 +556,7 @@ static int validate_media(int type, int media, int cols, int rows)
|
|||
return 1;
|
||||
break;
|
||||
case 0x02: /* 4x6 */
|
||||
case 0x03: /* 4x6 postcard */
|
||||
case 0x03: /* 4x6 postcard */
|
||||
if (cols != 2152)
|
||||
return 1;
|
||||
if (rows != 1416 && rows != 1184 && rows != 1240)
|
||||
|
@ -707,7 +707,7 @@ static int validate_media(int type, int media, int cols, int rows)
|
|||
case P_MITSU_9800S:
|
||||
switch(media & 0xf) {
|
||||
case 0x02: /* 4x6 */
|
||||
case 0x03: /* 4x6 postcard */
|
||||
case 0x03: /* 4x6 postcard */
|
||||
if (cols != 1868 && rows != 1228)
|
||||
return 1;
|
||||
break;
|
||||
|
@ -837,20 +837,20 @@ top:
|
|||
if (ctx->hdr4_present)
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
(uint8_t*) &ctx->hdr4, sizeof(struct mitsu9550_hdr4))))
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
if (ctx->is_s) {
|
||||
/* Send "start data" command */
|
||||
cmd.cmd[0] = 0x1b;
|
||||
cmd.cmd[1] = 0x5a;
|
||||
cmd.cmd[2] = 0x43;
|
||||
cmd.cmd[3] = 0x00;
|
||||
|
||||
|
||||
if ((ret = send_data(ctx->dev, ctx->endp_down,
|
||||
(uint8_t*) &cmd, sizeof(cmd))))
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
|
||||
|
||||
/* Send over plane data */
|
||||
while(1) {
|
||||
struct mitsu9550_plane *plane = (struct mitsu9550_plane *)ptr;
|
||||
|
@ -878,7 +878,7 @@ top:
|
|||
// struct mitsu9550_status2 *sts2 = (struct mitsu9550_status2*) rdbuf;
|
||||
struct mitsu9550_media *media = (struct mitsu9550_media *) rdbuf;
|
||||
uint16_t donor, remain;
|
||||
|
||||
|
||||
ret = mitsu9550_get_status(ctx, rdbuf, 0, 0, 1); // media
|
||||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -903,11 +903,11 @@ top:
|
|||
ret = mitsu9550_get_status(ctx, rdbuf, 0, 1, 0); // status2
|
||||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
|
||||
ret = mitsu9550_get_status(ctx, rdbuf, 1, 0, 0); // status
|
||||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
|
||||
/* Make sure we're ready to proceed */
|
||||
if (sts->sts5 != 0) {
|
||||
ERROR("Unexpected response (sts5 %02x)\n", sts->sts5);
|
||||
|
@ -1094,7 +1094,7 @@ static int mitsu9550_query_status2(struct mitsu9550_ctx *ctx)
|
|||
{
|
||||
struct mitsu9550_status2 resp;
|
||||
int ret;
|
||||
|
||||
|
||||
ret = mitsu9550_get_status(ctx, (uint8_t*) &resp, 0, 1, 0);
|
||||
|
||||
if (!ret)
|
||||
|
@ -1121,13 +1121,13 @@ static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_
|
|||
|
||||
ret = read_data(dev, endp_up,
|
||||
rdbuf, READBACK_LEN, &num);
|
||||
|
||||
|
||||
if (ret < 0)
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
if ((unsigned int)num < sizeof(cmd) + 1) /* Short read */
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
|
||||
if (rdbuf[0] != 0xe4 ||
|
||||
rdbuf[1] != 0x72 ||
|
||||
rdbuf[2] != 0x6e ||
|
||||
|
@ -1140,7 +1140,7 @@ static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_
|
|||
WARNING("Short serno read! (%d vs %u)\r\n",
|
||||
num, rdbuf[4]);
|
||||
|
||||
/* model and serial number are encoded as 16-bit unicode,
|
||||
/* model and serial number are encoded as 16-bit unicode,
|
||||
little endian, separated by spaces. */
|
||||
i = num;
|
||||
ptr = rdbuf + 5;
|
||||
|
@ -1152,7 +1152,7 @@ static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_
|
|||
i -= 2;
|
||||
}
|
||||
*buf = 0; /* Null-terminate the returned string */
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1193,7 +1193,7 @@ static int mitsu9550_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
|
||||
/* Exported */
|
||||
struct dyesub_backend mitsu9550_backend = {
|
||||
.name = "Mitsubishi CP-9550 family",
|
||||
.name = "Mitsubishi CP-9xxx family",
|
||||
.version = "0.29",
|
||||
.uri_prefix = "mitsu9550",
|
||||
.cmdline_usage = mitsu9550_cmdline,
|
||||
|
@ -1233,7 +1233,7 @@ struct dyesub_backend mitsu9550_backend = {
|
|||
1b 57 20 2e 00 QQ QQ 00 00 00 00 00 00 00 XX XX :: XX XX == columns
|
||||
YY YY 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :: YY YY == rows
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :: QQ == 0x0a90 on 9810, 0x0a10 on all others.
|
||||
00 00
|
||||
00 00
|
||||
|
||||
~~~ Header 2
|
||||
|
||||
|