summaryrefslogtreecommitdiff
path: root/src/backlight/backlight.c
AgeCommit message (Collapse)Author
2015-02-02backlight: let udev properties override clampingTopi Miettinen
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.
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
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.
2014-11-28treewide: more log_*_errno() conversions, multiline callsMichal Schmidt
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.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
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().
2014-09-11backlight: Avoid error when state restore is disabledMichael Biebl
When the state restore is disabled, we would print: "Unknown verb: load" instead of simply skipping loading the state.
2014-06-10backlight: Do not clamp brightness for LEDsDenis Tikhomirov
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:
2014-05-07backlight: handle saved brightness exceeding max brightnessJani Nikula
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
2014-04-23backlight: warn if kernel exposes backlight device with bogus max_brightnessLennart Poettering
We shouldn't silently tape over broken kernel drivers.
2014-04-07backlight: unify error messagesZbigniew Jędrzejewski-Szmek
2014-04-04backlight: do nothing if max_brightness is 0Thomas Bächler
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.
2014-03-12backlight: Avoid restoring brightness to an unreadably dim levelJosh Triplett
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.
2014-03-12backlight: Fix copy/paste error printing an unrelated error codeJosh Triplett
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.
2014-02-19make gcc shut upLennart Poettering
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.
2014-02-17doc: update punctuationJan Engelhardt
Resolve spotted issues related to missing or extraneous commas, dashes.
2013-11-18Remove duplicate includesKarel Zak
2013-11-06util: unify reading of /proc/cmdlineLennart Poettering
Instead of individually checking for containers in each user do this once in a new call proc_cmdline() that read the file only if we are not in a container.
2013-10-19kerne-command-line: introduce option 'systemd.restore_state'Tom Gundersen
When set to 0 this will stop tools like the backlight and rfkill tools to restore state from previous boot. This is useful in case the stored state is bogus to the extent that it is preventing you from resetting it (e.g., the backlight settings cause the screen to be off on boot on a system where the backlight can not be adjusted directly from the keyboard).
2013-10-14backlight: include ID_PATH in file names for backlight settingsLennart Poettering
Much like for rfkill devices we should provide some stability regarding enumeration order, hence include the stable bits of the device path in the file name we store settings under.
2013-10-14backlight: always prefer "firmware"/"platform" backlights over "raw" ↵Lennart Poettering
backlights if we have both for the same device
2013-10-13Introduce udev object cleanup functionsZbigniew Jędrzejewski-Szmek
2013-10-11Add support for saving/restoring keyboard backlightsBastien Nocera
Piggy-backing on the display backlight code, this saves and restores keyboard backlights on supported devices. The detection code matches that of UPower: http://cgit.freedesktop.org/upower/tree/src/up-kbd-backlight.c#n173 https://bugs.freedesktop.org/show_bug.cgi?id=70367 [tomegun: also work for devices named "{smc,samsung,asus}::kbd_backlight"]
2013-09-17backlight,random-seed: move state files into /var/lib/systemdLennart Poettering
Let's not scatter (private) files in /var around, let's place them all in /var/lib/systemd and below.
2013-08-14backlight: instead of syspath use sysname for identifying backlight devicesLennart Poettering
This makes the description string of the backlight service a bit nicer.
2013-08-14backlight: add minimal tool to save/restore screen brightness across rebootsLennart Poettering
As many laptops don't save/restore screen brightness across reboots, let's do this in systemd with a minimal tool, that restores the brightness as early as possible, and saves it as late as possible. This will cover consoles and graphical logins, but graphical desktops should do their own per-user stuff probably. This only touches firmware brightness controls for now.