From owner-freebsd-hackers@freebsd.org Sat Jan 4 15:17:57 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 552BE1D820E for ; Sat, 4 Jan 2020 15:17:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qll80lpLz4KXp for ; Sat, 4 Jan 2020 15:17:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x735.google.com with SMTP id r14so36110218qke.13 for ; Sat, 04 Jan 2020 07:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d8wZ4rSVWvOsDFGJCDbLWYXoWF53pEg2C2dpd20HQSw=; b=JNe/93sPO/R87rgVuYo9gdq0LJhhlJrH+zVFHGtJUXNfY3QbWkECkxZyaPO/XZ+/4O JZiVJCPpW9dbmai8xxL38plM/3DhFtLpOdXv961Odkw5t+NgNRxz3VluQ49ZYs1UKff/ 5qOK5qORQVNs4XFoAy9nDhoMEQbwopMbd6oCsUgegiwLFvJ02XrQNKqrSFceQ+qPpJL0 IhZ2bBMRtahHEPzcrNjvnwqb/XeuX/fGeUjQDmj6iBV8kAPxadjdNNMfYVMpLTH9f5Xr Qo4tvSWbtB8guPQ2UhQC5gU/dxBWJJ7EPgi8OKWRYZXefQpXPz8HBKX6RJoZPPfEcVAh q4wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d8wZ4rSVWvOsDFGJCDbLWYXoWF53pEg2C2dpd20HQSw=; b=fVTPu5BnLr9rtIciz/wekW8KZqyuCWpCH3INk7hz17rT1gHl0Pvw29X/9jBl6m7krL 3gLdCQDru3iPShiRfpRPUDPgmTqvY0At9W4ao2YoZZKp8/CgV34LLj7D2tNO+ZRiGNRa K79Hjup14j8GvKKEH/Tia4X+tCvhr+TZWavJlRX4pdyNFhuPivCsPkppn27ZxKbiRtvt x2a9G+X8BB4MOUTwh5dcCa+S/eewCZmAYx4uhVFBJ1cEpfhgOrAMlB2cRWxnyZumQhNE LbL9W9fnQX4/APr7DTD0EDrPhvKYBzfG4Y6QXyhB39eWk1PVeXRNSBwEK9rC/v1tmcPD rhLg== X-Gm-Message-State: APjAAAVXwIUy1mMksPRjViGQ7JQOMUxJ1OGzm9FvHjO7sZ0G7cYITRV9 FR5HBPWkFJR1eqvUUzpKW0gY8F0RmIJVFgP50ywBkA== X-Google-Smtp-Source: APXvYqy9YTW4BaISVq7zhERYlmaHmgistEcxMB4k+KINL1m6UKXENploungOuYYu+zdcnq9vg8OR1buM9GSVBVAGyAY= X-Received: by 2002:a37:4f8e:: with SMTP id d136mr75386039qkb.495.1578151074737; Sat, 04 Jan 2020 07:17:54 -0800 (PST) MIME-Version: 1.0 References: <20200104092112.17fea0fc@ernst.home> In-Reply-To: <20200104092112.17fea0fc@ernst.home> From: Warner Losh Date: Sat, 4 Jan 2020 09:17:42 -0600 Message-ID: Subject: Re: How do I completely disable suspend? To: Gary Jennejohn Cc: FreeBSD Hackers X-Rspamd-Queue-Id: 47qll80lpLz4KXp X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=JNe/93sP; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::735) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.67 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; IP_SCORE(-2.67)[ip: (-9.31), ipnet: 2607:f8b0::/32(-2.14), asn: 15169(-1.86), country: US(-0.05)]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[5.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; SUBJECT_ENDS_QUESTION(1.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2020 15:17:57 -0000 On Sat, Jan 4, 2020, 2:21 AM Gary Jennejohn wrote: > On Fri, 3 Jan 2020 19:46:09 -0700 > Warner Losh wrote: > > > On Wed, Jan 1, 2020 at 5:29 PM Ryan Stone wrote: > > > > > On Wed, Jan 1, 2020 at 5:01 PM Warner Losh wrote: > > > > > > > > > > > > > > > > On Wed, Jan 1, 2020, 1:46 PM Ryan Stone 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. Warner -- > Gary Jennejohn > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >