On 01/17/15 11:38, David Herrmann wrote: > Hi > > On Sat, Jan 17, 2015 at 12:28 PM, Topi Miettinen <[email protected]> wrote: >> On my computer, the minimum brightness enforced by clamping in >> backlight is too bright. > > How can 5% of the backlight be "too bright"? Can you give some > information on your backlight device? (type, max_brightness, > actual_brightness and so on).
Well, my eyes start to hurt with level 1, 0 is OK. Max_brightness is 9, actual_brightness always matches brightness. This is cheap old Acer Aspire 8530 laptop with Mobility Radeon HD 3200, I don't know beyond that what handles backlight. > > Btw., we use gnu-getopt_long() style arguments with two dashes. And we > try to avoid negations in option names. Ok. How about --disable-clamping or --allow-low-brightness, or would you have better ideas? > > Thanks > David > >> Add a new option to override clamping in unit file. While at it, describe >> the clamping in documentation. >> --- >> man/[email protected] | 23 +++++++++++++++++++++-- >> src/backlight/backlight.c | 11 ++++++----- >> 2 files changed, 27 insertions(+), 7 deletions(-) >> >> diff --git a/man/[email protected] >> b/man/[email protected] >> index 453afbf..26a2437 100644 >> --- a/man/[email protected] >> +++ b/man/[email protected] >> @@ -48,7 +48,17 @@ >> >> <refsynopsisdiv> >> <para><filename>[email protected]</filename></para> >> - >> <para><filename>/usr/lib/systemd/systemd-backlight</filename></para> >> + <cmdsynopsis> >> + <command>systemd-backlight</command> >> + <arg choice="plain">save</arg> >> + <arg >> choice="opt"><replaceable>PATH</replaceable></arg> >> + </cmdsynopsis> >> + <cmdsynopsis> >> + <command>systemd-backlight</command> >> + <arg choice="plain">load</arg> >> + <arg >> choice="opt"><replaceable>PATH</replaceable></arg> >> + <arg >> choice="opt"><replaceable>-no-clamp</replaceable></arg> >> + </cmdsynopsis> >> </refsynopsisdiv> >> >> <refsect1> >> @@ -58,7 +68,16 @@ >> is a service that restores the display backlight >> brightness at early boot and saves it at shutdown. On >> disk, the backlight brightness is stored in >> - <filename>/var/lib/systemd/backlight/</filename>.</para> >> + <filename>/var/lib/systemd/backlight/</filename>. During >> + loading, unless option >> + <replaceable>-no-clamp</replaceable> is specified, the >> + brightness is clamped to at least value >> + <literal>1</literal> or 5% of maximum >> + brightness.</para> >> + >> + <para><replaceable>PATH</replaceable> identifies the >> + display brightness control device. It is resolved by >> + udev.</para> >> </refsect1> >> >> <refsect1> >> diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c >> index 1271a66..a3f71e9 100644 >> --- a/src/backlight/backlight.c >> +++ b/src/backlight/backlight.c >> @@ -255,7 +255,7 @@ static void clamp_brightness(struct udev_device *device, >> char **value, unsigned >> return; >> } >> >> - log_info("Saved brightness %s %s to %s.", old_value, >> + log_info("Saved brightness %s %s to %s (use -no-clamp to >> override).", old_value, >> new_brightness > brightness ? >> "too low; increasing" : "too high; decreasing", >> *value); >> @@ -272,8 +272,8 @@ int main(int argc, char *argv[]) { >> unsigned max_brightness; >> int r; >> >> - if (argc != 3) { >> - log_error("This program requires two arguments."); >> + if (argc < 3 || argc > 4) { >> + log_error("This program requires two or three arguments."); >> return EXIT_FAILURE; >> } >> >> @@ -389,8 +389,9 @@ int main(int argc, char *argv[]) { >> log_error_errno(r, "Failed to read %s: %m", saved); >> return EXIT_FAILURE; >> } >> - >> - clamp_brightness(device, &value, max_brightness); >> + /* Don't clamp brightness if asked */ >> + if (!(argc == 4 && streq(argv[3], "-no-clamp"))) >> + clamp_brightness(device, &value, max_brightness); >> >> r = udev_device_set_sysattr_value(device, "brightness", >> value); >> if (r < 0) { >> -- >> 2.1.4 >> >> _______________________________________________ >> systemd-devel mailing list >> [email protected] >> http://lists.freedesktop.org/mailman/listinfo/systemd-devel _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
