diff --git a/README.md b/README.md new file mode 100644 index 0000000..da8200a --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# README + +## About +rexbacklight is a program designed to operate similarly to xbacklight, though it's not a drop in replacement (possibly adding drop in replacement configure option at some point). Unlike xbacklight, this program does not use X11 to control the backlight devices. rexbacklight directly interacts with sysfs to change backlight levels, read their current status, and find their max output level. This has the advantage of allowing rexbacklight to run without the X server running and will work even if X doesn't recognize your backlight device, which was my original inspiration to make this project. + +I've also since added a program to control LED devices, rexledctl (best name I could think of). This one was inspired by the fact that my laptop's keyboard backlight wasn't controllable by any program I had and the hardware button didn't work either. So now I have my own program which can control it. It was so similar in function to rexbacklight that I decided to just add some compile time `#define`'s and make a few things more modular in the code and have the same source files make 2 different programs. + +Either program can be built alone or both together. This is configured using some cmake magic. + +Current version is 1.0 as of writing this, so if the version is much newer, remind me to update this readme. + +``` +Usage: rexbacklight [argument] [options] [argument] + +Options: + --device|-d + select which device to control + --fade|-f + change brightness over time interval + --steps|-s + number of steps over which to fade + --get|-g + print current brightness level to stdout + --list|-l + print device names to stdout and exit + --help|-h + print this help message and exit + --version + print program version and exit + +Arguments: + = + - + + + off + max + min + +rexbacklight Copyright (C) 2018 rexy712 +This program comes with ABSOLUTELY NO WARRANTY. +This is free software, and you are welcome to redistribute it +under certain conditions; see the GNU GPLv3 for details. +A copy of the GPLv3 is available with the source in the file 'LICENSE' +``` + + +## Building +##### Run the following commands +``` +mkdir build +cd build +ccmake .. +#or just 'cmake ..' and specify options on command line +make +``` + +## Installing +##### Run the following commands from the build directory after building +``` +sudo make install +``` +##### Reload the udev rules for them to take effect, otherwise just reboot +``` +sudo udevadm control --reload-rules +sudo udevadm trigger +``` + +## Uninstalling +##### Run the following commands from the build directory +``` +sudo make uninstall +``` diff --git a/src/common.c b/src/common.c index 6c8dd11..9db9d3d 100644 --- a/src/common.c +++ b/src/common.c @@ -43,7 +43,13 @@ _Noreturn void usage(int exit_val){ printf("Options:\n"); for(i = 0;i < rexbacklight_args_length;++i){ - printf(" %s|%s\n", rexbacklight_args[i].lopt, rexbacklight_args[i].sopt); + if(!rexbacklight_args[i].lopt){ + printf(" %s\n", rexbacklight_args[i].sopt); + }else if(!rexbacklight_args[i].sopt){ + printf(" %s\n", rexbacklight_args[i].lopt); + }else{ + printf(" %s|%s\n", rexbacklight_args[i].lopt, rexbacklight_args[i].sopt); + } printf(" %s\n", rexbacklight_args[i].desc); } printf("\n");