dnpds40/80: Make backend multipage-capable.
parent
66f4756483
commit
cf59af280c
|
@ -309,12 +309,15 @@ static void dnpds40_teardown(void *vctx) {
|
|||
|
||||
static int dnpds40_read_parse(void *vctx, int data_fd) {
|
||||
struct dnpds40_ctx *ctx = vctx;
|
||||
int i, j;
|
||||
int i, j, run = 1;
|
||||
char buf[9] = { 0 };
|
||||
|
||||
if (!ctx)
|
||||
return 1;
|
||||
|
||||
if (ctx->databuf)
|
||||
free(ctx->databuf);
|
||||
|
||||
ctx->datalen = 0;
|
||||
ctx->databuf = malloc(MAX_PRINTJOB_LEN);
|
||||
if (!ctx->databuf) {
|
||||
|
@ -326,7 +329,7 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
|
|||
// until we get to the plane data
|
||||
|
||||
/* Read in command header */
|
||||
while (1) {
|
||||
while (run) {
|
||||
int remain;
|
||||
i = read(data_fd, ctx->databuf + ctx->datalen,
|
||||
sizeof(struct dnpds40_cmd));
|
||||
|
@ -379,6 +382,10 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
|
|||
}
|
||||
}
|
||||
|
||||
/* This is the last block.. */
|
||||
if(!memcmp("CNTRL START", ctx->databuf + ctx->datalen + 2, 11))
|
||||
run = 0;
|
||||
|
||||
/* Add in the size of this chunk */
|
||||
ctx->datalen += sizeof(struct dnpds40_cmd) + j;
|
||||
}
|
||||
|
@ -891,8 +898,9 @@ static int dnpds40_cmdline_arg(void *vctx, int run, char *arg1, char *arg2)
|
|||
/* Exported */
|
||||
struct dyesub_backend dnpds40_backend = {
|
||||
.name = "DNP DS40/DS80",
|
||||
.version = "0.21",
|
||||
.version = "0.22",
|
||||
.uri_prefix = "dnpds40",
|
||||
.multipage_capable = 1,
|
||||
.cmdline_usage = dnpds40_cmdline,
|
||||
.cmdline_arg = dnpds40_cmdline_arg,
|
||||
.init = dnpds40_init,
|
||||
|
|
Loading…
Reference in New Issue