summaryrefslogtreecommitdiff
path: root/src/backlight
Commit message (Collapse)AuthorAgeFilesLines
* util-lib: move shall_restore_state() to shared/reboot-utilZbigniew Jędrzejewski-Szmek2019-09-161-1/+1
| | | | | It's just a small function, but it is higher-level functionality. I don't see a good place for it, reboot-util.[ch] seems least bad
* tree-wide: (void)ify a few unlink() and rmdir()Lennart Poettering2019-03-271-1/+1
| | | | | | Let's be helpful to static analyzers which care about whether we knowingly ignore return values. We do in these cases, since they are usually part of error paths.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+4
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* backlight: handle loading truncated fileTopi Miettinen2019-02-021-1/+1
| | | | | | | | | | | | | | I had accidentally filled my /var partition. This caused backlight to fail to start even with disk space, because the brightness files were truncated to zero size: systemd-backlight[624]: acpi_video0: Failed to parse brightness "": Invalid argument systemd-backlight[624]: acpi_video0: Failed to write system 'brightness' attribute: No such device or address systemd[1]: systemd-backlight@backlight:acpi_video0.service: Main process exited, code=exited, status=1/FAILURE systemd[1]: systemd-backlight@backlight:acpi_video0.service: Failed with result 'exit-code'. systemd[1]: Failed to start Load/Save Screen Backlight Brightness of backlight:acpi_video0. Handle a truncated file like non-existent file.
* tree-wide: port various places over to STARTSWITH_SET()Lennart Poettering2018-11-261-3/+1
|
* backlight: use DEFINE_MAIN_FUNCTION() macroYu Watanabe2018-11-201-57/+37
|
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* Move LONG_LINE_MAX definition to fileio.hZbigniew Jędrzejewski-Szmek2018-11-141-1/+0
| | | | | | | | | | | All users of the macro (except for one, in serialize.c), use the macro in connection with read_line(), so they must include fileio.h. Let's not play libc games and require multiple header file to be included for the most common use of a function. The removal of def.h includes is not exact. I mostly went over the commits that switch over to use read_line() and add def.h at the same time and reverted the addition of def.h in those files.
* backlight: use log_device_*()Yu Watanabe2018-10-231-15/+17
|
* tree-wide: use streq() instead of streq_ptr()Yu Watanabe2018-09-231-2/+2
|
* tree-wide: replace ↵Yu Watanabe2018-09-101-6/+2
| | | | device_enumerator_scan_devices()+FOREACH_DEVICE_AND_SUBSYSTEM() by FOREACH_DEVICE()
* backlight: do not unref parent deviceYu Watanabe2018-09-071-5/+4
| | | | Fixes double-free introduced by 9aadd28149ae2d8ce9956495c961d97ba4033b0e.
* backlight: replace udev_device by sd_deviceYu Watanabe2018-08-231-150/+166
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering2018-04-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* backlight: use current brightness if no saved value to trigger clamping (#8526)Sebastian Reichel2018-03-281-5/+40
| | | | This reads current brightness value in case it has not yet been saved. This results in the brightness properly being clamped.
* backlight: minor modernizations (#8528)Lennart Poettering2018-03-231-16/+7
| | | Use strjoina() and STR_IN_SET()
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2016-10-231-2/+2
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* systemctl,networkctl,busctl,backlight: use STRPTR_IN_SETZbigniew Jędrzejewski-Szmek2016-09-241-1/+1
|
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tree-wide: check if errno is greater than zero (2)Zbigniew Jędrzejewski-Szmek2016-01-131-1/+1
| | | | | Compare errno with zero in a way that tells gcc that (if the condition is true) errno is positive.
* tree-wide: group include of libudev.h with sd-*Thomas Hindoe Paaboel Andersen2015-11-171-1/+2
|
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-2/+1
| | | | Sort the includes accoding to the new coding style.
* proc-cmdline: return proper errors from shall_restore_state()Lennart Poettering2015-11-021-1/+1
| | | | | Let's not eat up errors in shall_restore_state(), but in the consumers instead, just for the sake of keeping the library calls generic.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move /proc/cmdline parsing code to proc-cmdline.[ch]Lennart Poettering2015-10-271-1/+2
|
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-1/+3
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* util: split out escaping code into escape.[ch]Lennart Poettering2015-10-241-3/+4
| | | | This really deserves its own file, given how much code this is now.
* fileio: consolidate write_string_file*()Daniel Mack2015-07-061-1/+1
| | | | | | | Merge write_string_file(), write_string_file_no_create() and write_string_file_atomic() into write_string_file() and provide a flags mask that allows combinations of atomic writing, newline appending and automatic file creation. Change all users accordingly.
* backlight: let udev properties override clampingTopi Miettinen2015-02-021-1/+4
| | | | | | | | On my computer, the minimum brightness enforced by clamping in backlight is too bright. Let udev property ID_BACKLIGHT_CLAMP control whether the brightness is clamped or not.
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-1/+1
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-281-4/+2
| | | | | | | | | | | | Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* backlight: Avoid error when state restore is disabledMichael Biebl2014-09-111-1/+4
| | | | | | When the state restore is disabled, we would print: "Unknown verb: load" instead of simply skipping loading the state.
* backlight: Do not clamp brightness for LEDsDenis Tikhomirov2014-06-101-3/+10
| | | | | | | | | | | | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=77092 On Thu, Jun 05, 2014 at 08:37:20AM +0200, Lennart Poettering wrote: > The patch is line-broken, please send an uncorrupted patch! I am very sorry, I forgot that my client limits line width. I will use mutt now on. > clamp_brightness() clamps the brightness value to the range of the > actual device. This is a recent addition that was added to deal with > driver updates where the resolution is changed. I don't think this part > should be dropped for LED devices. The clamp_brightness() call hence > should be called unconditionally, however, internally it should use a > different min_brightness value if something is an !backlight devices... Thank you for explanation, this sounds very reasonable to me. Please, see updated patch:
* backlight: handle saved brightness exceeding max brightnessJani Nikula2014-05-071-3/+8
| | | | | | | | | | | | | | | | | | | If too high a brightness value has been saved (e.g. due to kernel mechanism changing from one kernel version to another, or booting the userspace on another system), the brightness update fails and the process exits. Clamp saved brightness between the policy minimum introduced in commit 7b909d7407965c03caaba30daae7aee113627a83 Author: Josh Triplett <josh@joshtriplett.org> Date: Tue Mar 11 21:16:33 2014 -0700 backlight: Avoid restoring brightness to an unreadably dim level and the absolute maximum. https://bugs.freedesktop.org/show_bug.cgi?id=78200
* backlight: warn if kernel exposes backlight device with bogus max_brightnessLennart Poettering2014-04-231-3/+7
| | | | We shouldn't silently tape over broken kernel drivers.
* backlight: unify error messagesZbigniew Jędrzejewski-Szmek2014-04-071-10/+19
|
* backlight: do nothing if max_brightness is 0Thomas Bächler2014-04-041-14/+30
| | | | | | | | | | | | On virtually any newer Asus mainboard, the eeepc-wmi driver is loaded. It exposes a backlight device despite the lack of any physical backlight devices. This fake backlight device has max_brightness set to 0. Since the introduction of the clamp_brightness function, systemd-backlight tries to write '1' to brightness and fails. This patch changes systemd-backlight to exit gracefully when max_brightness is 0 before performing any action. This affects both the load and save actions.
* backlight: Avoid restoring brightness to an unreadably dim levelJosh Triplett2014-03-121-0/+44
| | | | | | | Some systems turn the backlight all the way off at the lowest levels. Clamp saved brightness to at least 1 or 5% of max_brightness. This avoids preserving an unreadably dim screen, which would otherwise force the user to disable state restoration.
* backlight: Fix copy/paste error printing an unrelated error codeJosh Triplett2014-03-121-1/+1
| | | | | | udev_device_get_sysattr_value returns NULL on failure, but doesn't provide an error code; thus, when printing an error from it, don't print an unrelated error code from a previous call.
* make gcc shut upLennart Poettering2014-02-191-1/+1
| | | | | | | If -flto is used then gcc will generate a lot more warnings than before, among them a number of use-without-initialization warnings. Most of them without are false positives, but let's make them go away, because it doesn't really matter.
* doc: update punctuationJan Engelhardt2014-02-171-1/+1
| | | | Resolve spotted issues related to missing or extraneous commas, dashes.
* Remove duplicate includesKarel Zak2013-11-181-1/+0
|