From owner-freebsd-hackers@freebsd.org Sat Jan 4 02:46:23 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 1DC631DD329 for ; Sat, 4 Jan 2020 02:46:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (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 47qR3x5ncNz4g6Y for ; Sat, 4 Jan 2020 02:46:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82c.google.com with SMTP id d18so35549462qtj.10 for ; Fri, 03 Jan 2020 18:46:21 -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=SsOynxgT8RY8f4aGNfyMAWLG5y78QIGVtxLrVySNFFo=; b=pHleERa3tUIccDPCiGkVY6Ka3NXYKuKekN8U5TNa/H6AO9odQJDhTbVCA1Hjd22PFo 39UrwALaWQlVyIsd+5IPIKheboheAub+d7a57lzkEDD3LrpsM9ixr8LCxDGdJ4BMU1Gr eUZQBntlo7YyE/dx+6nHWMcwMBy29zfZvkAz1r9l13idPd5Dtd5JJlv8negq64coj5qR pW8icvTxnu8RH6O1t7zgVhC2SoR8RFK7cpOe/aM7Suhpx+7ytXTbSEW7ISVuiDjZnA46 SeWcHgieI5bDsCwsAj2k2gz1wk2pTWeh9U8H9YCNKmhKg9usVooMUUpNvSJGbNx/EDXA FdQQ== 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=SsOynxgT8RY8f4aGNfyMAWLG5y78QIGVtxLrVySNFFo=; b=e6PGbsjk8EtrEin65kmznQebOEpk0DzD+MYTZ5qGvef3GiWm8/KNYfpUlgqsDinP0u 8AmvgVl7KNoneZNF0mCn/N3VGoq/DL6bQnhvmAqKvHwLp3vB2GLBa8+5C9Gp+vMYVx1F h0wa6Ncdqz2x61m61psph5Wk16sEMi56Vs3o1lc2nN+udztB4KUK1x4APEaRoaMnxIfK OlsjqtNsVxJn3LYkX/9yReVhks1SnR6spGiOEoQxyeLK9Z2iLM3SCXrIiok8HoqHn0xi eeMOolOngffTdrpvhl7XAgM9WV+Kj5rOLaKjUT4SEWtlK2z5tKTQkcj1lVwPDnAqKmC/ nLfw== X-Gm-Message-State: APjAAAXxe0NRo+aXrVvXbr87uiP6Xs6WjZxbJHFDkB3LD9YW/rjx8Qp4 fxHFyuU/mNo4UxfYHHDvKa5+i8Vwq+Xmgqxhw5hVjw== X-Google-Smtp-Source: APXvYqygJN2k1ue35rfvZPARjR8LXJ5CK7Z9qUBQZ22K1SEtivqYGzwTNMPjwTsSoXWYZlVNsnhoftFkj4C8S7bnwuI= X-Received: by 2002:aed:3b79:: with SMTP id q54mr56374185qte.187.1578105980579; Fri, 03 Jan 2020 18:46:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Fri, 3 Jan 2020 19:46:09 -0700 Message-ID: Subject: Re: How do I completely disable suspend? To: Ryan Stone Cc: FreeBSD Hackers X-Rspamd-Queue-Id: 47qR3x5ncNz4g6Y X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=pHleERa3; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::82c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.65 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; IP_SCORE(-2.65)[ip: (-9.22), 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]; 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)[c.2.8.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 02:46:23 -0000 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. Warner