Skip to content

Commit 8dc1ad0

Browse files
yuwatapoettering
authored andcommitted
backlight: add several debug logs and adjust log level of non critical error
This may help to investigate issues.
1 parent 1d370b2 commit 8dc1ad0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backlight/backlight.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ static int get_max_brightness(sd_device *device, unsigned *ret) {
252252
if (max_brightness <= 0)
253253
return log_device_warning_errno(device, SYNTHETIC_ERRNO(EINVAL), "Maximum brightness is 0, ignoring device.");
254254

255+
log_device_debug(device, "Maximum brightness is %u", max_brightness);
255256
*ret = max_brightness;
256257
return 0;
257258
}
@@ -348,6 +349,7 @@ static int read_brightness(sd_device *device, unsigned max_brightness, unsigned
348349
goto use_brightness;
349350
}
350351

352+
log_device_debug(device, "Current actual_brightness is %u", brightness);
351353
*ret_brightness = brightness;
352354
return 0;
353355
}
@@ -366,6 +368,7 @@ static int read_brightness(sd_device *device, unsigned max_brightness, unsigned
366368
"brightness=%u is larger than max_brightness=%u",
367369
brightness, max_brightness);
368370

371+
log_device_debug(device, "Current brightness is %u", brightness);
369372
*ret_brightness = brightness;
370373
return 0;
371374
}
@@ -456,10 +459,11 @@ static int run(int argc, char *argv[]) {
456459
if (r > 0) {
457460
r = safe_atou(value, &brightness);
458461
if (r < 0) {
459-
log_error_errno(r, "Failed to parse saved brightness '%s', removing %s.",
460-
value, saved);
462+
log_warning_errno(r, "Failed to parse saved brightness '%s', removing %s.",
463+
value, saved);
461464
(void) unlink(saved);
462465
} else {
466+
log_debug("Using saved brightness %u.", brightness);
463467
if (clamp)
464468
(void) clamp_brightness(device, true, max_brightness, &brightness);
465469

0 commit comments

Comments
 (0)