kodak8810: Multicut support.

This commit is contained in:
Solomon Peachy 2019-09-22 00:39:36 -04:00
parent a8b919414e
commit b310f943ad
3 changed files with 65 additions and 5 deletions

2
README
View File

@ -742,8 +742,6 @@
Notes: Notes:
* Work-in-progress, has not been tested on an actual printer yet.
[4] Kodak 8810 only [4] Kodak 8810 only
[1] Format of curvedata file: [1] Format of curvedata file:

View File

@ -1063,6 +1063,33 @@ static int shinkos6245_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
/* XXX Single cut; for double cut use a gap of 22 */
static struct kodak8810_cutlist cutlist_8x4x2 = {
.entries = 3,
.cut[0] = cpu_to_le32(12),
.cut[1] = cpu_to_le32(2408/2),
.cut[2] = cpu_to_le32(2408-12),
};
static struct kodak8810_cutlist cutlist_8x5x2 = {
.entries = 3,
.cut[0] = cpu_to_le32(12),
.cut[1] = cpu_to_le32(3024/2),
.cut[2] = cpu_to_le32(3024-12),
};
static struct kodak8810_cutlist cutlist_8x6x2 = {
.entries = 3,
.cut[0] = cpu_to_le32(12),
.cut[1] = cpu_to_le32(3624/2),
.cut[2] = cpu_to_le32(3624-12),
};
static struct kodak8810_cutlist cutlist_8x4x3 = {
.entries = 4,
.cut[0] = cpu_to_le32(12),
.cut[1] = cpu_to_le32(3624/3),
.cut[2] = cpu_to_le32(3624/3 + 3624/3),
.cut[3] = 3624,
};
static int shinkos6245_main_loop(void *vctx, const void *vjob) { static int shinkos6245_main_loop(void *vctx, const void *vjob) {
struct shinkos6245_ctx *ctx = vctx; struct shinkos6245_ctx *ctx = vctx;
@ -1078,6 +1105,7 @@ static int shinkos6245_main_loop(void *vctx, const void *vjob) {
struct sinfonia_status_hdr resp; struct sinfonia_status_hdr resp;
struct sinfonia_printjob *job = (struct sinfonia_printjob*) vjob; struct sinfonia_printjob *job = (struct sinfonia_printjob*) vjob;
struct kodak8810_cutlist *cutlist = NULL;
copies = job->copies; copies = job->copies;
@ -1102,7 +1130,26 @@ static int shinkos6245_main_loop(void *vctx, const void *vjob) {
break; break;
} }
// XXX what about mcut |= PRINT_METHOD_DISABLE_ERR; // XXX what about mcut |= PRINT_METHOD_DISABLE_ERR;
// XXX set up CUTLIST for EK8810!
/* EK8810 uses special "cutlist" */
if (ctx->dev.type == P_KODAK_8810) {
switch (job->jp.media) {
case CODE_8x4_2:
cutlist = &cutlist_8x4x2;
break;
case CODE_8x5_2:
cutlist = &cutlist_8x5x2;
break;
case CODE_8x6_2:
cutlist = &cutlist_8x6x2;
break;
case CODE_8x4_3:
cutlist = &cutlist_8x4x3;
break;
default:
break;
}
}
#if 0 /* Doesn't work on EK8810. Not sure about S6245 */ #if 0 /* Doesn't work on EK8810. Not sure about S6245 */
int i; int i;
@ -1222,6 +1269,21 @@ top:
case S_PRINTER_READY_CMD: case S_PRINTER_READY_CMD:
// XXX send "get eeprom backup command" // XXX send "get eeprom backup command"
if (ctx->dev.type == P_KODAK_8810 && cutlist) {
cutlist->hdr.cmd = cpu_to_le16(SINFONIA_CMD_SETCUTLIST);
cutlist->hdr.len = cpu_to_le16(sizeof(*cutlist) - sizeof(cutlist->hdr));
if ((ret = sinfonia_docmd(&ctx->dev,
(uint8_t*)cutlist, sizeof(*cutlist),
(uint8_t*)&resp, sizeof(resp),
&num))) {
return CUPS_BACKEND_FAILED;
}
if (resp.result != RESULT_SUCCESS) {
goto printer_error;
}
}
INFO("Sending print job (internal id %u)\n", ctx->jobid); INFO("Sending print job (internal id %u)\n", ctx->jobid);
memset(cmdbuf, 0, CMDBUF_LEN); memset(cmdbuf, 0, CMDBUF_LEN);
@ -1338,7 +1400,7 @@ static const char *shinkos6245_prefixes[] = {
struct dyesub_backend shinkos6245_backend = { struct dyesub_backend shinkos6245_backend = {
.name = "Sinfonia CHC-S6245 / Kodak 8810", .name = "Sinfonia CHC-S6245 / Kodak 8810",
.version = "0.28" " (lib " LIBSINFONIA_VER ")", .version = "0.29" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = shinkos6245_prefixes, .uri_prefixes = shinkos6245_prefixes,
.cmdline_usage = shinkos6245_cmdline, .cmdline_usage = shinkos6245_cmdline,
.cmdline_arg = shinkos6245_cmdline_arg, .cmdline_arg = shinkos6245_cmdline_arg,

View File

@ -398,7 +398,7 @@ struct kodak701x_backprint {
struct kodak8810_cutlist { struct kodak8810_cutlist {
struct sinfonia_cmd_hdr hdr; struct sinfonia_cmd_hdr hdr;
uint8_t entries; /* max 24 */ uint8_t entries; /* max 24 */
uint16_t cut[36]; /* LE, each one is presumably a line number. */ uint16_t cut[36]; /* LE, row number to cut at. Deltas must be >= 12. */
} __attribute__((packed)); } __attribute__((packed));
#define CODE_4x6 0x00 #define CODE_4x6 0x00