summaryrefslogtreecommitdiffstats
path: root/src/backlight (follow)
Commit message (Collapse)AuthorAgeFilesLines
* backlight: fix detection of multiple graphic cardsYu Watanabe2024-04-041-0/+4
| | | | | | | | | Follow-up for e0504dd011189d97a1ea813aabfe1e696742bcf5. Hopefully, devices in PCI subsystem have some properties, thus have their udev database file. But, that may not be true. Here, we only read sysattrs of enumerated devices, hence it is not necessary to check if the device is initialized or not.
* udev,backlight,kernel-install: reword sentences starting with "Skipping to"Zbigniew Jędrzejewski-Szmek2024-03-071-3/+3
| | | | | | | That's not gramatically correct. In backlight, change "assocation" to "deduplication". Without the context, it's probably not clear at all that we "associate" them to ignore them.
* backlight: supprt ID_LEDS_CLAMP udev property for leds subsystem devicesYu Watanabe2024-01-031-13/+21
| | | | Closes #30507.
* Merge pull request #30591 from yuwata/device-utilLuca Boccassi2024-01-011-54/+26
|\ | | | | device-util: introduce device_in_subsystem() and device_is_devtype() helper functions
| * tree-wide: use device_in_subsystem() and device_is_devtype()Yu Watanabe2023-12-221-54/+26
| |
* | backlight: split out verb_load() and verb_save(), then use dispatch_verb()Yu Watanabe2023-12-221-57/+75
| | | | | | | | No functional change, just refactoring.
* | backlight: use WRITE_STRING_FILE_MKDIR_0755 flag on saveYu Watanabe2023-12-221-6/+1
| | | | | | | | No functional change, just refactoring.
* | backlight: split out read_saved_brightness()Yu Watanabe2023-12-221-26/+40
| | | | | | | | No functional change, just refactoring.
* | backlight: split out device_new_from_arg()Yu Watanabe2023-12-221-23/+43
| | | | | | | | | | | | | | While at it, this replaces strndupa_safe() with strndup(), as the input is a user-controlled string. No functional change, just refactoring.
* | backlight: split out build_save_file_path()Yu Watanabe2023-12-221-18/+44
| | | | | | | | No functional change, just refactoring.
* | backlight: move validity check of max_brightness to get_max_brightness()Yu Watanabe2023-12-221-14/+18
|/ | | | | Also rename get_max_brightness() -> read_max_brightness() for consistency with read_brightness().
* backlight: support to specify percentage of minimum brightnessYu Watanabe2023-10-061-7/+25
| | | | Closes #29328.
* reboot-util: cache the result of shall_restore_stateMike Yuan2023-08-131-1/+1
|
* meson: move declarations of backlight, rfkill, and sysupdate-generatorYu Watanabe2023-07-311-0/+9
|
* device-util: Declare iterator variables inlineDaan De Meyer2023-07-121-2/+1
|
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* backlight: fix issue on multiple graphics cards systemYu Watanabe2022-08-171-1/+61
| | | | | | | | | | | | | | | | If a system has multiple graphics cards, then we cannot associate platform backlight devices to backlight devices under PCI bus. Previously, in such case, vaidate_device() for a raw backlight device might erroneously detect a platform device and return false. So, users could not save/load backlight level. This makes validate_device() give up to associate platform devices on non-PCI bus with raw backlight devices. That may cause unwanted backlight level save or restore by systemd-backlight@.service, but users can workaround that by masking specific instances of the service. Closes #24223.
* backlight: filter out unnecessary backlight devices by device enumeratorYu Watanabe2022-08-171-7/+12
|
* backlight: add/update several logs for validating backlight devicesYu Watanabe2022-08-171-27/+46
|
* backlight: accept embedded display port named e.g. card0-eDP-1Yu Watanabe2022-08-091-1/+1
|
* tree-wide: unify some code that looks for --help in the command lineLennart Poettering2022-03-311-2/+3
|
* backlight: ignore error if the backlight device is already removedYu Watanabe2022-01-051-2/+10
| | | | Fixes #21997.
* alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhereLennart Poettering2021-10-141-1/+1
| | | | | | | | | | | | | Let's define two helpers strdupa_safe() + strndupa_safe() which do the same as their non-safe counterparts, except that they abort if called with allocations larger than ALLOCA_MAX. This should ensure that all our alloca() based allocations are subject to this limit. afaics glibc offers three alloca() based APIs: alloca() itself, strndupa() + strdupa(). With this we have now replacements for all of them, that take the limit into account.
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* backlight: refactor get_max_brightness() to appease gccZbigniew Jędrzejewski-Szmek2021-04-011-10/+11
| | | | | | | The old code was just fine, but gcc doesn't understand that max_brightness is initialized. Let's rework it a bit to move some logic to the main function. Now get_max_brightness() just retrieves and parses the attribute, and the main function decides what to do with it.
* backlight: reindent commentsYu Watanabe2021-02-221-32/+22
|
* backlight: reduce indentation a bitYu Watanabe2021-02-221-4/+2
|
* backlight: same_device() may return negative errnoYu Watanabe2021-02-221-1/+1
|
* backlight: exit earlier when unknown verb is specifiedYu Watanabe2021-02-221-1/+4
|
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-01-311-1/+1
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-6/+6
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* backlight: add several debug logs and adjust log level of non critical errorYu Watanabe2020-11-231-2/+6
| | | | This may help to investigate issues.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* various: remove assignments of unread variablesZbigniew Jędrzejewski-Szmek2020-09-221-1/+1
|
* backlight: validate read sysattr valueYu Watanabe2020-09-111-51/+76
| | | | | | | | | | If actual_brightness is larger than max_brightness, then fall back to use brightness attribute. Also, if the saved value is invalid, then this makes remove the file in /var/lib/systemd/backlight. Hopefully fixes #17011.
* backlight: do not claim that ID_BACKLIGHT_CLAMP= property is not setYu Watanabe2020-09-111-1/+2
|
* Add simple usage message to systemd-backlight (#16709)Plan C2020-08-281-0/+28
|
* backlight: read current backlight brightness from 'actual_brightness' attributeYu Watanabe2020-06-301-4/+32
| | | | Closes #16302.
* backlight: call log_setup_service() before loggingYu Watanabe2020-06-301-2/+2
|
* backlight: use SYNTHETIC_ERRNO() macroYu Watanabe2020-06-301-20/+10
|
* 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
|