backends: Enhance to add multipage capabilities.

DNP ds40/ds80 and Sony UP-DR150/200 backends do NOT support this yet.

Next up is to commit the core.
This commit is contained in:
Solomon Peachy 2014-01-17 22:54:25 -05:00
parent a7316668ff
commit d7d60b7191
5 changed files with 44 additions and 7 deletions

View File

@ -321,6 +321,8 @@ static void *canonselphy_init(void)
/* Static initialization */
setup_paper_codes();
ctx->buffer = malloc(MAX_HEADER);
return ctx;
}
@ -352,6 +354,7 @@ static void canonselphy_teardown(void *vctx) {
free(ctx->plane_c);
if (ctx->footer)
free(ctx->footer);
if (ctx->buffer)
free(ctx->buffer);
@ -363,7 +366,8 @@ static int canonselphy_early_parse(void *vctx, int data_fd)
struct canonselphy_ctx *ctx = vctx;
int printer_type, i;
ctx->buffer = malloc(MAX_HEADER);
if (!ctx)
return 1;
/* Figure out printer this file is intended for */
i = read(data_fd, ctx->buffer, MAX_HEADER);
@ -374,7 +378,6 @@ static int canonselphy_early_parse(void *vctx, int data_fd)
return i;
}
printer_type = parse_printjob(ctx->buffer, &ctx->bw_mode, &ctx->plane_len);
for (i = 0; selphy_printers[i].type != -1; i++) {
if (selphy_printers[i].type == printer_type) {
@ -403,6 +406,20 @@ static int canonselphy_read_parse(void *vctx, int data_fd)
struct canonselphy_ctx *ctx = vctx;
int i, remain;
if (!ctx)
return 1;
if (ctx->header)
free(ctx->header);
if (ctx->plane_y)
free(ctx->plane_y);
if (ctx->plane_m)
free(ctx->plane_m);
if (ctx->plane_c)
free(ctx->plane_c);
if (ctx->footer)
free(ctx->footer);
/* Set up buffers */
ctx->plane_y = malloc(ctx->plane_len);
ctx->plane_m = malloc(ctx->plane_len);
@ -637,7 +654,8 @@ top:
struct dyesub_backend canonselphy_backend = {
.name = "Canon SELPHY CP/ES",
.version = "0.63",
.version = "0.64",
.multipage_capable = 1,
.uri_prefix = "canonselphy",
.init = canonselphy_init,
.attach = canonselphy_attach,

View File

@ -297,6 +297,12 @@ static int kodak1400_read_parse(void *vctx, int data_fd) {
if (!ctx)
return 1;
if (ctx->plane_r)
free(ctx->plane_r);
if (ctx->plane_g)
free(ctx->plane_g);
if (ctx->plane_b)
free(ctx->plane_b);
/* Read in then validate header */
ret = read(data_fd, &ctx->hdr, sizeof(ctx->hdr));
@ -560,8 +566,9 @@ top:
struct dyesub_backend kodak1400_backend = {
.name = "Kodak 1400/805",
.version = "0.26",
.version = "0.27",
.uri_prefix = "kodak1400",
.multipage_capable = 1,
.cmdline_usage = kodak1400_cmdline,
.cmdline_arg = kodak1400_cmdline_arg,
.init = kodak1400_init,

View File

@ -124,6 +124,9 @@ static int kodak605_read_parse(void *vctx, int data_fd) {
if (!ctx)
return 1;
if (ctx->databuf)
free(ctx->databuf);
/* Read in then validate header */
ret = read(data_fd, &ctx->hdr, sizeof(ctx->hdr));
if (ret < 0 || ret != sizeof(ctx->hdr)) {
@ -488,8 +491,9 @@ static int kodak605_cmdline_arg(void *vctx, int run, char *arg1, char *arg2)
/* Exported */
struct dyesub_backend kodak605_backend = {
.name = "Kodak 605",
.version = "0.13",
.version = "0.14",
.uri_prefix = "kodak605",
.multipage_capable = 1,
.cmdline_usage = kodak605_cmdline,
.cmdline_arg = kodak605_cmdline_arg,
.init = kodak605_init,

View File

@ -350,6 +350,9 @@ static int kodak6800_read_parse(void *vctx, int data_fd) {
if (!ctx)
return 1;
if (ctx->databuf)
free(ctx->databuf);
/* Read in then validate header */
ret = read(data_fd, &ctx->hdr, sizeof(ctx->hdr));
if (ret < 0 || ret != sizeof(ctx->hdr)) {
@ -601,8 +604,9 @@ skip_query:
/* Exported */
struct dyesub_backend kodak6800_backend = {
.name = "Kodak 6800/6850",
.version = "0.27",
.version = "0.28",
.uri_prefix = "kodak6800",
.multipage_capable = 1,
.cmdline_usage = kodak6800_cmdline,
.cmdline_arg = kodak6800_cmdline_arg,
.init = kodak6800_init,

View File

@ -1408,6 +1408,9 @@ static int shinkos2145_read_parse(void *vctx, int data_fd) {
if (!ctx)
return 1;
if (ctx->databuf)
free(ctx->databuf);
if (getenv("FAST_RETURN"))
ctx->fast_return = 1;
@ -1658,7 +1661,8 @@ static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t end
struct dyesub_backend shinkos2145_backend = {
.name = "Shinko/Sinfonia CHC-S2145 (S2)",
.version = "0.26",
.version = "0.27",
.multipage_capable = 1,
.uri_prefix = "shinkos2145",
.cmdline_usage = shinkos2145_cmdline,
.cmdline_arg = shinkos2145_cmdline_arg,