From owner-dev-commits-doc-all@freebsd.org Thu Apr 22 07:28:38 2021 Return-Path: Delivered-To: dev-commits-doc-all@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 C321A5E21B7 for ; Thu, 22 Apr 2021 07:28:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQptt59fkz3FGN; Thu, 22 Apr 2021 07:28:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4B1A15769; Thu, 22 Apr 2021 07:28:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13M7Sco0094128; Thu, 22 Apr 2021 07:28:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13M7SctH094127; Thu, 22 Apr 2021 07:28:38 GMT (envelope-from git) Date: Thu, 22 Apr 2021 07:28:38 GMT Message-Id: <202104220728.13M7SctH094127@gitrepo.freebsd.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: =?utf-8?B?RmVybmFuZG8gQXBlc3RlZ3XDrWE=?= Subject: git: 5e5b9e25d7 - main - [handbook] Show how to configure sleep on lid closure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e5b9e25d72bb4001933071b41aeaedf932384e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-doc-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the doc repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 07:28:38 -0000 The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/doc/commit/?id=5e5b9e25d72bb4001933071b41aeaedf932384e9 commit 5e5b9e25d72bb4001933071b41aeaedf932384e9 Author: Fernando Apesteguía AuthorDate: 2021-04-22 07:20:14 +0000 Commit: Fernando Apesteguía CommitDate: 2021-04-22 07:23:42 +0000 [handbook] Show how to configure sleep on lid closure Add information about how to make FreeBSD sleep and resume when the lid state switches. Approved By: 0mp (mentor) Differential Revision: https://reviews.freebsd.org/D29897 --- .../content/en/books/handbook/config/_index.adoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/documentation/content/en/books/handbook/config/_index.adoc b/documentation/content/en/books/handbook/config/_index.adoc index 23640b3584..4b39749713 100644 --- a/documentation/content/en/books/handbook/config/_index.adoc +++ b/documentation/content/en/books/handbook/config/_index.adoc @@ -1406,6 +1406,21 @@ A common problem with suspend/resume is that many device drivers do not save, re This test emulates the suspend/resume cycle of all device drivers without actually going into `S3` state. In some cases, problems such as losing firmware state, device watchdog time out, and retrying forever, can be captured with this method. Note that the system will not really enter `S3` state, which means devices may not lose power, and many will work fine even if suspend/resume methods are totally missing, unlike real `S3` state. +If the previous test worked, on a laptop it is possible to configure the system +to suspend into `S3` on lid close and resume when it is open back again: + +[source,shell] +.... +# sysctl hw.acpi.lid_switch_state=S3 +.... + +This change can be made persistent across reboots: + +[source,shell] +.... +# echo ‘hw.acpi.lid_switch_state=S3’ >> /etc/sysctl.conf +.... + Harder cases require additional hardware, such as a serial port and cable for debugging through a serial console, a Firewire port and cable for using man:dcons[4], and kernel debugging skills. To help isolate the problem, unload as many drivers as possible. If it works, narrow down which driver is the problem by loading drivers until it fails again. Typically, binary drivers like [.filename]#nvidia.ko#, display drivers, and USB will have the most problems while Ethernet interfaces usually work fine. If drivers can be properly loaded and unloaded, automate this by putting the appropriate commands in [.filename]#/etc/rc.suspend# and [.filename]#/etc/rc.resume#. Try setting `hw.acpi.reset_video` to `1` if the display is messed up after resume. Try setting longer or shorter values for `hw.acpi.sleep_delay` to see if that helps.