diff options
-rw-r--r-- | brightnessctl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/brightnessctl.c b/brightnessctl.c index 4b46d6e..0e16b0e 100644 --- a/brightnessctl.c +++ b/brightnessctl.c @@ -59,7 +59,7 @@ struct value { unsigned int sign : 1; }; -enum operation { GET, MAX, SET }; +enum operation { INFO, GET, MAX, SET }; struct params { char *class; @@ -155,15 +155,17 @@ int main(int argc, char **argv) { if (!dev_name) dev_name = devs[0]->id; if (argc == 0) - p.operation = GET; + p.operation = INFO; else switch (argv[0][0]) { case 'm': p.operation = MAX; break; case 's': p.operation = SET; break; - default: case 'g': p.operation = GET; break; + default: + case 'i': + p.operation = INFO; break; } argc--; argv++; @@ -195,8 +197,11 @@ int main(int argc, char **argv) { int apply_operation(struct device *dev, unsigned int operation, struct value *val) { switch (operation) { - case GET: + case INFO: return print_device(dev); + case GET: + fprintf(stdout, "%u\n", dev->curr_brightness); + return 0; case MAX: fprintf(stdout, "%u\n", dev->max_brightness); return 0; @@ -545,6 +550,7 @@ Options:\n\ -c, --class=CLASS\t\tspecify device class.\n\ \n\ Operations:\n\ + i, info\t\t\tget device info.\n\ g, get\t\t\tget current brightness of the device.\n\ m, max\t\t\tget maximum brightness of the device.\n\ s, set VALUE\t\t\tset brightness of the device.\n\ |