Date: Sat, 4 Jan 2020 16:48:17 +0100 From: Gary Jennejohn <gljennjohn@gmail.com> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: How do I completely disable suspend? Message-ID: <20200104164817.2dd4dd0d@ernst.home> In-Reply-To: <CANCZdfquiuLLXJA2syjhYC=q7muExQMk1TJsendda6DRZVrMpQ@mail.gmail.com> References: <CAFMmRNxEhqmERAL9qPUxFPkxvBOMu8e%2BxoKnNgx38WPYy3GjDg@mail.gmail.com> <CANCZdfrYy-K1TCvCYCEQiAwqzUJiCf7B9y=3jPqQT-OWdTchSg@mail.gmail.com> <CAFMmRNwXGqiV9fcw3gBeDkpfh8wPRaN0ZLN5Np7RKrqgna4QUg@mail.gmail.com> <CANCZdfr3M9tkB5i3zA6PV64oYyKUpVQz4H=AwBkHjbWmTd%2BkCQ@mail.gmail.com> <20200104092112.17fea0fc@ernst.home> <CANCZdfquiuLLXJA2syjhYC=q7muExQMk1TJsendda6DRZVrMpQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 4 Jan 2020 09:17:42 -0600 Warner Losh <imp@bsdimp.com> wrote: > On Sat, Jan 4, 2020, 2:21 AM Gary Jennejohn <gljennjohn@gmail.com> wrote: > > > On Fri, 3 Jan 2020 19:46:09 -0700 > > Warner Losh <imp@bsdimp.com> wrote: > > > > > On Wed, Jan 1, 2020 at 5:29 PM Ryan Stone <rysto32@gmail.com> wrote: > > > > > > > On Wed, Jan 1, 2020 at 5:01 PM Warner Losh <imp@bsdimp.com> wrote: > > > > > > > > > > > > > > > > > > > > On Wed, Jan 1, 2020, 1:46 PM Ryan Stone <rysto32@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 > > > > > > > > Thanks, but in my case, the biggest issue isn't closing the lid but > > > > some magic extra function button on the keyboard that something has > > > > decided should trigger a suspend. > > > > > > > > > > Oh, in that case you can use kbdcontrol to remap those keys. > > > > > > kbdcontrol -d dumps the keys and you are looking for > > > 104 slock saver slock saver susp nop susp nop O > > > 'susp' is the bit that does keyboard suspend just make them all nop. -l > > > file I think loads the file, but the man page has all the details. > > > > > > > Note that kbdcontrol -d only appears to work in a console. I tried to > > run it under Xorg and got errors, probably because Xorg had grabbed the > > keyboard. In VT1 it worked. This problem is sort of addressed in the > > man page, which I of course didn't read until later. > > > > Yea. This sort of thing needs to be done before you start X. > Actually, I simply switched to VT1 from X. The console then grabbed the keyboard and everything worked. I then switched to VT9 and was back in X. -- Gary Jennejohn
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200104164817.2dd4dd0d>