backends: Revamp cmdline args so you can specify multiple backend args at once.
This commit is contained in:
parent
b8242fe847
commit
1faa032ea6
|
@ -939,7 +939,7 @@ static void dnpds40_cmdline(void)
|
||||||
static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct dnpds40_ctx *ctx = vctx;
|
struct dnpds40_ctx *ctx = vctx;
|
||||||
int i;
|
int i, j = 0;
|
||||||
|
|
||||||
/* Reset arg parsing */
|
/* Reset arg parsing */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
@ -947,38 +947,44 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
while ((i = getopt(argc, argv, "inN:p:s")) >= 0) {
|
while ((i = getopt(argc, argv, "inN:p:s")) >= 0) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 'i':
|
case 'i':
|
||||||
if (ctx)
|
|
||||||
return dnpds40_get_info(ctx);
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
case 'n':
|
|
||||||
if (ctx)
|
|
||||||
return dnpds40_get_counters(ctx);
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
case 'N':
|
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (optarg[0] != 'A' &&
|
j = dnpds40_get_info(ctx);
|
||||||
optarg[0] != 'B' &&
|
break;
|
||||||
optarg[0] != 'M')
|
}
|
||||||
return -1;
|
return 1;
|
||||||
else
|
case 'n':
|
||||||
return dnpds40_clear_counter(ctx, optarg[0]);
|
if (ctx) {
|
||||||
} else
|
j = dnpds40_get_counters(ctx);
|
||||||
return 1;
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
case 'N':
|
||||||
|
if (optarg[0] != 'A' &&
|
||||||
|
optarg[0] != 'B' &&
|
||||||
|
optarg[0] != 'M')
|
||||||
|
return -1;
|
||||||
|
if (ctx) {
|
||||||
|
j = dnpds40_clear_counter(ctx, optarg[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return dnpds40_set_counter_p(ctx, optarg);
|
j = dnpds40_set_counter_p(ctx, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 's':
|
case 's':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return dnpds40_get_status(ctx);
|
j = dnpds40_get_status(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
break; /* Ignore completely */
|
break; /* Ignore completely */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j) return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -987,7 +993,7 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
/* Exported */
|
/* Exported */
|
||||||
struct dyesub_backend dnpds40_backend = {
|
struct dyesub_backend dnpds40_backend = {
|
||||||
.name = "DNP DS40/DS80/DSRX1",
|
.name = "DNP DS40/DS80/DSRX1",
|
||||||
.version = "0.28",
|
.version = "0.29",
|
||||||
.uri_prefix = "dnpds40",
|
.uri_prefix = "dnpds40",
|
||||||
.cmdline_usage = dnpds40_cmdline,
|
.cmdline_usage = dnpds40_cmdline,
|
||||||
.cmdline_arg = dnpds40_cmdline_arg,
|
.cmdline_arg = dnpds40_cmdline_arg,
|
||||||
|
|
|
@ -251,7 +251,7 @@ static void kodak1400_cmdline(void)
|
||||||
int kodak1400_cmdline_arg(void *vctx, int argc, char **argv)
|
int kodak1400_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct kodak1400_ctx *ctx = vctx;
|
struct kodak1400_ctx *ctx = vctx;
|
||||||
int i;
|
int i, j = 0;
|
||||||
|
|
||||||
/* Reset arg parsing */
|
/* Reset arg parsing */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
@ -259,13 +259,16 @@ int kodak1400_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
while ((i = getopt(argc, argv, "C:")) >= 0) {
|
while ((i = getopt(argc, argv, "C:")) >= 0) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 'C':
|
case 'C':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return kodak1400_set_tonecurve(ctx, optarg);
|
j = kodak1400_set_tonecurve(ctx, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
break; /* Ignore completely */
|
break; /* Ignore completely */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j) return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -593,7 +596,7 @@ top:
|
||||||
|
|
||||||
struct dyesub_backend kodak1400_backend = {
|
struct dyesub_backend kodak1400_backend = {
|
||||||
.name = "Kodak 1400/805",
|
.name = "Kodak 1400/805",
|
||||||
.version = "0.30",
|
.version = "0.31",
|
||||||
.uri_prefix = "kodak1400",
|
.uri_prefix = "kodak1400",
|
||||||
.cmdline_usage = kodak1400_cmdline,
|
.cmdline_usage = kodak1400_cmdline,
|
||||||
.cmdline_arg = kodak1400_cmdline_arg,
|
.cmdline_arg = kodak1400_cmdline_arg,
|
||||||
|
|
|
@ -483,7 +483,7 @@ static void kodak605_cmdline(void)
|
||||||
static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
|
static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct kodak605_ctx *ctx = vctx;
|
struct kodak605_ctx *ctx = vctx;
|
||||||
int i;
|
int i, j = 0;
|
||||||
|
|
||||||
/* Reset arg parsing */
|
/* Reset arg parsing */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
@ -491,23 +491,28 @@ static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
while ((i = getopt(argc, argv, "C:ms")) >= 0) {
|
while ((i = getopt(argc, argv, "C:ms")) >= 0) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 'C':
|
case 'C':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return kodak605_set_tonecurve(ctx, optarg);
|
j = kodak605_set_tonecurve(ctx, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'm':
|
case 'm':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return kodak605_get_media(ctx);
|
j = kodak605_get_media(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 's':
|
case 's':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return kodak605_get_status(ctx);
|
j = kodak605_get_status(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
break; /* Ignore completely */
|
break; /* Ignore completely */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j) return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -516,7 +521,7 @@ static int kodak605_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
/* Exported */
|
/* Exported */
|
||||||
struct dyesub_backend kodak605_backend = {
|
struct dyesub_backend kodak605_backend = {
|
||||||
.name = "Kodak 605",
|
.name = "Kodak 605",
|
||||||
.version = "0.17",
|
.version = "0.18",
|
||||||
.uri_prefix = "kodak605",
|
.uri_prefix = "kodak605",
|
||||||
.cmdline_usage = kodak605_cmdline,
|
.cmdline_usage = kodak605_cmdline,
|
||||||
.cmdline_arg = kodak605_cmdline_arg,
|
.cmdline_arg = kodak605_cmdline_arg,
|
||||||
|
|
|
@ -294,7 +294,7 @@ static void kodak6800_cmdline(void)
|
||||||
static int kodak6800_cmdline_arg(void *vctx, int argc, char **argv)
|
static int kodak6800_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct kodak6800_ctx *ctx = vctx;
|
struct kodak6800_ctx *ctx = vctx;
|
||||||
int i;
|
int i, j = 0;
|
||||||
|
|
||||||
/* Reset arg parsing */
|
/* Reset arg parsing */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
@ -302,18 +302,22 @@ static int kodak6800_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
while ((i = getopt(argc, argv, "C:c:")) >= 0) {
|
while ((i = getopt(argc, argv, "C:c:")) >= 0) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 'c':
|
case 'c':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return kodak6800_get_tonecurve(ctx, optarg);
|
j = kodak6800_get_tonecurve(ctx, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return kodak6800_set_tonecurve(ctx, optarg);
|
j = kodak6800_set_tonecurve(ctx, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
break; /* Ignore completely */
|
break; /* Ignore completely */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j) return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -632,7 +636,7 @@ skip_query:
|
||||||
/* Exported */
|
/* Exported */
|
||||||
struct dyesub_backend kodak6800_backend = {
|
struct dyesub_backend kodak6800_backend = {
|
||||||
.name = "Kodak 6800/6850",
|
.name = "Kodak 6800/6850",
|
||||||
.version = "0.31",
|
.version = "0.32",
|
||||||
.uri_prefix = "kodak6800",
|
.uri_prefix = "kodak6800",
|
||||||
.cmdline_usage = kodak6800_cmdline,
|
.cmdline_usage = kodak6800_cmdline,
|
||||||
.cmdline_arg = kodak6800_cmdline_arg,
|
.cmdline_arg = kodak6800_cmdline_arg,
|
||||||
|
|
|
@ -380,7 +380,7 @@ static void mitsu70x_cmdline(void)
|
||||||
static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
|
static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct mitsu70x_ctx *ctx = vctx;
|
struct mitsu70x_ctx *ctx = vctx;
|
||||||
int i;
|
int i, j = 0;
|
||||||
|
|
||||||
/* Reset arg parsing */
|
/* Reset arg parsing */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
@ -388,13 +388,16 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
while ((i = getopt(argc, argv, "s")) >= 0) {
|
while ((i = getopt(argc, argv, "s")) >= 0) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 's':
|
case 's':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return mitsu70x_get_status(ctx);
|
j = mitsu70x_get_status(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
break; /* Ignore completely */
|
break; /* Ignore completely */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j) return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -404,7 +407,7 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
/* Exported */
|
/* Exported */
|
||||||
struct dyesub_backend mitsu70x_backend = {
|
struct dyesub_backend mitsu70x_backend = {
|
||||||
.name = "Mitsubishi CP-D70/D707",
|
.name = "Mitsubishi CP-D70/D707",
|
||||||
.version = "0.11",
|
.version = "0.12",
|
||||||
.uri_prefix = "mitsu70x",
|
.uri_prefix = "mitsu70x",
|
||||||
.cmdline_usage = mitsu70x_cmdline,
|
.cmdline_usage = mitsu70x_cmdline,
|
||||||
.cmdline_arg = mitsu70x_cmdline_arg,
|
.cmdline_arg = mitsu70x_cmdline_arg,
|
||||||
|
|
|
@ -1324,7 +1324,7 @@ static void shinkos2145_cmdline(void)
|
||||||
int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv)
|
int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct shinkos2145_ctx *ctx = vctx;
|
struct shinkos2145_ctx *ctx = vctx;
|
||||||
int i;
|
int i, j = 0;
|
||||||
|
|
||||||
/* Reset arg parsing */
|
/* Reset arg parsing */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
@ -1334,92 +1334,109 @@ int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv)
|
||||||
case 'b':
|
case 'b':
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (optarg[0] == '1')
|
if (optarg[0] == '1')
|
||||||
return button_set(ctx, BUTTON_ENABLED);
|
j = button_set(ctx, BUTTON_ENABLED);
|
||||||
else if (optarg[0] == '0')
|
else if (optarg[0] == '0')
|
||||||
return button_set(ctx, BUTTON_DISABLED);
|
j = button_set(ctx, BUTTON_DISABLED);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'c':
|
case 'c':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return get_tonecurve(ctx, TONECURVE_USER, optarg);
|
j = get_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return set_tonecurve(ctx, TONECURVE_USER, optarg);
|
j = set_tonecurve(ctx, TONECURVE_USER, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'e':
|
case 'e':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return get_errorlog(ctx);
|
j = get_errorlog(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'f':
|
case 'f':
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
ctx->fast_return = 1;
|
ctx->fast_return = 1;
|
||||||
return 0;
|
break;
|
||||||
} else
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case 'F':
|
case 'F':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return flash_led(ctx);
|
j = flash_led(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'i':
|
case 'i':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return get_fwinfo(ctx);
|
j = get_fwinfo(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'l':
|
case 'l':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
j = get_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'L':
|
case 'L':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
j = set_tonecurve(ctx, TONECURVE_CURRENT, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'm':
|
case 'm':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return get_mediainfo(ctx);
|
j = get_mediainfo(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'r':
|
case 'r':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return reset_curve(ctx, RESET_USER_CURVE);
|
j = reset_curve(ctx, RESET_USER_CURVE);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'R':
|
case 'R':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return reset_curve(ctx, RESET_PRINTER);
|
j = reset_curve(ctx, RESET_PRINTER);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 's':
|
case 's':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return get_status(ctx);
|
j = get_status(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'u':
|
case 'u':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return get_user_string(ctx);
|
j = get_user_string(ctx);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'U':
|
case 'U':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return set_user_string(ctx, optarg);
|
j = set_user_string(ctx, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
case 'X':
|
case 'X':
|
||||||
if (ctx)
|
if (ctx) {
|
||||||
return cancel_job(ctx, optarg);
|
j = cancel_job(ctx, optarg);
|
||||||
else
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
break; /* Ignore completely */
|
break; /* Ignore completely */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j) return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1727,7 +1744,7 @@ static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t end
|
||||||
|
|
||||||
struct dyesub_backend shinkos2145_backend = {
|
struct dyesub_backend shinkos2145_backend = {
|
||||||
.name = "Shinko/Sinfonia CHC-S2145 (S2)",
|
.name = "Shinko/Sinfonia CHC-S2145 (S2)",
|
||||||
.version = "0.30",
|
.version = "0.31",
|
||||||
.uri_prefix = "shinkos2145",
|
.uri_prefix = "shinkos2145",
|
||||||
.cmdline_usage = shinkos2145_cmdline,
|
.cmdline_usage = shinkos2145_cmdline,
|
||||||
.cmdline_arg = shinkos2145_cmdline_arg,
|
.cmdline_arg = shinkos2145_cmdline_arg,
|
||||||
|
|
Loading…
Reference in New Issue