From owner-freebsd-hackers@freebsd.org Sat Jan 4 08:21:17 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 933A21F3BD7 for ; Sat, 4 Jan 2020 08:21:17 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (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 47qZVN4wY0z3RLt for ; Sat, 4 Jan 2020 08:21:16 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wm1-x344.google.com with SMTP id p9so10193013wmc.2 for ; Sat, 04 Jan 2020 00:21:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=iIm3y8MHxA45ADWbvQXZukromioHM226/j3T9t/bRbw=; b=DvG3kydpDGx2piNfdr81MvuRaf0uFiyWaPBqWxXdpu/+rvdcnmD1HvBzG51CaDTDSn +NLIoGi31WGTozDqIedFZKftbCosuRE+gCfcEIa1ASwTm/qG5B0zUes4DIwjlebd17Xa rKjT3zQMwL+RP6pSIPFkj2QV3byxkeg7Ha8qN1YdB8s3LmjET0MXbwu72z1xafa3XXCw fJ0+i6MWN0gTpfGrI6P1iC817HxJ1gf7t4Jw7bWc8L7e5s6CFijnn38ljgNYHPFakvB/ TBGTS+yae+/PCtstxCKwoKEk6aJb05Etmtnw2AYlADqkI7uRVPbB1eSPtA8etCembC3t 2Img== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=iIm3y8MHxA45ADWbvQXZukromioHM226/j3T9t/bRbw=; b=ce3hPdXy5WTegx512/kFwsOYG6Jct6mcW8+5cvdcOWmNfsgvIwnzaje2fHb9zFwAc5 b1JEm0L1xHBqLJ/OidBMyOEV+bKN3byhaFoQafzuSyJljguy1EDVbmFebVyvyzh5x4+N 5pHQkVJFI3/FvtIonUAvFpjLHGpLOSou5m0n0HpmID70cnGI7h9KCjx+SrbFjP77TXXH uXZNcogcq6G4Kng1Vy3Tntlg8gS44okOhzPc768CG8IMurAndIfZTLgFOyedVf8zJxtD vc0vCOQBqSL+v7YfEU+wgSqPqw5xWuuiHYr6++sVCbsSKi/BpwbcRsiQZ0ZYdOw0nj8p NGLQ== X-Gm-Message-State: APjAAAVfVBx14HkBUbG/Nd54Ae3ROaork7J10+6fRNGzq0sN2fGT4j94 z242CEUbhCtknC9RnZDYkc214BT2 X-Google-Smtp-Source: APXvYqy/8wbOW0NCbDUwxb8Vx3W6gBhk40cL2ZMz0vdWEDV06C3cdKRWJNjjLBYZqC4qp9D0Bcq87A== X-Received: by 2002:a7b:cf21:: with SMTP id m1mr23296739wmg.170.1578126074888; Sat, 04 Jan 2020 00:21:14 -0800 (PST) Received: from ernst.home (p5B3BEAC3.dip0.t-ipconnect.de. [91.59.234.195]) by smtp.gmail.com with ESMTPSA id y139sm15879594wmd.24.2020.01.04.00.21.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2020 00:21:14 -0800 (PST) Date: Sat, 4 Jan 2020 09:21:12 +0100 From: Gary Jennejohn To: FreeBSD Hackers Subject: Re: How do I completely disable suspend? Message-ID: <20200104092112.17fea0fc@ernst.home> In-Reply-To: References: Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47qZVN4wY0z3RLt X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=DvG3kydp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of gljennjohn@gmail.com designates 2a00:1450:4864:20::344 as permitted sender) smtp.mailfrom=gljennjohn@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[gljennjohn@gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RECEIVED_SPAMHAUS_PBL(0.00)[195.234.59.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; FREEMAIL_REPLYTO(0.00)[gmail.com]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(0.00)[ip: (2.44), ipnet: 2a00:1450::/32(-2.63), asn: 15169(-1.86), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[4.4.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] 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 08:21:17 -0000 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. -- Gary Jennejohn