dnpds40: Add support for job cancel and printer reset.
And fix iserial support.master
parent
6efd1242f8
commit
1045fa9f3f
4
README
4
README
|
@ -622,8 +622,10 @@
|
|||
-k num Specify standby delay (1-99 minutes, 0 disables) [1]
|
||||
-K num Keep Media Status Across Power Cycles (1 yes, 0 no) [1]
|
||||
-x num Set USB iSerialNumber reporting (1 yes, 0 no) [1]
|
||||
-X Cancel current job
|
||||
-R Reset printer to defaults
|
||||
|
||||
Notes:
|
||||
Notes:
|
||||
|
||||
[1] Only supported by DNP-DS620
|
||||
[2] Certain printer features may require updating the printer firmware
|
||||
|
|
|
@ -1851,6 +1851,34 @@ static int dnpds40_clear_counter(struct dnpds40_ctx *ctx, char counter)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dnpds40_cancel_job(struct dnpds40_ctx *ctx)
|
||||
{
|
||||
struct dnpds40_cmd cmd;
|
||||
int ret;
|
||||
|
||||
/* Generate command */
|
||||
dnpds40_build_cmd(&cmd, "CNTRL", "CANCEL", 0);
|
||||
|
||||
if ((ret = dnpds40_do_cmd(ctx, &cmd, NULL, 0)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dnpds40_reset_printer(struct dnpds40_ctx *ctx)
|
||||
{
|
||||
struct dnpds40_cmd cmd;
|
||||
int ret;
|
||||
|
||||
/* Generate command */
|
||||
dnpds40_build_cmd(&cmd, "CNTRL", "PRINTER_RESET", 0);
|
||||
|
||||
if ((ret = dnpds40_do_cmd(ctx, &cmd, NULL, 0)))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dnpds620_standby_mode(struct dnpds40_ctx *ctx, int delay)
|
||||
{
|
||||
struct dnpds40_cmd cmd;
|
||||
|
@ -1920,13 +1948,15 @@ static void dnpds40_cmdline(void)
|
|||
{
|
||||
DEBUG("\t\t[ -i ] # Query printer info\n");
|
||||
DEBUG("\t\t[ -I ] # Query sensor info\n");
|
||||
DEBUG("\t\t[ -s ] # Query status\n");
|
||||
DEBUG("\t\t[ -k num ] # Set standby time (1-99 minutes, 0 disables)\n");
|
||||
DEBUG("\t\t[ -K num ] # Keep Media Status Across Power Cycles (1 on, 0 off)\n");
|
||||
DEBUG("\t\t[ -n ] # Query counters\n");
|
||||
DEBUG("\t\t[ -N A|B|M ] # Clear counter A/B/M\n");
|
||||
DEBUG("\t\t[ -p num ] # Set counter P\n");
|
||||
DEBUG("\t\t[ -k num ] # Set standby time (1-99 minutes, 0 disables)\n");
|
||||
DEBUG("\t\t[ -K num ] # Keep Media Status Across Power Cycles (1 on, 0 off)\n");
|
||||
DEBUG("\t\t[ -R ] # Reset printer\n");
|
||||
DEBUG("\t\t[ -s ] # Query status\n");
|
||||
DEBUG("\t\t[ -x num ] # Set USB iSerialNumber Reporting (1 on, 0 off)\n");
|
||||
DEBUG("\t\t[ -X ] # Cancel current print job\n");
|
||||
}
|
||||
|
||||
static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
||||
|
@ -1937,7 +1967,7 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "iInN:p:sK:k:")) >= 0) {
|
||||
while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "iIk:K:nN:p:Rsx:X")) >= 0) {
|
||||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'i':
|
||||
|
@ -1946,30 +1976,6 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
case 'I':
|
||||
j = dnpds40_get_sensors(ctx);
|
||||
break;
|
||||
case 'n':
|
||||
j = dnpds40_get_counters(ctx);
|
||||
break;
|
||||
case 'N':
|
||||
if (optarg[0] != 'A' &&
|
||||
optarg[0] != 'B' &&
|
||||
optarg[0] != 'M')
|
||||
return CUPS_BACKEND_FAILED;
|
||||
if (!ctx->supports_matte) {
|
||||
ERROR("Printer FW does not support matte functions, please update!\n");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
j = dnpds40_clear_counter(ctx, optarg[0]);
|
||||
break;
|
||||
case 'p':
|
||||
if (!ctx->supports_counterp) {
|
||||
ERROR("Printer FW dows not support P counter!\n");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
j = dnpds40_set_counter_p(ctx, optarg);
|
||||
break;
|
||||
case 's':
|
||||
j = dnpds40_get_status(ctx);
|
||||
break;
|
||||
case 'k': {
|
||||
int time = atoi(optarg);
|
||||
if (!ctx->supports_standby) {
|
||||
|
@ -2000,6 +2006,35 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
j = dnpds620_media_keep_mode(ctx, keep);
|
||||
break;
|
||||
}
|
||||
case 'n':
|
||||
j = dnpds40_get_counters(ctx);
|
||||
break;
|
||||
case 'N':
|
||||
if (optarg[0] != 'A' &&
|
||||
optarg[0] != 'B' &&
|
||||
optarg[0] != 'M')
|
||||
return CUPS_BACKEND_FAILED;
|
||||
if (!ctx->supports_matte) {
|
||||
ERROR("Printer FW does not support matte functions, please update!\n");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
j = dnpds40_clear_counter(ctx, optarg[0]);
|
||||
break;
|
||||
case 'p':
|
||||
if (!ctx->supports_counterp) {
|
||||
ERROR("Printer FW dows not support P counter!\n");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
j = dnpds40_set_counter_p(ctx, optarg);
|
||||
break;
|
||||
case 'R': {
|
||||
j = dnpds40_reset_printer(ctx);
|
||||
break;
|
||||
}
|
||||
case 's': {
|
||||
j = dnpds40_get_status(ctx);
|
||||
break;
|
||||
}
|
||||
case 'x': {
|
||||
int enable = atoi(optarg);
|
||||
if (!ctx->supports_iserial) {
|
||||
|
@ -2015,6 +2050,10 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
j = dnpds620_iserial_mode(ctx, enable);
|
||||
break;
|
||||
}
|
||||
case 'X': {
|
||||
j = dnpds40_cancel_job(ctx);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -2028,7 +2067,7 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
/* Exported */
|
||||
struct dyesub_backend dnpds40_backend = {
|
||||
.name = "DNP DS40/DS80/DSRX1/DS620",
|
||||
.version = "0.76",
|
||||
.version = "0.77",
|
||||
.uri_prefix = "dnpds40",
|
||||
.cmdline_usage = dnpds40_cmdline,
|
||||
.cmdline_arg = dnpds40_cmdline_arg,
|
||||
|
|
Loading…
Reference in New Issue