all: Get rid of the remainder of the old two-stage cmdline parsing
All backend->cmdline_arg() invocations are done with intent to execute!
This commit is contained in:
parent
3da69ee55b
commit
b343d56f1e
|
@ -955,10 +955,11 @@ top:
|
|||
|
||||
static int canonselphy_cmdline_arg(void *vctx, int argc, char **argv)
|
||||
{
|
||||
// struct canonselphy_ctx *ctx = vctx;
|
||||
struct canonselphy_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
UNUSED(vctx);
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
|
@ -976,7 +977,7 @@ static int canonselphy_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
|
||||
struct dyesub_backend canonselphy_backend = {
|
||||
.name = "Canon SELPHY CP/ES",
|
||||
.version = "0.88",
|
||||
.version = "0.89",
|
||||
.uri_prefix = "canonselphy",
|
||||
.cmdline_arg = canonselphy_cmdline_arg,
|
||||
.init = canonselphy_init,
|
||||
|
|
|
@ -823,6 +823,9 @@ static int cw01_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct cw01_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -830,32 +833,20 @@ static int cw01_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'i':
|
||||
if (ctx) {
|
||||
j = cw01_get_info(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = cw01_get_info(ctx);
|
||||
break;
|
||||
case 'n':
|
||||
if (ctx) {
|
||||
j = cw01_get_counters(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = cw01_get_counters(ctx);
|
||||
break;
|
||||
case 'N':
|
||||
if (optarg[0] != 'A' &&
|
||||
optarg[0] != 'B')
|
||||
return CUPS_BACKEND_FAILED;
|
||||
if (ctx) {
|
||||
j = cw01_clear_counter(ctx, optarg[0]);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = cw01_clear_counter(ctx, optarg[0]);
|
||||
break;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
j = cw01_get_status(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = cw01_get_status(ctx);
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -869,7 +860,7 @@ static int cw01_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
/* Exported */
|
||||
struct dyesub_backend cw01_backend = {
|
||||
.name = "Citizen CW-01",
|
||||
.version = "0.11",
|
||||
.version = "0.12",
|
||||
.uri_prefix = "citizencw01",
|
||||
.cmdline_usage = cw01_cmdline,
|
||||
.cmdline_arg = cw01_cmdline_arg,
|
||||
|
|
|
@ -1572,6 +1572,9 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct dnpds40_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -1579,100 +1582,76 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'i':
|
||||
if (ctx) {
|
||||
j = dnpds40_get_info(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = dnpds40_get_info(ctx);
|
||||
break;
|
||||
case 'I':
|
||||
if (ctx) {
|
||||
j = dnpds40_get_sensors(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = dnpds40_get_sensors(ctx);
|
||||
break;
|
||||
case 'n':
|
||||
if (ctx) {
|
||||
j = dnpds40_get_counters(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = dnpds40_get_counters(ctx);
|
||||
break;
|
||||
case 'N':
|
||||
if (optarg[0] != 'A' &&
|
||||
optarg[0] != 'B' &&
|
||||
optarg[0] != 'M')
|
||||
return CUPS_BACKEND_FAILED;
|
||||
if (ctx) {
|
||||
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;
|
||||
if (!ctx->supports_matte) {
|
||||
ERROR("Printer FW does not support matte functions, please update!\n");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
return 2;
|
||||
j = dnpds40_clear_counter(ctx, optarg[0]);
|
||||
break;
|
||||
case 'p':
|
||||
if (ctx) {
|
||||
j = dnpds40_set_counter_p(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = dnpds40_set_counter_p(ctx, optarg);
|
||||
break;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
j = dnpds40_get_status(ctx);
|
||||
j = dnpds40_get_status(ctx);
|
||||
break;
|
||||
case 'k': {
|
||||
int time = atoi(optarg);
|
||||
if (!ctx->supports_standby) {
|
||||
ERROR("Printer does not support standby\n");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case 'k':
|
||||
if (ctx) {
|
||||
int time = atoi(optarg);
|
||||
if (!ctx->supports_standby) {
|
||||
ERROR("Printer does not support standby\n");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
if (time < 0 || time > 99) {
|
||||
ERROR("Value out of range (0-99)");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
j = dnpds620_standby_mode(ctx, time);
|
||||
if (time < 0 || time > 99) {
|
||||
ERROR("Value out of range (0-99)");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
case 'K':
|
||||
if (ctx) {
|
||||
int keep = atoi(optarg);
|
||||
if (!ctx->supports_standby) {
|
||||
ERROR("Printer does not support media keep mode\n");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
if (keep < 0 || keep > 1) {
|
||||
ERROR("Value out of range (0-1)");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
j = dnpds620_media_keep_mode(ctx, keep);
|
||||
j = dnpds620_standby_mode(ctx, time);
|
||||
break;
|
||||
}
|
||||
case 'K': {
|
||||
int keep = atoi(optarg);
|
||||
if (!ctx->supports_standby) {
|
||||
ERROR("Printer does not support media keep mode\n");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
case 'x':
|
||||
if (ctx) {
|
||||
int enable = atoi(optarg);
|
||||
if (!ctx->supports_iserial) {
|
||||
ERROR("Printer does not support USB iSerialNumber reporting\n");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
if (enable < 0 || enable > 1) {
|
||||
ERROR("Value out of range (0-1)");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
j = dnpds620_iserial_mode(ctx, enable);
|
||||
if (keep < 0 || keep > 1) {
|
||||
ERROR("Value out of range (0-1)");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = dnpds620_media_keep_mode(ctx, keep);
|
||||
break;
|
||||
}
|
||||
case 'x': {
|
||||
int enable = atoi(optarg);
|
||||
if (!ctx->supports_iserial) {
|
||||
ERROR("Printer does not support USB iSerialNumber reporting\n");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
if (enable < 0 || enable > 1) {
|
||||
ERROR("Value out of range (0-1)");
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
j = dnpds620_iserial_mode(ctx, enable);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -1686,7 +1665,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.60",
|
||||
.version = "0.61",
|
||||
.uri_prefix = "dnpds40",
|
||||
.cmdline_usage = dnpds40_cmdline,
|
||||
.cmdline_arg = dnpds40_cmdline_arg,
|
||||
|
|
|
@ -261,6 +261,9 @@ int kodak1400_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct kodak1400_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -268,11 +271,8 @@ int kodak1400_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'C':
|
||||
if (ctx) {
|
||||
j = kodak1400_set_tonecurve(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = kodak1400_set_tonecurve(ctx, optarg);
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ top:
|
|||
|
||||
struct dyesub_backend kodak1400_backend = {
|
||||
.name = "Kodak 1400/805",
|
||||
.version = "0.33",
|
||||
.version = "0.34",
|
||||
.uri_prefix = "kodak1400",
|
||||
.cmdline_usage = kodak1400_cmdline,
|
||||
.cmdline_arg = kodak1400_cmdline_arg,
|
||||
|
|
|
@ -491,6 +491,9 @@ static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct kodak605_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -498,31 +501,19 @@ static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'C':
|
||||
if (ctx) {
|
||||
j = kodak605_set_tonecurve(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = kodak605_set_tonecurve(ctx, optarg);
|
||||
break;
|
||||
case 'm':
|
||||
if (ctx) {
|
||||
uint8_t mediabuf[MAX_MEDIA_LEN];
|
||||
struct kodak605_media_list *media = (struct kodak605_media_list *)mediabuf;
|
||||
j = kodak605_get_media(ctx, media);
|
||||
if (!j)
|
||||
kodak605_dump_mediainfo(media);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
struct kodak605_status sts;
|
||||
kodak605_dump_mediainfo(ctx->media);
|
||||
break;
|
||||
case 's': {
|
||||
struct kodak605_status sts;
|
||||
|
||||
j = kodak605_get_status(ctx, &sts);
|
||||
if (!j)
|
||||
kodak605_dump_status(&sts);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = kodak605_get_status(ctx, &sts);
|
||||
if (!j)
|
||||
kodak605_dump_status(&sts);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -536,7 +527,7 @@ static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
/* Exported */
|
||||
struct dyesub_backend kodak605_backend = {
|
||||
.name = "Kodak 605",
|
||||
.version = "0.22",
|
||||
.version = "0.23",
|
||||
.uri_prefix = "kodak605",
|
||||
.cmdline_usage = kodak605_cmdline,
|
||||
.cmdline_arg = kodak605_cmdline_arg,
|
||||
|
|
|
@ -584,6 +584,9 @@ static int kodak6800_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct kodak6800_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -591,39 +594,21 @@ static int kodak6800_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'c':
|
||||
if (ctx) {
|
||||
j = kodak6800_get_tonecurve(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = kodak6800_get_tonecurve(ctx, optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (ctx) {
|
||||
j = kodak6800_set_tonecurve(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = kodak6800_set_tonecurve(ctx, optarg);
|
||||
break;
|
||||
case 'm':
|
||||
if (ctx) {
|
||||
j = kodak6800_get_mediainfo(ctx, ctx->media);
|
||||
if (!j)
|
||||
kodak68x0_dump_mediainfo(ctx->media);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
struct kodak68x0_status_readback status;
|
||||
j = kodak6800_get_mediainfo(ctx, ctx->media);
|
||||
if (!j)
|
||||
j = kodak6800_get_status(ctx, &status);
|
||||
if (!j)
|
||||
kodak68x0_dump_status(ctx, &status);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
kodak68x0_dump_mediainfo(ctx->media);
|
||||
break;
|
||||
case 's': {
|
||||
struct kodak68x0_status_readback status;
|
||||
j = kodak6800_get_status(ctx, &status);
|
||||
if (!j)
|
||||
kodak68x0_dump_status(ctx, &status);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -883,7 +868,7 @@ static int kodak6800_main_loop(void *vctx, int copies) {
|
|||
/* Exported */
|
||||
struct dyesub_backend kodak6800_backend = {
|
||||
.name = "Kodak 6800/6850",
|
||||
.version = "0.46",
|
||||
.version = "0.47",
|
||||
.uri_prefix = "kodak6800",
|
||||
.cmdline_usage = kodak6800_cmdline,
|
||||
.cmdline_arg = kodak6800_cmdline_arg,
|
||||
|
|
|
@ -568,6 +568,9 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct mitsu70x_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -575,11 +578,8 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 's':
|
||||
if (ctx) {
|
||||
j = mitsu70x_query_status(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = mitsu70x_query_status(ctx);
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
/* Exported */
|
||||
struct dyesub_backend mitsu70x_backend = {
|
||||
.name = "Mitsubishi CP-D70/D707/K60",
|
||||
.version = "0.31",
|
||||
.version = "0.32",
|
||||
.uri_prefix = "mitsu70x",
|
||||
.cmdline_usage = mitsu70x_cmdline,
|
||||
.cmdline_arg = mitsu70x_cmdline_arg,
|
||||
|
|
|
@ -737,6 +737,9 @@ static int mitsu9550_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct mitsu9550_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -744,17 +747,11 @@ static int mitsu9550_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'm':
|
||||
if (ctx) {
|
||||
j = mitsu9550_query_media(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = mitsu9550_query_media(ctx);
|
||||
break;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
j = mitsu9550_query_status(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = mitsu9550_query_status(ctx);
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -768,7 +765,7 @@ static int mitsu9550_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
/* Exported */
|
||||
struct dyesub_backend mitsu9550_backend = {
|
||||
.name = "Mitsubishi CP-9550DW-S",
|
||||
.version = "0.14",
|
||||
.version = "0.15",
|
||||
.uri_prefix = "mitsu9550",
|
||||
.cmdline_usage = mitsu9550_cmdline,
|
||||
.cmdline_arg = mitsu9550_cmdline_arg,
|
||||
|
|
|
@ -1165,6 +1165,9 @@ int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct shinkos1245_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -1172,77 +1175,49 @@ int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'F':
|
||||
if (ctx) {
|
||||
ctx->tonecurve = PARAM_TABLE_FINE;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
ctx->tonecurve = PARAM_TABLE_FINE;
|
||||
break;
|
||||
case 'c':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONE_TABLE_USER, ctx->tonecurve, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = get_tonecurve(ctx, TONE_TABLE_USER, ctx->tonecurve, optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONE_TABLE_USER, ctx->tonecurve, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = set_tonecurve(ctx, TONE_TABLE_USER, ctx->tonecurve, optarg);
|
||||
break;
|
||||
case 'l':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONE_TABLE_CURRENT, ctx->tonecurve, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = get_tonecurve(ctx, TONE_TABLE_CURRENT, ctx->tonecurve, optarg);
|
||||
break;
|
||||
case 'L':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONE_TABLE_CURRENT, ctx->tonecurve, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = set_tonecurve(ctx, TONE_TABLE_CURRENT, ctx->tonecurve, optarg);
|
||||
break;
|
||||
case 'm':
|
||||
if (ctx) {
|
||||
j = shinkos1245_get_media(ctx);
|
||||
if (!j)
|
||||
shinkos1245_dump_media(ctx->medias, ctx->num_medias);
|
||||
break;
|
||||
j = shinkos1245_get_media(ctx);
|
||||
if (!j)
|
||||
shinkos1245_dump_media(ctx->medias, ctx->num_medias);
|
||||
break;
|
||||
case 's': {
|
||||
struct shinkos1245_resp_status sts;
|
||||
j = shinkos1245_get_status(ctx, &sts);
|
||||
if (!j)
|
||||
shinkos1245_dump_status(&sts);
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
struct shinkos1245_resp_getid resp;
|
||||
j = shinkos1245_get_printerid(ctx, &resp);
|
||||
if (!j) {
|
||||
char buffer[sizeof(resp.data)+1];
|
||||
memcpy(buffer, resp.data, sizeof(resp.data));
|
||||
buffer[sizeof(resp.data)] = 0;
|
||||
INFO("Printer ID: %02x '%s'\n", resp.id, buffer);
|
||||
}
|
||||
return 1;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
struct shinkos1245_resp_status sts;
|
||||
j = shinkos1245_get_status(ctx, &sts);
|
||||
if (!j)
|
||||
shinkos1245_dump_status(&sts);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case 'u':
|
||||
if (ctx) {
|
||||
struct shinkos1245_resp_getid resp;
|
||||
j = shinkos1245_get_printerid(ctx, &resp);
|
||||
if (!j) {
|
||||
char buffer[sizeof(resp.data)+1];
|
||||
memcpy(buffer, resp.data, sizeof(resp.data));
|
||||
buffer[sizeof(resp.data)] = 0;
|
||||
INFO("Printer ID: %02x '%s'\n", resp.id, buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
case 'U':
|
||||
if (ctx) {
|
||||
j = shinkos1245_set_printerid(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = shinkos1245_set_printerid(ctx, optarg);
|
||||
break;
|
||||
case 'X':
|
||||
if (ctx) {
|
||||
j = shinkos1245_canceljob(ctx, atoi(optarg));
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = shinkos1245_canceljob(ctx, atoi(optarg));
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -1631,7 +1606,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.05WIP",
|
||||
.version = "0.06WIP",
|
||||
.uri_prefix = "shinkos1245",
|
||||
.cmdline_usage = shinkos1245_cmdline,
|
||||
.cmdline_arg = shinkos1245_cmdline_arg,
|
||||
|
|
|
@ -1293,6 +1293,9 @@ int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct shinkos2145_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -1300,100 +1303,55 @@ int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'b':
|
||||
if (ctx) {
|
||||
if (optarg[0] == '1')
|
||||
j = button_set(ctx, BUTTON_ENABLED);
|
||||
else if (optarg[0] == '0')
|
||||
j = button_set(ctx, BUTTON_DISABLED);
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
if (optarg[0] == '1')
|
||||
j = button_set(ctx, BUTTON_ENABLED);
|
||||
else if (optarg[0] == '0')
|
||||
j = button_set(ctx, BUTTON_DISABLED);
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
case 'c':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = get_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = set_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
case 'e':
|
||||
if (ctx) {
|
||||
j = get_errorlog(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_errorlog(ctx);
|
||||
break;
|
||||
case 'F':
|
||||
if (ctx) {
|
||||
j = flash_led(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = flash_led(ctx);
|
||||
break;
|
||||
case 'i':
|
||||
if (ctx) {
|
||||
j = get_fwinfo(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_fwinfo(ctx);
|
||||
break;
|
||||
case 'l':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
case 'L':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
case 'm':
|
||||
if (ctx) {
|
||||
j = get_mediainfo(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_mediainfo(ctx);
|
||||
break;
|
||||
case 'r':
|
||||
if (ctx) {
|
||||
j = reset_curve(ctx, RESET_USER_CURVE);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = reset_curve(ctx, RESET_USER_CURVE);
|
||||
break;
|
||||
case 'R':
|
||||
if (ctx) {
|
||||
j = reset_curve(ctx, RESET_PRINTER);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = reset_curve(ctx, RESET_PRINTER);
|
||||
break;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
j = get_status(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_status(ctx);
|
||||
break;
|
||||
case 'u':
|
||||
if (ctx) {
|
||||
j = get_user_string(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_user_string(ctx);
|
||||
break;
|
||||
case 'U':
|
||||
if (ctx) {
|
||||
j = set_user_string(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = set_user_string(ctx, optarg);
|
||||
break;
|
||||
case 'X':
|
||||
if (ctx) {
|
||||
j = cancel_job(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
j = cancel_job(ctx, optarg);
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -1734,7 +1692,7 @@ static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t end
|
|||
|
||||
struct dyesub_backend shinkos2145_backend = {
|
||||
.name = "Shinko/Sinfonia CHC-S2145",
|
||||
.version = "0.45",
|
||||
.version = "0.46",
|
||||
.uri_prefix = "shinkos2145",
|
||||
.cmdline_usage = shinkos2145_cmdline,
|
||||
.cmdline_arg = shinkos2145_cmdline_arg,
|
||||
|
|
|
@ -1457,6 +1457,9 @@ int shinkos6145_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct shinkos6145_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -1464,98 +1467,61 @@ int shinkos6145_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'c':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = set_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
case 'e':
|
||||
if (ctx) {
|
||||
j = get_errorlog(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_errorlog(ctx);
|
||||
break;
|
||||
case 'F':
|
||||
if (ctx) {
|
||||
j = flash_led(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = flash_led(ctx);
|
||||
break;
|
||||
case 'i':
|
||||
if (ctx) {
|
||||
j = get_fwinfo(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case 'k':
|
||||
if (ctx) {
|
||||
uint32_t i = atoi(optarg);
|
||||
if (i < 5)
|
||||
i = 0;
|
||||
else if (i < 15)
|
||||
i = 1;
|
||||
else if (i < 30)
|
||||
i = 2;
|
||||
else if (i < 60)
|
||||
i = 3;
|
||||
else if (i < 120)
|
||||
i = 4;
|
||||
else if (i < 240)
|
||||
i = 5;
|
||||
else
|
||||
i = 5;
|
||||
j = get_fwinfo(ctx);
|
||||
break;
|
||||
case 'k': {
|
||||
uint32_t i = atoi(optarg);
|
||||
if (i < 5)
|
||||
i = 0;
|
||||
else if (i < 15)
|
||||
i = 1;
|
||||
else if (i < 30)
|
||||
i = 2;
|
||||
else if (i < 60)
|
||||
i = 3;
|
||||
else if (i < 120)
|
||||
i = 4;
|
||||
else if (i < 240)
|
||||
i = 5;
|
||||
else
|
||||
i = 5;
|
||||
|
||||
j = set_param(ctx, PARAM_SLEEP_TIME, i);
|
||||
break;
|
||||
}
|
||||
j = set_param(ctx, PARAM_SLEEP_TIME, i);
|
||||
break;
|
||||
}
|
||||
case 'l':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
case 'L':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
case 'm':
|
||||
if (ctx) {
|
||||
j = get_mediainfo(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_mediainfo(ctx);
|
||||
break;
|
||||
case 'r':
|
||||
if (ctx) {
|
||||
j = reset_curve(ctx, RESET_TONE_CURVE);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = reset_curve(ctx, RESET_TONE_CURVE);
|
||||
break;
|
||||
case 'R':
|
||||
if (ctx) {
|
||||
j = reset_curve(ctx, RESET_PRINTER);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = reset_curve(ctx, RESET_PRINTER);
|
||||
break;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
j = get_status(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_status(ctx);
|
||||
break;
|
||||
case 'X':
|
||||
if (ctx) {
|
||||
j = cancel_job(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = cancel_job(ctx, optarg);
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
|
|
@ -1376,6 +1376,9 @@ int shinkos6245_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
struct shinkos6245_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
@ -1383,98 +1386,61 @@ int shinkos6245_cmdline_arg(void *vctx, int argc, char **argv)
|
|||
switch(i) {
|
||||
GETOPT_PROCESS_GLOBAL
|
||||
case 'c':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = set_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||
break;
|
||||
case 'e':
|
||||
if (ctx) {
|
||||
j = get_errorlog(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_errorlog(ctx);
|
||||
break;
|
||||
case 'F':
|
||||
if (ctx) {
|
||||
j = flash_led(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = flash_led(ctx);
|
||||
break;
|
||||
case 'i':
|
||||
if (ctx) {
|
||||
j = get_fwinfo(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case 'k':
|
||||
if (ctx) {
|
||||
uint32_t i = atoi(optarg);
|
||||
if (i < 5)
|
||||
i = 0;
|
||||
else if (i < 15)
|
||||
i = 1;
|
||||
else if (i < 30)
|
||||
i = 2;
|
||||
else if (i < 60)
|
||||
i = 3;
|
||||
else if (i < 120)
|
||||
i = 4;
|
||||
else if (i < 240)
|
||||
i = 5;
|
||||
else
|
||||
i = 5;
|
||||
j = get_fwinfo(ctx);
|
||||
break;
|
||||
case 'k': {
|
||||
uint32_t i = atoi(optarg);
|
||||
if (i < 5)
|
||||
i = 0;
|
||||
else if (i < 15)
|
||||
i = 1;
|
||||
else if (i < 30)
|
||||
i = 2;
|
||||
else if (i < 60)
|
||||
i = 3;
|
||||
else if (i < 120)
|
||||
i = 4;
|
||||
else if (i < 240)
|
||||
i = 5;
|
||||
else
|
||||
i = 5;
|
||||
|
||||
j = set_param(ctx, PARAM_SLEEP_TIME, i);
|
||||
break;
|
||||
}
|
||||
j = set_param(ctx, PARAM_SLEEP_TIME, i);
|
||||
break;
|
||||
}
|
||||
case 'l':
|
||||
if (ctx) {
|
||||
j = get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
case 'L':
|
||||
if (ctx) {
|
||||
j = set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||
break;
|
||||
case 'm':
|
||||
if (ctx) {
|
||||
j = get_mediainfo(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_mediainfo(ctx);
|
||||
break;
|
||||
case 'r':
|
||||
if (ctx) {
|
||||
j = reset_curve(ctx, RESET_TONE_CURVE);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = reset_curve(ctx, RESET_TONE_CURVE);
|
||||
break;
|
||||
case 'R':
|
||||
if (ctx) {
|
||||
j = reset_curve(ctx, RESET_PRINTER);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = reset_curve(ctx, RESET_PRINTER);
|
||||
break;
|
||||
case 's':
|
||||
if (ctx) {
|
||||
j = get_status(ctx);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = get_status(ctx);
|
||||
break;
|
||||
case 'X':
|
||||
if (ctx) {
|
||||
j = cancel_job(ctx, optarg);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
j = cancel_job(ctx, optarg);
|
||||
break;
|
||||
default:
|
||||
break; /* Ignore completely */
|
||||
}
|
||||
|
@ -1843,7 +1809,7 @@ static int shinkos6245_query_serno(struct libusb_device_handle *dev, uint8_t end
|
|||
|
||||
struct dyesub_backend shinkos6245_backend = {
|
||||
.name = "Shinko/Sinfonia CHC-S6245",
|
||||
.version = "0.02WIP",
|
||||
.version = "0.03WIP",
|
||||
.uri_prefix = "shinkos6245",
|
||||
.cmdline_usage = shinkos6245_cmdline,
|
||||
.cmdline_arg = shinkos6245_cmdline_arg,
|
||||
|
|
|
@ -257,11 +257,12 @@ top:
|
|||
|
||||
static int updr150_cmdline_arg(void *vctx, int argc, char **argv)
|
||||
{
|
||||
// struct updr150_ctx *ctx = vctx;
|
||||
struct updr150_ctx *ctx = vctx;
|
||||
int i, j = 0;
|
||||
|
||||
UNUSED(vctx);
|
||||
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
/* Reset arg parsing */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
|
Loading…
Reference in a new issue