From owner-svn-src-head@freebsd.org Sat May 16 01:50:28 2020 Return-Path: Delivered-To: svn-src-head@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 BE4BC2DFD7F; Sat, 16 May 2020 01:50:28 +0000 (UTC) (envelope-from cperciva@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49P7X44RR8z3FLP; Sat, 16 May 2020 01:50:28 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F18860F9; Sat, 16 May 2020 01:50:28 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04G1oSBf069144; Sat, 16 May 2020 01:50:28 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04G1oS3J069143; Sat, 16 May 2020 01:50:28 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <202005160150.04G1oS3J069143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Sat, 16 May 2020 01:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361097 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 361097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2020 01:50:28 -0000 Author: cperciva Date: Sat May 16 01:50:28 2020 New Revision: 361097 URL: https://svnweb.freebsd.org/changeset/base/361097 Log: Send Lid status notification via devd from acpi_lid_status_update. Some laptops don't send ACPI "lid status changed" notifications upon opening the lid if the system was currently suspended. In r358219 this was partially fixed, updating the "lid_status" variable upon resume even if there is no "status changed" notification from ACPI. Unfortunately the fix in r358219 did not include notifying userland via devd; this causes problems on systems using upowerd (e.g. KDE), since upowerd remembers the most recent devd notification about the lid status rather than querying the sysctl to get the current status. This showed up as two symptoms when KDE's "When laptop lid closed: Sleep" option is set: 1. 50% of the time, closing the lid would not trigger S3 sleep. 2. 50% of the time, plugging/unplugging AC power would trigger S3 sleep. PR: 246477 MFC after: 3 days Modified: head/sys/dev/acpica/acpi_lid.c Modified: head/sys/dev/acpica/acpi_lid.c ============================================================================== --- head/sys/dev/acpica/acpi_lid.c Sat May 16 00:28:49 2020 (r361096) +++ head/sys/dev/acpica/acpi_lid.c Sat May 16 01:50:28 2020 (r361097) @@ -114,6 +114,9 @@ acpi_lid_status_update(struct acpi_lid_softc *sc) /* range check value */ sc->lid_status = lid_status ? 1 : 0; + /* Send notification via devd */ + acpi_UserNotify("Lid", sc->lid_handle, sc->lid_status); + #ifdef EVDEV_SUPPORT /* Notify evdev about lid status */ evdev_push_sw(sc->lid_evdev, SW_LID, lid_status ? 0 : 1);