Fix #46: Migrate to use ~/.cache/light for unpriviliged operation
When light is installed in the non-SUID root mode it cannot write to
/etc/light anymore, so we set up a ~/.cache/light instead.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Fix #45: Add --with-udev[=PATH] to configure, disables classic SUID root
This patch adds support for installing the 90-backlight.rules to gain
privileges to the kernel sysfs files. By default the classic SUID root
mode is used and the rules file is not installed.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Overhaul and simplify program usage and documentation in README
- Use version from configure script
- Simplify usage text for accessibility, only one command at a time
- Simplify terminology, we have commands and options to commands
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Rearrange and simplify text a bit, also put examples early
Most users want to see the examples as early as possible, so we place
them directly after the new (simplified) introduction. The examples
have been rewritten to separate commands from options and grouping
the command with its value, where applicable.
The rest of the document has just been auto-filled to fit to < 72
columns and sections now use === and ---- for headings to make the
README more accessible from a terminal.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds a standard configure script and converts the Makefile to
automake. This adresses PR #30, but in a more generic way, and also
eliminates the hard coded CC variable, enabling building with clang or
even a cross compiler.
Note: this is more a proof of concept and does not include the man page
generation. Another pull request addresses that.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Fix different kinds of issues with string buffers and pointers
- Use NAME_MAX and PATH_MAX instead of hardcoded values
- Allow paths to be longer than 256 chars
- Check pointers everywhere
- Use strncpy/snprintf instead of strcpy/sprintf
- Validate controllers' name (-s flag + a very long name -> bad things happening)
- Get rid of globals for dir iteration
Fix wrong behavior of 'light_controllerAccessible'
This function was:
- Reading values from the controller
- Checking write permission even when we just want reading values
- Checking the mincap file instead of the actual controller
The last one is also true for other functions using
'light_getBrightness'.
This commit fixes that.