Age | Commit message (Collapse) | Author |
|
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.
|
|
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.
|
|
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.
|
|
It corrrectly handles both positive and negative errno values.
|
|
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().
|
|
When the state restore is disabled, we would print:
"Unknown verb: load" instead of simply skipping loading the
state.
|
|
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:
|
|
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
|
|
We shouldn't silently tape over broken kernel drivers.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Resolve spotted issues related to missing or extraneous commas, dashes.
|
|
|
|
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.
|
|
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).
|
|
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.
|
|
backlights if we have both for the same device
|
|
|
|
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"]
|
|
Let's not scatter (private) files in /var around, let's place them all
in /var/lib/systemd and below.
|
|
This makes the description string of the backlight service a bit nicer.
|
|
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.
|