aboutsummaryrefslogtreecommitdiff
path: root/tw/system/lap.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tw/system/lap.scm')
-rw-r--r--tw/system/lap.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/tw/system/lap.scm b/tw/system/lap.scm
index 0ca52a26..ab8f1dca 100644
--- a/tw/system/lap.scm
+++ b/tw/system/lap.scm
@@ -378,10 +378,16 @@ support extra features (acr, pmu, gr).")
#~(begin
(use-modules ((ice-9 textual-ports) #:select (get-string-all))
((srfi srfi-26) #:select (cut)))
+ (define brightness-file "/sys/class/backlight/intel_backlight/brightness")
+ (define max-brightness-file "/sys/class/backlight/intel_backlight/max_brightness")
+ ;; These files don't exist right after startup, so wait for them to appear.
+ (while (not (and (file-exists? max-brightness-file)
+ (file-exists? brightness-file)))
+ (format (current-error-port) "Waiting for /sys files to appear...~%")
+ (sleep 1))
(define max-brightness
- (call-with-input-file "/sys/class/backlight/intel_backlight/max_brightness"
- get-string-all))
- (call-with-output-file "/sys/class/backlight/intel_backlight/brightness"
+ (call-with-input-file max-brightness-file get-string-all))
+ (call-with-output-file brightness-file
(cut display max-brightness <>))))))))))
(simple-service 'scanning-services shepherd-root-service-type