From nobody Wed Feb 23 14:46:07 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BA70819E02B7; Wed, 23 Feb 2022 14:46:07 +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 4K3f3z4w3qz3tMp; Wed, 23 Feb 2022 14:46:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645627567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ipRlVZlUJlojhOqgrto2lGKZ9PurUm9ZZdmmisghT9Q=; b=vEtWTmFt9DfprIk+r9K/4ov0SQ6KHi/HRiG/dWYTBQhAC20TBROvPEe/YGraudbp1R6UdD o9yjEYjFAia9++6G+6vWy/2OusfqxrSQsyby6eGFesclNmS97JtMtsYU5eHZ9xQf71yt04 y2/BjIGv+q2HPaQ0dF/L2WRaXBqPpiN9u6NLUWzDGRi99sagoLrAii/H8Hr8k5bYg1Ip8y HgguCDNU7vEFzK0pvbTLVmkSpIuRje6XxB7k79RmApqVPyyJS0wu6wZYMvMa7RIJWiVdw4 WKDnQEBz3/7qxQnbq1q0SOxuax2v0LcqSczvSQ7pBRrG2Wc5q7hDn0i9BP7qvg== 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 883E619C46; Wed, 23 Feb 2022 14:46:07 +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 21NEk7ps046065; Wed, 23 Feb 2022 14:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21NEk77J046064; Wed, 23 Feb 2022 14:46:07 GMT (envelope-from git) Date: Wed, 23 Feb 2022 14:46:07 GMT Message-Id: <202202231446.21NEk77J046064@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: "Jason W. Bacon" Subject: git: f7972afbeec5 - main - x11/lumina-core: Replace apm battery monitoring with sysctls() List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jwb X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7972afbeec54358e5f80c54baf473b5add0ac92 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645627567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ipRlVZlUJlojhOqgrto2lGKZ9PurUm9ZZdmmisghT9Q=; b=ZHnblvRjaD+G6TzOzfClfsI4OX4VDf74yEZDmF5srjlzoMXlOA7Xh2Q+1akmuyiq8Bo12V irLOf40BP5gfIXapmpeNmmd7t50Jd6YsJoD/N0gd0EQo1vp3MGrYjRYoYonABBiLcSuMek 3O0YCnuf9ZVTa5pj1DMpsGk0g5YIffljQ6PknNmeo3kwNWMklYsN9z8ux8g40Ejo4I4Bgr PO/X+795fVAb3Klnj2UITTaD7y9Qhb9mxfMnJ09H3kd5WT3/Cx1sJe58sGfNhuD8WZAWZ2 danpCNHCtec11FqP8KRDVwrCmtL5udeinDV0hD6yJRYULZyF9KD0eIH837VwGg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645627567; a=rsa-sha256; cv=none; b=EeQnaf44gRfKIXEolVLhe5lzDgPzvsMQsdQ4V/DWlLYfPZ574gfg16m7Wz9yMvQOZWvB5Z YHMUibbrXHd2K4vfeB/FrY1A6kRUdZpQNB8SJxBEYflEr5jjY5MjyEIF4ZkAMy5g0yTtbt jJo8Ak2AXOkflCuL99VczuDJL7k6kKUBuDLLM1qp7DC+OL2iIigq+/bOti7OUw/ddOrV4h Ec3N0rrKfzsdIzKFz7z3pNlObEPTqRFWR7OMspDMnKeC4ruORdDg9zZCaC/pREWHbJRAYo IQTzWqajlEZP/59GoA/RkJZq4d8qmOx+IcDuPLSz+sQIzAUONSA5B0vt1XOo7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jwb: URL: https://cgit.FreeBSD.org/ports/commit/?id=f7972afbeec54358e5f80c54baf473b5add0ac92 commit f7972afbeec54358e5f80c54baf473b5add0ac92 Author: Jason W. Bacon AuthorDate: 2022-02-23 14:43:06 +0000 Commit: Jason W. Bacon CommitDate: 2022-02-23 14:46:06 +0000 x11/lumina-core: Replace apm battery monitoring with sysctls() The apm command does not exist on arm, powerpc, or riscv. This also reduces CPU time for lumina-desktop. Patches have been proposed to upstream. PR: 262018 Approved by: lbartoletti --- x11/lumina-core/Makefile | 2 +- .../files/patch-libLumina_LuminaOS-FreeBSD.cpp | 72 ++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/x11/lumina-core/Makefile b/x11/lumina-core/Makefile index 561f15426077..ad734e3c8e94 100644 --- a/x11/lumina-core/Makefile +++ b/x11/lumina-core/Makefile @@ -3,7 +3,7 @@ PORTNAME= lumina-core DISTVERSIONPREFIX= v DISTVERSION= 1.6.2 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= x11 MAINTAINER= lbartoletti@FreeBSD.org diff --git a/x11/lumina-core/files/patch-libLumina_LuminaOS-FreeBSD.cpp b/x11/lumina-core/files/patch-libLumina_LuminaOS-FreeBSD.cpp new file mode 100644 index 000000000000..9b27e4817de2 --- /dev/null +++ b/x11/lumina-core/files/patch-libLumina_LuminaOS-FreeBSD.cpp @@ -0,0 +1,72 @@ +--- libLumina/LuminaOS-FreeBSD.cpp.orig 2021-12-26 02:33:45 UTC ++++ libLumina/LuminaOS-FreeBSD.cpp +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + #include + //can't read xbrightness settings - assume invalid until set +@@ -289,31 +290,53 @@ void LOS::systemSuspend(){ + } + + //Battery Availability ++// apm command is not available on powerpc or arm + bool LOS::hasBattery(){ + static int hasbat = -1; ++ int life; ++ size_t len = sizeof(life); + if(hasbat < 0 ){ +- int val = batteryCharge(); +- if(val >= 0 && val <= 100){ hasbat = 1; } +- else{ hasbat = 0; } ++ if ( sysctlbyname("hw.acpi.battery.life", &life, &len, NULL, 0) == 0 ) ++ hasbat = 1; ++ else ++ hasbat = 0; + } + return (hasbat==1); + } + + //Battery Charge Level ++// apm command is not available on powerpc or arm + int LOS::batteryCharge(){ //Returns: percent charge (0-100), anything outside that range is counted as an error +- int charge = LUtils::getCmdOutput("apm -l").join("").toInt(); +- if(charge > 100){ charge = -1; } //invalid charge +- return charge; ++ int life; // sysctl name ++ size_t len = sizeof(life); ++ if ( (sysctlbyname("hw.acpi.battery.life", &life, &len, NULL, 0) != 0) || ++ (life > 100) ) ++ life = -1; //invalid charge ++ return life; + } + + //Battery Charging State ++// apm command is not available on powerpc or arm + bool LOS::batteryIsCharging(){ +- return (LUtils::getCmdOutput("apm -a").join("").simplified() == "1"); ++ int state; ++ size_t len = sizeof(state); ++ if ( (sysctlbyname("hw.acpi.battery.state", &state, &len, NULL, 0) == 0) && ++ (state == ACPI_BATT_STAT_CHARGING) ) ++ return true; ++ else ++ return false; + } + + //Battery Time Remaining ++// apm command is not available on powerpc or arm + int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining +- return LUtils::getCmdOutput("apm -t").join("").toInt(); ++ int min; ++ size_t len = sizeof(min); ++ if ( LOS::batteryIsCharging() || ++ (sysctlbyname("hw.acpi.battery.time", &min, &len, NULL, 0) != 0) ) ++ return -1; ++ else ++ return min * 60; + } + + //File Checksums