From 00d4d7e07c8bf8376994c2560c5747b6c7063d83 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 9 Jan 2018 07:21:41 -0500 Subject: s1245: Tweak media detection further. Log the media type when dumping out the media info. --- backend_shinkos1245.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c index 9ca8ba2..67dd655 100644 --- a/backend_shinkos1245.c +++ b/backend_shinkos1245.c @@ -499,6 +499,7 @@ static int shinkos1245_get_media(struct shinkos1245_ctx *ctx) shinkos1245_fill_hdr(&cmd.hdr); memset(cmd.pad, 0, sizeof(cmd.pad)); + ctx->media_8x12 = 0; for (i = 1 ; i <= 3 ; i++) { cmd.cmd[0] = 0x0a | (i << 4); @@ -522,6 +523,9 @@ static int shinkos1245_get_media(struct shinkos1245_ctx *ctx) ctx->medias[ctx->num_medias].type = resp.data[j].type; ctx->medias[ctx->num_medias].print_type = resp.data[j].print_type; ctx->num_medias++; + + if (ctx->medias[i].rows >= 3636) + ctx->media_8x12 = 1; } /* Once we've parsed them all.. we're done */ @@ -933,11 +937,12 @@ static void shinkos1245_dump_status(struct shinkos1245_resp_status *sts) INFO("Tone Curve Status: %s\n", detail); } -static void shinkos1245_dump_media(struct shinkos1245_mediadesc *medias, +static void shinkos1245_dump_media(struct shinkos1245_mediadesc *medias, int media_8x12, int count) { int i; + INFO("Loaded media type: %s\n", media_8x12 ? "8x12" : "8x10"); INFO("Supported print sizes: %d\n", count); for (i = 0 ; i < count ; i++) { @@ -945,7 +950,7 @@ static void shinkos1245_dump_media(struct shinkos1245_mediadesc *medias, medias[i].print_type, medias[i].columns, medias[i].rows, - medias[i].code, medias[i].type); + medias[i].type, medias[i].print_type); } } @@ -1214,7 +1219,7 @@ int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv) case 'm': j = shinkos1245_get_media(ctx); if (!j) - shinkos1245_dump_media(ctx->medias, ctx->num_medias); + shinkos1245_dump_media(ctx->medias, ctx->media_8x12, ctx->num_medias); break; case 'R': j = shinkos1245_reset(ctx); @@ -1404,9 +1409,6 @@ static int shinkos1245_main_loop(void *vctx, int copies) { } /* Make sure print size is supported */ for (i = 0 ; i < ctx->num_medias ; i++) { - if (ctx->medias[i].rows >= 3636) - ctx->media_8x12 = 1; - if (ctx->hdr.media == ctx->medias[i].code && ctx->hdr.method == ctx->medias[i].print_type && ctx->hdr.rows == ctx->medias[i].rows && @@ -1640,7 +1642,7 @@ static int shinkos1245_query_serno(struct libusb_device_handle *dev, uint8_t end struct dyesub_backend shinkos1245_backend = { .name = "Shinko/Sinfonia CHC-S1245", - .version = "0.15WIP", + .version = "0.16WIP", .uri_prefix = "shinkos1245", .cmdline_usage = shinkos1245_cmdline, .cmdline_arg = shinkos1245_cmdline_arg, -- cgit v1.2.1