How do I completely disable suspend?

Warner Losh imp at bsdimp.com
Wed Jan 1 22:01:25 UTC 2020


On Wed, Jan 1, 2020, 1:46 PM Ryan Stone <rysto32 at gmail.com> wrote:

> I have a laptop on which suspend/resume doesn't work.  I don't need
> suspend/resume and don't want to spend the time debugging it.
> However, there are some really annoying cases that can trigger a
> suspend, and I find up having to power off the laptop to get it to
> boot properly again.  How can I completely disable suspend?  Playing
> with the sysctls under hw.acpi doesn't seem to actually do anything.
>

You want to make the switch action do nothing.  I do this so that I have a
custom devd action that sleeps for 60 seconds and then suspends if the lid
is still closed. I often close my lid and then go 'oh, crap I forgot to...'
and I want some time to recover from that mistake that doesn't force a
suspend/resume.

hw.acpi.lid_switch_state: NONE

and

notify 10 {
        match   "system"        "ACPI";
        match   "subsystem"     "Lid";
        action "/usr/local/bin/imp-lid $notify";
};

in devd.conf for me.

And while Ryan won't need it, here's imp-lid:

#!/bin/sh
lid-wait() {
    logger "Waiting a minute to suspend"
    sleep 60
    case $(sysctl -n dev.acpi_lid.0.state) in
        0) logger "suspending"; zzz ;;
        *) logger "never mind";;
    esac
}

case $1 in
    0x00)       # lid closed
        lid-wait &
        ;;
    0x01) ;;    # Ignore opening
esac
exit 0


Warner


_______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>


More information about the freebsd-hackers mailing list