guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] refactoring extra-special-file; an /etc/tmpfiles/ equivalent


From: Attila Lendvai
Subject: Re: [RFC] refactoring extra-special-file; an /etc/tmpfiles/ equivalent
Date: Fri, 10 Feb 2023 12:05:37 +0000

> i want to write a string into a file at boot to disable wake-up by
> my keyboard (so that it doesn't immediately wake up my laptop after
> i suspend it). it requires doing this once per boot:
>
> echo XHC >/proc/acpi/wakeup
> 
> the standard solution on systemd distros is to use a
> /etc/tmpfiles.d/disable-usb-wake.conf file, which systemd interprets
> (see e.g. https://forums.linuxmint.com/viewtopic.php?f=42&t=312953).

FTR, the "guixy way" currently is to add a service like this:

(simple-service 'disable-keyboard-wakeup activation-service-type
  #~(begin
      (use-modules (ice-9 regex))
      (use-modules (ice-9 textual-ports))
      (when (string-match "XHC\t  S3\t\\*enabled"
                          (call-with-input-file "/proc/acpi/wakeup"
                            get-string-all))
        (display "Turning off usb wakeup\n")
        (with-output-to-file "/proc/acpi/wakeup"
          (lambda _
            (display "XHC"))))))

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
Censorship is telling a man he can't have a steak just because a baby can't 
chew it.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]