Bug 175531 - [patch] sysutils/upower: correctly detect lid
Summary: [patch] sysutils/upower: correctly detect lid
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alberto Villa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-23 13:50 UTC by Alberto Villa
Modified: 2018-10-05 06:02 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (959 bytes, patch)
2013-01-23 13:50 UTC, Alberto Villa
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Villa freebsd_committer freebsd_triage 2013-01-23 13:50:00 UTC
UPower sets property LidIsPresent to true only if hw.acpi.lid_switch_state is different from "NONE", being "NONE" the default value for FreeBSD. Thus, the property is always false on default configurations.

Fix: Force UPower not to care about the value of the sysctl, making it check only for its existence.

Patch attached with submission follows:
How-To-Repeat: If hw.acpi.lid_switch_state is "NONE", `upower -d | grep lid-is-present` will show that the property is disabled. In the KDE Workspaces, this blocks any reaction on lid closing.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-01-23 13:50:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gnome

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Alberto Villa freebsd_committer freebsd_triage 2013-02-09 17:49:47 UTC
Responsible Changed
From-To: gnome->avilla

Assigning to myself after maintainer timeout.
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-02-09 17:54:00 UTC
Author: avilla
Date: Sat Feb  9 17:53:53 2013
New Revision: 311989
URL: http://svnweb.freebsd.org/changeset/ports/311989

Log:
  - Correctly detect laptop lid.
  - Bump PORTREVISION.
  
  Among other things, this commit lets KDE Workspaces react on lid
  closing (e.g., sleep/lock on lid closing).
  
  PR:		175531
  Submitted by:	avilla (myself)
  Approved by:	gnome (maintainer timeout)

Added:
  head/sysutils/upower/files/
  head/sysutils/upower/files/patch-src__freebsd__up-backend.c   (contents, props changed)
Modified:
  head/sysutils/upower/Makefile   (contents, props changed)

Modified: head/sysutils/upower/Makefile
==============================================================================
--- head/sysutils/upower/Makefile	Sat Feb  9 17:17:54 2013	(r311988)
+++ head/sysutils/upower/Makefile	Sat Feb  9 17:53:53 2013	(r311989)
@@ -1,13 +1,10 @@
-# New ports collection makefile for:   DeviceKit-power
-# Date Created:			30 December 2009
-# Whom:				Joe Marcus Clarke <marcus@FreeBSD.org>
-#
+# Created by: Joe Marcus Clarke <marcus@FreeBSD.org>
 # $FreeBSD$
 #   $MCom: ports/sysutils/upower/Makefile,v 1.19 2010/10/05 08:30:15 kwm Exp $
-#
 
 PORTNAME=	upower
 PORTVERSION=	0.9.7
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://upower.freedesktop.org/releases/
 

Added: head/sysutils/upower/files/patch-src__freebsd__up-backend.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/upower/files/patch-src__freebsd__up-backend.c	Sat Feb  9 17:53:53 2013	(r311989)
@@ -0,0 +1,11 @@
+--- ./src/freebsd/up-backend.c.orig	2010-11-01 12:28:43.000000000 +0100
++++ ./src/freebsd/up-backend.c	2013-01-23 02:42:21.293236052 +0100
+@@ -227,7 +227,7 @@
+ 	gchar *lid_state;
+ 
+ 	lid_state = up_get_string_sysctl (NULL, "hw.acpi.lid_switch_state");
+-	if (lid_state && strcmp (lid_state, "NONE")) {
++	if (lid_state) {
+ 		up_daemon_set_lid_is_present (backend->priv->daemon, TRUE);
+ 	}
+ 	g_free (lid_state);
\ No newline at end of file
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Alberto Villa freebsd_committer freebsd_triage 2013-02-09 17:54:22 UTC
State Changed
From-To: open->closed

Fix committed.
Comment 5 Ali Abdallah 2017-07-15 13:37:25 UTC
I'm not sure why this bug is still present in freebsd 11. upower 0.99.4 still checks for NONE in hw.acpi.lid_switch_state, which results in undetected lid switch. 

The proposed patch works, but somehow it did not make its way to port. I would re-open.
Comment 6 Ali Abdallah 2018-04-22 15:56:41 UTC
The patch has been applied to upower, and it is included in the 0.99.5 release. 

See : https://bugs.freedesktop.org/show_bug.cgi?id=101828
Comment 7 Graham Perrin freebsd_committer freebsd_triage 2018-10-05 06:02:32 UTC
<https://www.freshports.org/sysutils/upower> 

- 0.99.5 not in the history
- 0.99.7 committed 2018-09-30 👍