summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend_shinkos1245.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c
index 8cd96ba..9ca8ba2 100644
--- a/backend_shinkos1245.c
+++ b/backend_shinkos1245.c
@@ -496,7 +496,6 @@ static int shinkos1245_get_media(struct shinkos1245_ctx *ctx)
struct shinkos1245_resp_media resp;
int i, j;
int ret = 0, num;
- int remain = -1;
shinkos1245_fill_hdr(&cmd.hdr);
memset(cmd.pad, 0, sizeof(cmd.pad));
@@ -515,23 +514,18 @@ static int shinkos1245_get_media(struct shinkos1245_ctx *ctx)
return -99;
}
- /* resp.count is the *total* number of media entries */
- if (remain == -1)
- remain = resp.count;
-
/* Store media info */
- for (j = 0; (j < remain) && (j < 5) ; j++) {
+ for (j = 0; j < NUM_MEDIAS && ctx->num_medias < resp.count ; j++) {
ctx->medias[ctx->num_medias].code = resp.data[j].code;
ctx->medias[ctx->num_medias].columns = be16_to_cpu(resp.data[j].columns);
ctx->medias[ctx->num_medias].rows = be16_to_cpu(resp.data[j].rows);
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++;
- remain--;
}
/* Once we've parsed them all.. we're done */
- if (remain <= 0)
+ if (ctx->num_medias == resp.count)
break;
}
return ret;
@@ -1646,7 +1640,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.14WIP",
+ .version = "0.15WIP",
.uri_prefix = "shinkos1245",
.cmdline_usage = shinkos1245_cmdline,
.cmdline_arg = shinkos1245_cmdline_arg,