]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
backlight: add several debug logs and adjust log level of non critical error
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 23 Nov 2020 07:17:04 +0000 (16:17 +0900)
committerLennart Poettering <lennart@poettering.net>
Mon, 23 Nov 2020 13:35:14 +0000 (14:35 +0100)
This may help to investigate issues.

src/backlight/backlight.c

index 83b168532a4b8d28052548ef7f1640c2e9d6c1eb..d1b6a81e33904727d8ac396b8f8be5c2a8dcdb2e 100644 (file)
@@ -252,6 +252,7 @@ static int get_max_brightness(sd_device *device, unsigned *ret) {
         if (max_brightness <= 0)
                 return log_device_warning_errno(device, SYNTHETIC_ERRNO(EINVAL), "Maximum brightness is 0, ignoring device.");
 
+        log_device_debug(device, "Maximum brightness is %u", max_brightness);
         *ret = max_brightness;
         return 0;
 }
@@ -348,6 +349,7 @@ static int read_brightness(sd_device *device, unsigned max_brightness, unsigned
                         goto use_brightness;
                 }
 
+                log_device_debug(device, "Current actual_brightness is %u", brightness);
                 *ret_brightness = brightness;
                 return 0;
         }
@@ -366,6 +368,7 @@ use_brightness:
                                               "brightness=%u is larger than max_brightness=%u",
                                               brightness, max_brightness);
 
+        log_device_debug(device, "Current brightness is %u", brightness);
         *ret_brightness = brightness;
         return 0;
 }
@@ -456,10 +459,11 @@ static int run(int argc, char *argv[]) {
                 if (r > 0) {
                         r = safe_atou(value, &brightness);
                         if (r < 0) {
-                                log_error_errno(r, "Failed to parse saved brightness '%s', removing %s.",
-                                                value, saved);
+                                log_warning_errno(r, "Failed to parse saved brightness '%s', removing %s.",
+                                                  value, saved);
                                 (void) unlink(saved);
                         } else {
+                                log_debug("Using saved brightness %u.", brightness);
                                 if (clamp)
                                         (void) clamp_brightness(device, true, max_brightness, &brightness);