Gutenprint + CUPS backends for Dye Sublimation printers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
selphy_print/backend_canonselphy.c

1457 lines
44 KiB

/*
* Canon SELPHY ES/CP series CUPS backend -- libusb-1.0 version
*
* (c) 2007-2021 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
* https://git.shaftnet.org/cgit/selphy_print.git
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0+
*
*/
#define BACKEND canonselphy_backend
#include "backend_common.h"
#define P_ES40_CP790 (P_END + 1) // used for detection only
#define READBACK_LEN 12
struct printer_data {
int type; /* P_??? */
const char *model; /* eg "SELPHY ES1" */
uint16_t init_length;
uint16_t foot_length;
int16_t init_readback[READBACK_LEN];
int16_t ready_y_readback[READBACK_LEN];
int16_t ready_m_readback[READBACK_LEN];
int16_t ready_c_readback[READBACK_LEN];
int16_t done_c_readback[READBACK_LEN];
uint8_t clear_error[READBACK_LEN];
uint8_t clear_error_len;
int16_t paper_codes[256];
int8_t pgcode_offset; /* Offset into printjob for paper type */
int8_t paper_code_offset; /* Offset in readback for paper type */
int8_t paper_code_offset2; /* Offset in readback for paper type (2nd) */
uint8_t (*error_detect)(uint8_t *rdbuf);
const char *(*pgcode_names)(uint8_t *rdbuf, struct printer_data *printer, int *numtype);
};
static const char *generic_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype)
{
uint8_t pgcode = 0, pgcode2 = 0;
if (printer->paper_code_offset != -1)
pgcode = rdbuf[printer->paper_code_offset];
if (printer->paper_code_offset2 != -1)
pgcode2 = rdbuf[printer->paper_code_offset2];
*numtype = pgcode & 0xf;
switch(pgcode & 0xf) {
case 0x01: return "P";
case 0x02: return "L";
case 0x03: return pgcode2 ? "Cl" : "C";
case 0x04: return "W";
case 0x0f: return "None";
default: return "Unknown";
}
}
static uint8_t es1_error_detect(uint8_t *rdbuf)
{
if (rdbuf[1] == 0x01) {
if (rdbuf[9] == 0x00)
ERROR("Cover open!\n");
else
ERROR("Unknown error %02x\n", rdbuf[9]);
return 1;
} else if (rdbuf[4] == 0x01 && rdbuf[5] == 0xff &&
rdbuf[6] == 0xff && rdbuf[7] == 0xff) {
ERROR("No media loaded!\n");
return 1;
} else if (rdbuf[0] == 0x0f) {
ERROR("Out of media!\n");
return 1;
}
return CUPS_BACKEND_OK;
}
static uint8_t es2_error_detect(uint8_t *rdbuf)
{
if (rdbuf[0] == 0x16 &&
rdbuf[1] == 0x01) {
ERROR("Printer cover open!\n");
return 1;
}
if (rdbuf[0] == 0x02 &&
rdbuf[4] == 0x05 &&
rdbuf[5] == 0x05 &&
rdbuf[6] == 0x02) {
ERROR("No media loaded!\n");
return 1;
}
if (rdbuf[0] == 0x14) {
ERROR("Out of media!\n");
return 1;
}
return CUPS_BACKEND_OK;
}
static uint8_t es3_error_detect(uint8_t *rdbuf)
{
if (rdbuf[8] == 0x01) {
if (rdbuf[10] == 0x0f)
ERROR("Communications Error\n");
else if (rdbuf[10] == 0x01)
ERROR("No media loaded!\n");
else
ERROR("Unknown error - %02x + %02x\n",
rdbuf[8], rdbuf[10]);
return 1;
} else if (rdbuf[8] == 0x03 &&
rdbuf[10] == 0x02) {
ERROR("No media loaded!\n");
return 1;
} else if (rdbuf[8] == 0x08 &&
rdbuf[10] == 0x04) {
ERROR("Printer cover open!\n");
return 1;
} else if (rdbuf[8] == 0x05 &&
rdbuf[10] == 0x01) {
ERROR("Incorrect media loaded!\n");
return 1;
}
if (rdbuf[8] || rdbuf[10]) {
ERROR("Unknown error - %02x + %02x\n",
rdbuf[8], rdbuf[10]);
return 1;
}
return CUPS_BACKEND_OK;
}
static uint8_t es40_error_detect(uint8_t *rdbuf)
{
/* ES40 */
if (!rdbuf[3])
return CUPS_BACKEND_OK;
if (rdbuf[3] == 0x01)
ERROR("Generic communication error\n");
else if (rdbuf[3] == 0x32)
ERROR("Cover open or media empty!\n");
else
ERROR("Unknown error - %02x\n", rdbuf[3]);
return 1;
}
static const char *cp790_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype)
{
UNUSED(printer);
UNUSED(numtype);
switch(rdbuf[5]) {
case 0x00: return "P";
case 0x01: return "L";
case 0x02: return "C";
case 0x03: return "W";
case 0x0f: return "None";
default: return "Unknown";
}
}
static uint8_t cp790_error_detect(uint8_t *rdbuf)
{
/* CP790 */
if (rdbuf[5] == 0xff) {
ERROR("No ribbon loaded!\n");
return 1;
} else if (rdbuf[4] == 0xff) {
ERROR("No paper tray loaded!\n");
return 1;
} else if (rdbuf[3]) {
if ((rdbuf[3] & 0xf) == 0x02) // 0x12 0x22
ERROR("No paper tray loaded!\n");
else if ((rdbuf[3] & 0xf) == 0x03) // 0x13 0x23
ERROR("Empty paper tray or feed error!\n");
else if (rdbuf[3] == 0x11)
ERROR("Paper feed error!\n");
else if (rdbuf[3] == 0x21)
ERROR("Ribbon depleted!\n");
else
ERROR("Unknown error - %02x\n", rdbuf[3]);
return 1;
}
return CUPS_BACKEND_OK;
}
static const char *cp10_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype)
{
UNUSED(rdbuf);
UNUSED(printer);
*numtype = 3;
return "C"; /* Printer only supports one media type */
}
static uint8_t cp10_error_detect(uint8_t *rdbuf)
{
if (!rdbuf[2])
return CUPS_BACKEND_OK;
if (rdbuf[2] == 0x80)
ERROR("No ribbon loaded\n");
else if (rdbuf[2] == 0x08)
ERROR("Ribbon depleted!\n");
else if (rdbuf[2] == 0x01)
ERROR("No paper loaded!\n");
else
ERROR("Unknown error - %02x\n", rdbuf[2]);
return 1;
}
static uint8_t cpxxx_error_detect(uint8_t *rdbuf)
{
if (!rdbuf[2])
return CUPS_BACKEND_OK;
if (rdbuf[2] == 0x01)
ERROR("Paper feed problem!\n");
else if (rdbuf[2] == 0x04)
ERROR("Ribbon problem!\n");
else if (rdbuf[2] == 0x08)
ERROR("Ribbon depleted!\n");
else
ERROR("Unknown error - %02x\n", rdbuf[2]);
return 1;
}
static struct printer_data selphy_printers[] = {
{ .type = P_ES1,
.model = "SELPHY ES1",
.init_length = 12,
.foot_length = 0,
.init_readback = { 0x02, 0x00, 0x00, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
.ready_y_readback = { 0x04, 0x00, 0x01, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
.ready_m_readback = { 0x04, 0x00, 0x03, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
.ready_c_readback = { 0x04, 0x00, 0x07, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
.done_c_readback = { 0x04, 0x00, 0x00, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
.clear_error = { 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error_len = 12,
.pgcode_offset = 3,
.paper_code_offset = 6,
.paper_code_offset2 = -1,
.error_detect = es1_error_detect,
.pgcode_names = generic_pgcode_names,
},
{ .type = P_ES2_20,
.model = "SELPHY ES2/ES20",
.init_length = 16,
.foot_length = 0,
.init_readback = { 0x02, 0x00, 0x00, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.ready_y_readback = { 0x03, 0x00, 0x01, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.ready_m_readback = { 0x06, 0x00, 0x03, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.ready_c_readback = { 0x09, 0x00, 0x07, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.done_c_readback = { 0x09, 0x00, 0x00, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.clear_error = { 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error_len = 12,
.pgcode_offset = 2,
.paper_code_offset = 4,
.paper_code_offset2 = 6,
.error_detect = es2_error_detect,
.pgcode_names = generic_pgcode_names,
},
{ .type = P_ES3_30,
.model = "SELPHY ES3/ES30",
.init_length = 16,
.foot_length = 12,
.init_readback = { 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
.ready_y_readback = { 0x01, 0xff, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
.ready_m_readback = { 0x03, 0xff, 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
.ready_c_readback = { 0x05, 0xff, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
.done_c_readback = { 0x00, 0xff, 0x10, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
.clear_error = { 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error_len = 12,
.pgcode_offset = 2,
.paper_code_offset = -1,
.paper_code_offset2 = -1,
.error_detect = es3_error_detect,
.pgcode_names = NULL,
},
{ .type = P_ES40,
.model = "SELPHY ES40",
.init_length = 16,
.foot_length = 12,
.init_readback = { 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -1 },
.ready_y_readback = { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -1 },
.ready_m_readback = { 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -1 },
.ready_c_readback = { 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -1 },
.done_c_readback = { 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -1 },
.clear_error = { 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error_len = 12,
.pgcode_offset = 2,
.paper_code_offset = 11,
.paper_code_offset2 = -1,
.error_detect = es40_error_detect,
.pgcode_names = generic_pgcode_names,
},
{ .type = P_CP790,
.model = "SELPHY CP790",
.init_length = 16,
.foot_length = 12,
.init_readback = { 0x00, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
.ready_y_readback = { 0x00, 0x01, 0x01, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
.ready_m_readback = { 0x00, 0x03, 0x02, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
.ready_c_readback = { 0x00, 0x05, 0x03, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
.done_c_readback = { 0x00, 0x00, 0x10, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
.clear_error = { 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error_len = 12,
.pgcode_offset = 2,
.paper_code_offset = -1, /* Uses a different technique */
.paper_code_offset2 = -1,
.error_detect = cp790_error_detect,
.pgcode_names = cp790_pgcode_names,
},
{ .type = P_CPGENERIC,
.model = "SELPHY CP Series (!CP-10/CP790)",
.init_length = 12,
.foot_length = 0, /* CP900 has four-byte NULL footer that can be safely ignored */
.init_readback = { 0x01, 0x00, 0x00, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, -1 },
.ready_y_readback = { 0x02, 0x00, 0x00, 0x00, 0x70, 0x00, -1, -1, 0x00, 0x00, 0x00, -1 },
.ready_m_readback = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -1, -1, 0x00, 0x00, 0x00, -1 },
.ready_c_readback = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, -1, -1, 0x00, 0x00, 0x00, -1 },
.done_c_readback = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, -1, -1, 0x00, 0x00, 0x00, -1 },
.clear_error = { 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error_len = 12,
.pgcode_offset = 3,
.paper_code_offset = 6,
.paper_code_offset2 = -1,
.error_detect = cpxxx_error_detect,
.pgcode_names = generic_pgcode_names,
},
{ .type = P_CP10,
.model = "SELPHY CP-10",
.init_length = 12,
.foot_length = 0,
.init_readback = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.ready_y_readback = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.ready_m_readback = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.ready_c_readback = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.done_c_readback = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error = { 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.clear_error_len = 12,
.pgcode_offset = 2,
.paper_code_offset = -1,
.paper_code_offset2 = -1,
.error_detect = cp10_error_detect,
.pgcode_names = cp10_pgcode_names,
},
{ .type = -1 },
};
#define MAX_HEADER 28
static const uint32_t es40_cp790_plane_lengths[4] = { 2227456, 1601600, 698880, 2976512 };
static void setup_paper_codes(void)
{
int i, j;
for (i = 0 ; ; i++) {
if (selphy_printers[i].type == -1)
break;
/* Default all to IGNORE */
for (j = 0 ; j < 256 ; j++)
selphy_printers[i].paper_codes[j] = -1;
/* Set up specifics */
switch (selphy_printers[i].type) {
case P_ES1:
selphy_printers[i].paper_codes[0x11] = 0x01;
selphy_printers[i].paper_codes[0x12] = 0x02;
selphy_printers[i].paper_codes[0x13] = 0x03;
break;
case P_ES2_20:
selphy_printers[i].paper_codes[0x01] = 0x01;
selphy_printers[i].paper_codes[0x02] = 0x02;
selphy_printers[i].paper_codes[0x03] = 0x03;
break;
case P_ES40:
selphy_printers[i].paper_codes[0x00] = 0x11;
selphy_printers[i].paper_codes[0x01] = 0x22;
selphy_printers[i].paper_codes[0x02] = 0x33;
selphy_printers[i].paper_codes[0x03] = 0x44;
break;
case P_CPGENERIC:
selphy_printers[i].paper_codes[0x01] = 0x11;
selphy_printers[i].paper_codes[0x02] = 0x22;
selphy_printers[i].paper_codes[0x03] = 0x33;
selphy_printers[i].paper_codes[0x04] = 0x44;
break;
case P_CP790:
selphy_printers[i].paper_codes[0x00] = 0x0;
selphy_printers[i].paper_codes[0x01] = 0x1;
selphy_printers[i].paper_codes[0x02] = 0x2;
selphy_printers[i].paper_codes[0x03] = 0x3;
break;
case P_ES3_30:
/* N/A, printer does not report types */
case P_CP10:
/* N/A, printer supports one type only */
break;
}
}
}
#define INCORRECT_PAPER -999
/* Program states */
enum {
S_IDLE = 0,
S_PRINTER_READY,
S_PRINTER_INIT_SENT,
S_PRINTER_READY_Y,
S_PRINTER_Y_SENT,
S_PRINTER_READY_M,
S_PRINTER_M_SENT,
S_PRINTER_READY_C,
S_PRINTER_C_SENT,
S_PRINTER_CP900_FOOTER,
S_PRINTER_DONE,
S_FINISHED,
};
static int fancy_memcmp(const uint8_t *buf_a, const int16_t *buf_b, uint16_t len)
{
uint16_t i;
for (i = 0 ; i < len ; i++) {
if (buf_b[i] == -1)
continue;
else if (buf_a[i] > buf_b[i])
return 1;
else if (buf_a[i] < buf_b[i])
return -1;
}
return CUPS_BACKEND_OK;
}
static int parse_printjob(uint8_t *buffer, uint8_t *bw_mode, uint32_t *plane_len)
{
int printer_type = -1;
if (buffer[0] != 0x40 &&
buffer[1] != 0x00) {
goto done;
}
if (buffer[12] == 0x40 &&
buffer[13] == 0x01) {
*plane_len = *(uint32_t*)(&buffer[16]);
*plane_len = le32_to_cpu(*plane_len);
if (buffer[2] == 0x00) {
if (*plane_len == 688480)
printer_type = P_CP10;
else
printer_type = P_CPGENERIC;
} else {
printer_type = P_ES1;
*bw_mode = (buffer[2] == 0x20);
}
goto done;
}
*plane_len = *(uint32_t*)(&buffer[12]);
*plane_len = le32_to_cpu(*plane_len);
if (buffer[16] == 0x40 &&
buffer[17] == 0x01) {
if (buffer[4] == 0x02) {
printer_type = P_ES2_20;
*bw_mode = (buffer[7] == 0x01);
goto done;
}
if (es40_cp790_plane_lengths[buffer[2]] == *plane_len) {
printer_type = P_ES40_CP790;
*bw_mode = (buffer[3] == 0x01);
goto done;
} else {
printer_type = P_ES3_30;
*bw_mode = (buffer[3] == 0x01);
goto done;
}
}
done:
return printer_type;
}
/* Private data structure */
struct canonselphy_printjob {
struct dyesub_job_common common;
int16_t paper_code;
uint8_t bw_mode;
uint32_t plane_len;
uint8_t *header;
uint8_t *plane_y;
uint8_t *plane_m;
uint8_t *plane_c;
uint8_t *footer;
};
struct canonselphy_ctx {
struct dyesub_connection *conn;
struct printer_data *printer;
struct marker marker;
uint8_t cp900;
};
static int canonselphy_get_status(struct canonselphy_ctx *ctx)
{
uint8_t rdbuf[READBACK_LEN];
int ret, num;
/* Read in the printer status, twice. */
ret = read_data(ctx->conn,
(uint8_t*) rdbuf, READBACK_LEN, &num);
if (ret < 0)
return CUPS_BACKEND_FAILED;
ret = read_data(ctx->conn,
(uint8_t*) rdbuf, READBACK_LEN, &num);
if (ret < 0)
return CUPS_BACKEND_FAILED;
INFO("Media type: %s\n", ctx->printer->pgcode_names? ctx->printer->pgcode_names(rdbuf, ctx->printer, &ret) : "Unknown");
ctx->printer->error_detect(rdbuf);
return CUPS_BACKEND_OK;
}
static int canonselphy_send_reset(struct canonselphy_ctx *ctx)
{
uint8_t rstcmd[12] = { 0x40, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
int ret;
if ((ret = send_data(ctx->conn,
rstcmd, sizeof(rstcmd))))
return CUPS_BACKEND_FAILED;
return CUPS_BACKEND_OK;
}
static void *canonselphy_init(void)
{
struct canonselphy_ctx *ctx = malloc(sizeof(struct canonselphy_ctx));
if (!ctx) {
ERROR("Memory Allocation Failure!\n");
return NULL;
}
memset(ctx, 0, sizeof(struct canonselphy_ctx));
/* Static initialization */
setup_paper_codes();
return ctx;
}
static int canonselphy_attach(void *vctx, struct dyesub_connection *conn, uint8_t jobid)
{
struct canonselphy_ctx *ctx = vctx;
int i, num;
uint8_t rdbuf[READBACK_LEN];
UNUSED(jobid);
ctx->conn = conn;
if (ctx->conn->type == P_CP900) {
ctx->conn->type = P_CPGENERIC;
ctx->cp900 = 1;
}
for (i = 0 ; selphy_printers[i].type != -1; i++) {
if (selphy_printers[i].type == ctx->conn->type) {
ctx->printer = &selphy_printers[i];
}
}
if (!ctx->printer) {
ERROR("Error looking up printer type!\n");
return CUPS_BACKEND_FAILED;
}
/* Fill out marker structure */
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
ctx->marker.levelmax = CUPS_MARKER_UNAVAILABLE;
if (test_mode < TEST_MODE_NOATTACH) {
/* Read printer status. Twice. */
i = read_data(ctx->conn,
rdbuf, READBACK_LEN, &num);
if (i < 0)
return CUPS_BACKEND_FAILED;
i = read_data(ctx->conn,
rdbuf, READBACK_LEN, &num);
if (i < 0)
return CUPS_BACKEND_FAILED;
if (ctx->printer->error_detect(rdbuf))
ctx->marker.levelnow = 0;
else
ctx->marker.levelnow = CUPS_MARKER_UNKNOWN_OK;
ctx->marker.name = ctx->printer-