s1245: Implement the canceljob command.
All that's left is the actual printing. And testing all of this on a real printer.
This commit is contained in:
parent
06320b61db
commit
4a34c4e740
5
README
5
README
|
@ -326,6 +326,7 @@
|
|||
-m Query media information
|
||||
-u Query user string
|
||||
-U somestring Set user string to 'somestring'
|
||||
-X id Cancel print job 'id' [2]
|
||||
|
||||
[1] This terminates the backend as soon as the printer has acknowledged
|
||||
the print job, without waiting for the print job to complete.
|
||||
|
@ -333,6 +334,10 @@
|
|||
variable. This is the default behavior when using this backend
|
||||
with CUPS.
|
||||
|
||||
[2] Job ID is the Internal Job ID (reported via status)
|
||||
This cancels a multi-copy print job.
|
||||
To see which jobs are active/pending, see the output of the
|
||||
'-s' command, specifically the 'Bank' output.
|
||||
***************************************************************************
|
||||
BACKEND=sonyupdr150
|
||||
|
||||
|
|
|
@ -574,6 +574,30 @@ static int shinkos1245_set_printerid(struct shinkos1245_ctx *ctx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int shinkos1245_canceljob(struct shinkos1245_ctx *ctx,
|
||||
int id)
|
||||
{
|
||||
struct shinkos1245_cmd_canceljob cmd;
|
||||
struct shinkos1245_resp_status sts;
|
||||
|
||||
int ret, num;
|
||||
|
||||
shinkos1245_fill_hdr(&cmd.hdr);
|
||||
cmd.cmd[0] = 0x13;
|
||||
cmd.id = id;
|
||||
|
||||
ret = shinkos1245_do_cmd(ctx, &cmd, sizeof(cmd),
|
||||
&sts, sizeof(sts), &num);
|
||||
if (ret < 0) {
|
||||
ERROR("Failed to execute CANCELJOB command\n");
|
||||
return ret;
|
||||
}
|
||||
if (sts.code != CMD_CODE_OK) {
|
||||
ERROR("Bad return code on CANCELJOB command\n");
|
||||
return -99;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Structure dumps */
|
||||
static void shinkos1245_dump_status(struct shinkos1245_resp_status *sts)
|
||||
|
@ -722,6 +746,7 @@ static void shinkos1245_cmdline(void)
|
|||
DEBUG("\t\t[ -s ] # Query status\n");
|
||||
DEBUG("\t\t[ -u ] # Query user string\n");
|
||||
DEBUG("\t\t[ -U sometext ] # Set user string\n");
|
||||
DEBUG("\t\t[ -X jobid ] # Abort a printjob\n");
|
||||
}
|
||||
|
||||
int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv)
|
||||
|
@ -732,7 +757,7 @@ int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
while ((i = getopt(argc, argv, "fmsuU:")) >= 0) {
|
||||
while ((i = getopt(argc, argv, "fmsuU:X:")) >= 0) {
|
||||
switch(i) {
|
||||
case 'f':
|
||||
if (!ctx)
|
||||
|
@ -773,6 +798,11 @@ int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
return 1;
|
||||
j = shinkos1245_set_printerid(ctx, optarg);
|
||||
break;
|
||||
case 'X':
|
||||
if (!ctx)
|
||||
return 1;
|
||||
j = shinkos1245_canceljob(ctx, atoi(optarg));
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue