From owner-freebsd-hackers@freebsd.org Sat Jan 4 15:48:22 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 353631DB4E2 for ; Sat, 4 Jan 2020 15:48:22 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (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 47qmQF1FJdz4M18 for ; Sat, 4 Jan 2020 15:48:20 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wr1-x443.google.com with SMTP id j42so45036975wrj.12 for ; Sat, 04 Jan 2020 07:48:20 -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=ZJQAq60Zop8r9VouEzl6Of7h9mu40tvzwMzSTekl+DQ=; b=FxIPPNeRGqo8IJw1xoEbqK2GidNyjjXtYAHmpHbMZY6vPYhmvbgz2AHqL8Ei5Dq0FV uXYRD3HNt+SelyRcziJI9xobnMElKzhjrMtmTmAo8+gcGdVxA/iH2REz68fkhL/q22// 5fC8/9Gm/Jg9vZiPvwCumkPVSCQRdEqm1A3caOhnhqTq6Vye9ddLzbLEvSUhhF+2Tmh+ rInGrRQZkrDfvl37sLZfGy9XKhuAGIbJiGWEdd2nIe4amcSNrM7kW82y8cr+xNeyGh8z JC21d5b9CMaMJcHVTqGhJBba/n8ScN/y+vx9w4NmlcL2uARtLFKU0z6IQIa+8cGORGFa 0yag== 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=ZJQAq60Zop8r9VouEzl6Of7h9mu40tvzwMzSTekl+DQ=; b=oADaTc/OeguBiFu+BjluNPYftIp4xTXCpdcU0eI1P5Jhq5PTDNyOBU6PE2iTLFrNDT HXckKj7P2rMZai/CFO99i3y38Mm+1xuooAcYVgI94G5VtRKmH9epz9g8/xtMXa2DGmE+ uvKn7knxmg4BQhWWRgLivoVuTOUwZ404VObThVoW4rYHCUa+MrA2r1WP+Hsuy71pOpP5 NJmyH0MpR0VIkDmxcjxOSGlO/HbAuMhiCGIAHsCXLCzoigI8bDKPSRBveGJ+ycaob+WR ZS/Vshv9WOz/UPpO4W5N8XmfurghaFYsG93qsktN6W2NlTWnPyxNw8XUN9LFSZgvZ9xX w5yw== X-Gm-Message-State: APjAAAWaLvG0T0Vl7huyVeHV6Ww5yXgS63wwROreNIhCuLbRQ3D2DJcw 6w/1ErVD0DLdVN8JC0SVwdCEaBaU X-Google-Smtp-Source: APXvYqxUwqHUdjpqxkwGqsOru6yEuFsduB/0HS7Av3h3GOHGDfXQnVf3LVE0dFVDJmAHPmPrLSNwJQ== X-Received: by 2002:adf:f8c8:: with SMTP id f8mr91032183wrq.331.1578152899298; Sat, 04 Jan 2020 07:48:19 -0800 (PST) Received: from ernst.home (p5B3BEAC3.dip0.t-ipconnect.de. [91.59.234.195]) by smtp.gmail.com with ESMTPSA id x10sm62090081wrv.60.2020.01.04.07.48.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2020 07:48:18 -0800 (PST) Date: Sat, 4 Jan 2020 16:48:17 +0100 From: Gary Jennejohn To: FreeBSD Hackers Subject: Re: How do I completely disable suspend? Message-ID: <20200104164817.2dd4dd0d@ernst.home> In-Reply-To: References: <20200104092112.17fea0fc@ernst.home> 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: 47qmQF1FJdz4M18 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=FxIPPNeR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of gljennjohn@gmail.com designates 2a00:1450:4864:20::443 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]; 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)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MIME_TRACE(0.00)[0:+]; 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.23), ipnet: 2a00:1450::/32(-2.62), asn: 15169(-1.86), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[3.4.4.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 15:48:22 -0000 On Sat, 4 Jan 2020 09:17:42 -0600 Warner Losh wrote: > 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. > 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