diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2025-07-31 20:49:59 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2025-07-31 21:15:26 +0200 |
commit | 135f336a7cc6521cb3dc2fab5b8bdff8bf14fb89 (patch) | |
tree | efffe18acebb5e090873df074ac179b4a905549f /eizoctl.c | |
parent | b4c1817c102ea06302a13e27b21047612e46b59f (diff) | |
download | usb-drivers-135f336a7cc6521cb3dc2fab5b8bdff8bf14fb89.tar.gz usb-drivers-135f336a7cc6521cb3dc2fab5b8bdff8bf14fb89.tar.xz usb-drivers-135f336a7cc6521cb3dc2fab5b8bdff8bf14fb89.zip |
eizoctl: add an option to list monitors
Diffstat (limited to 'eizoctl.c')
-rw-r--r-- | eizoctl.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1037,6 +1037,8 @@ eizo_watch(struct eizo_monitor *m, print_fn output, print_fn error) } static const char *usage = "Usage: %s OPTION...\n\n" + " -l, --list\n" + " List all connected EIZO monitors, with their serial number.\n" " -b, --brightness [+-]BRIGHTNESS\n" " Change monitor brightness; values go from 0 to 1 and may be relative.\n" " -i, --input NAME\n" @@ -1057,6 +1059,7 @@ run(int argc, char *argv[], print_fn output, print_fn error) { const char *name = argv[0]; static struct option opts[] = { + {"list", no_argument, NULL, 'l'}, {"brightness", required_argument, NULL, 'b'}, {"input", required_argument, NULL, 'i'}, {"restart", no_argument, NULL, 'r'}, @@ -1069,11 +1072,14 @@ run(int argc, char *argv[], print_fn output, print_fn error) int quiet = 0; double brightness = NAN; - bool relative = false, restart = false, events = false; + bool list = false, relative = false, restart = false, events = false; const char *port = NULL; int c = 0; - while ((c = getopt_long(argc, argv, "b:i:reqhV", opts, NULL)) != -1) + while ((c = getopt_long(argc, argv, "lb:i:reqhV", opts, NULL)) != -1) switch (c) { + case 'l': + list = true; + break; case 'b': relative = *optarg == '+' || *optarg == '-'; if (sscanf(optarg, "%lf", &brightness) && isfinite(brightness)) @@ -1133,6 +1139,9 @@ run(int argc, char *argv[], print_fn output, print_fn error) continue; } + if (list) + output("%s %s\n", m.product, m.serial); + if (isfinite(brightness)) { double prev = 0.; if (!eizo_get_brightness(&m, &prev)) { |