Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 May 2020 01:50:28 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361097 - head/sys/dev/acpica
Message-ID:  <202005160150.04G1oS3J069143@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005160150.04G1oS3J069143>