Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] Update acpid handler
@ 2020-10-27  3:26 phy1729
  2020-10-27  3:31 ` fosslinux
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: phy1729 @ 2020-10-27  3:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

There is a new pull request by phy1729 against master on the void-packages repository

https://github.com/phy1729/void-packages acpi-handler
https://github.com/void-linux/void-packages/pull/25909

Update acpid handler
The first 5 commits are various cleanups that should have no functional change. The last commit adds support for increasing and decreasing the backlight brightness. If preferred I can rebase that out and keep it as a local modification. (I have another local modification for the volume keys that I don't think can be made generic and upstreamed anyway.)

A patch file from https://github.com/void-linux/void-packages/pull/25909.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-acpi-handler-25909.patch --]
[-- Type: text/x-diff, Size: 8727 bytes --]

From 657de0c5b9bf4134e34f45fb5cf219fd5388bc55 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:46:47 -0500
Subject: [PATCH 1/6] acpid: Use $( rather than `

---
 srcpkgs/acpid/files/handler.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index c2a12be13b1..5535b8bb38f 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -4,8 +4,8 @@
 # NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
 #       modify it to not use /sys
 
-minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
-maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+minspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
+maxspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
 setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
 
 set $*
@@ -15,7 +15,7 @@ export USER=$(ps -o user --no-headers $PID)
 USERHOME=$(getent passwd $USER | cut -d: -f6)
 export XAUTHORITY="$USERHOME/.Xauthority"
 for x in /tmp/.X11-unix/*; do
-    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
+    displaynum=$(echo $x | sed s#/tmp/.X11-unix/X##)
     if [ x"$XAUTHORITY" != x"" ]; then
         export DISPLAY=":$displaynum"
     fi

From ac80db16e45fe1f1c94d8afacf9dd7fb7dd22a09 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:51:12 -0500
Subject: [PATCH 2/6] acpid: Use spaces consistently

---
 srcpkgs/acpid/files/handler.sh | 40 ++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index 5535b8bb38f..0da0d5a094a 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -26,20 +26,20 @@ case "$1" in
         #echo "PowerButton pressed!">/dev/tty5
         case "$2" in
             PBTN|PWRF)
-		    logger "PowerButton pressed: $2, shutting down..."
-		    shutdown -P now
-		    ;;
-            *)      logger "ACPI action undefined: $2" ;;
+                logger "PowerButton pressed: $2, shutting down..."
+                shutdown -P now
+                ;;
+            *)  logger "ACPI action undefined: $2" ;;
         esac
         ;;
     button/sleep)
         case "$2" in
             SBTN|SLPB)
-		    # suspend-to-ram
-		    logger "Sleep Button pressed: $2, suspending..."
-		    zzz
-		    ;;
-            *)      logger "ACPI action undefined: $2" ;;
+                # suspend-to-ram
+                logger "Sleep Button pressed: $2, suspending..."
+                zzz
+                ;;
+            *)  logger "ACPI action undefined: $2" ;;
         esac
         ;;
     ac_adapter)
@@ -75,16 +75,18 @@ case "$1" in
         esac
         ;;
     button/lid)
-	case "$3" in
-		close)
-			# suspend-to-ram
-			logger "LID closed, suspending..."
-			zzz
-			;;
-		open)	logger "LID opened" ;;
-		*) logger "ACPI action undefined (LID): $2";;
-	esac
-	;;
+        case "$3" in
+            close)
+                # suspend-to-ram
+                logger "LID closed, suspending..."
+                zzz
+                ;;
+            open)
+                logger "LID opened"
+                ;;
+            *)  logger "ACPI action undefined (LID): $2";;
+        esac
+        ;;
     *)
         logger "ACPI group/action undefined: $1 / $2"
         ;;

From 960ce51ee58a40f26e272d9b303e1be8271931c2 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:54:27 -0500
Subject: [PATCH 3/6] acpid: Quote all parameter expansions

---
 srcpkgs/acpid/files/handler.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index 0da0d5a094a..700ec46ffad 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -11,11 +11,11 @@ setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
 set $*
 
 PID=$(pgrep dbus-launch)
-export USER=$(ps -o user --no-headers $PID)
-USERHOME=$(getent passwd $USER | cut -d: -f6)
+export USER=$(ps -o user --no-headers "$PID")
+USERHOME=$(getent passwd "$USER" | cut -d: -f6)
 export XAUTHORITY="$USERHOME/.Xauthority"
 for x in /tmp/.X11-unix/*; do
-    displaynum=$(echo $x | sed s#/tmp/.X11-unix/X##)
+    displaynum=$(echo "$x" | sed s#/tmp/.X11-unix/X##)
     if [ x"$XAUTHORITY" != x"" ]; then
         export DISPLAY=":$displaynum"
     fi
@@ -47,11 +47,11 @@ case "$1" in
             AC|ACAD|ADP0)
                 case "$4" in
                     00000000)
-                        echo -n $minspeed >$setspeed
+                        echo -n "$minspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode start
                     ;;
                     00000001)
-                        echo -n $maxspeed >$setspeed
+                        echo -n "$maxspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode stop
                     ;;
                 esac

From c4edc65bf56995520683ee2d0f521677522421d6 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:55:56 -0500
Subject: [PATCH 4/6] acpid: Use a parameter expansion rather than sed

---
 srcpkgs/acpid/files/handler.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index 700ec46ffad..fb90b501a58 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -15,7 +15,7 @@ export USER=$(ps -o user --no-headers "$PID")
 USERHOME=$(getent passwd "$USER" | cut -d: -f6)
 export XAUTHORITY="$USERHOME/.Xauthority"
 for x in /tmp/.X11-unix/*; do
-    displaynum=$(echo "$x" | sed s#/tmp/.X11-unix/X##)
+    displaynum=${x#/tmp/.X11-unix/X}
     if [ x"$XAUTHORITY" != x"" ]; then
         export DISPLAY=":$displaynum"
     fi

From d28d145fe9791b10d9100a667a2a8ff6f1970848 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:56:19 -0500
Subject: [PATCH 5/6] acpid: Use printf instead of echo

echo with arguments is not well defined by POSIX. Additionally if the
variable starts with -, the results are further undefined. Use printf to
avoid all issues.
---
 srcpkgs/acpid/files/handler.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index fb90b501a58..dd5aa6e03f8 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -47,11 +47,11 @@ case "$1" in
             AC|ACAD|ADP0)
                 case "$4" in
                     00000000)
-                        echo -n "$minspeed" >"$setspeed"
+                        printf '%s' "$minspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode start
                     ;;
                     00000001)
-                        echo -n "$maxspeed" >"$setspeed"
+                        printf '%s' "$maxspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode stop
                     ;;
                 esac

From ef9204261f80d5a765bb6cf7eb84fcca20819630 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sun, 25 Oct 2020 22:33:12 -0500
Subject: [PATCH 6/6] acpid: Add screen brightness controls

---
 srcpkgs/acpid/files/handler.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index dd5aa6e03f8..7c23e3b94ed 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -4,6 +4,15 @@
 # NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
 #       modify it to not use /sys
 
+# $1 should be + or - to step up or down the brightness.
+step_backlight() {
+    for backlight in /sys/class/backlight/*/; do
+        [ -d "$backlight" ] || continue
+        step=$(( $(cat "$backlight/max_brightness") / 20 ))
+        printf '%s' "$(( $(cat "$backlight/brightness") $1 step ))" >"$backlight/brightness"
+    done
+}
+
 minspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
 maxspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
 setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
@@ -87,6 +96,12 @@ case "$1" in
             *)  logger "ACPI action undefined (LID): $2";;
         esac
         ;;
+    video/brightnessdown)
+        step_backlight -
+        ;;
+    video/brightnessup)
+        step_backlight +
+        ;;
     *)
         logger "ACPI group/action undefined: $1 / $2"
         ;;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Update acpid handler
  2020-10-27  3:26 [PR PATCH] Update acpid handler phy1729
@ 2020-10-27  3:31 ` fosslinux
  2020-10-27  3:49 ` phy1729
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fosslinux @ 2020-10-27  3:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/25909#issuecomment-716956155

Comment:
You can most probably squash all of these.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Update acpid handler
  2020-10-27  3:26 [PR PATCH] Update acpid handler phy1729
  2020-10-27  3:31 ` fosslinux
@ 2020-10-27  3:49 ` phy1729
  2020-10-30  1:09 ` ericonr
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: phy1729 @ 2020-10-27  3:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

New comment by phy1729 on void-packages repository

https://github.com/void-linux/void-packages/pull/25909#issuecomment-716961671

Comment:
I was keeping the commits logical for ease of review (and it's my typical flow), but if squashing is preferred I can certainly do that.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Update acpid handler
  2020-10-27  3:26 [PR PATCH] Update acpid handler phy1729
  2020-10-27  3:31 ` fosslinux
  2020-10-27  3:49 ` phy1729
@ 2020-10-30  1:09 ` ericonr
  2020-10-30  3:05 ` [PR PATCH] [Updated] " phy1729
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2020-10-30  1:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 197 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/25909#issuecomment-719110243

Comment:
You need to update the version in the template as well. 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] Update acpid handler
  2020-10-27  3:26 [PR PATCH] Update acpid handler phy1729
                   ` (2 preceding siblings ...)
  2020-10-30  1:09 ` ericonr
@ 2020-10-30  3:05 ` phy1729
  2020-10-30  3:20 ` phy1729
  2021-10-17 22:05 ` [PR PATCH] [Closed]: " Piraty
  5 siblings, 0 replies; 7+ messages in thread
From: phy1729 @ 2020-10-30  3:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

There is an updated pull request by phy1729 against master on the void-packages repository

https://github.com/phy1729/void-packages acpi-handler
https://github.com/void-linux/void-packages/pull/25909

Update acpid handler
The first 5 commits are various cleanups that should have no functional change. The last commit adds support for increasing and decreasing the backlight brightness. If preferred I can rebase that out and keep it as a local modification. (I have another local modification for the volume keys that I don't think can be made generic and upstreamed anyway.)

A patch file from https://github.com/void-linux/void-packages/pull/25909.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-acpi-handler-25909.patch --]
[-- Type: text/x-diff, Size: 9175 bytes --]

From adbd5ef2eaba73e17eb5b3cc269bd2bd24bf8d4a Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:46:47 -0500
Subject: [PATCH 1/6] acpid: Use $( rather than `

---
 srcpkgs/acpid/files/handler.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index c2a12be13b1..5535b8bb38f 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -4,8 +4,8 @@
 # NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
 #       modify it to not use /sys
 
-minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
-maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+minspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
+maxspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
 setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
 
 set $*
@@ -15,7 +15,7 @@ export USER=$(ps -o user --no-headers $PID)
 USERHOME=$(getent passwd $USER | cut -d: -f6)
 export XAUTHORITY="$USERHOME/.Xauthority"
 for x in /tmp/.X11-unix/*; do
-    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
+    displaynum=$(echo $x | sed s#/tmp/.X11-unix/X##)
     if [ x"$XAUTHORITY" != x"" ]; then
         export DISPLAY=":$displaynum"
     fi

From 5046a9c4126699f204c3c1974c63383eebbd982a Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:51:12 -0500
Subject: [PATCH 2/6] acpid: Use spaces consistently

---
 srcpkgs/acpid/files/handler.sh | 40 ++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index 5535b8bb38f..0da0d5a094a 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -26,20 +26,20 @@ case "$1" in
         #echo "PowerButton pressed!">/dev/tty5
         case "$2" in
             PBTN|PWRF)
-		    logger "PowerButton pressed: $2, shutting down..."
-		    shutdown -P now
-		    ;;
-            *)      logger "ACPI action undefined: $2" ;;
+                logger "PowerButton pressed: $2, shutting down..."
+                shutdown -P now
+                ;;
+            *)  logger "ACPI action undefined: $2" ;;
         esac
         ;;
     button/sleep)
         case "$2" in
             SBTN|SLPB)
-		    # suspend-to-ram
-		    logger "Sleep Button pressed: $2, suspending..."
-		    zzz
-		    ;;
-            *)      logger "ACPI action undefined: $2" ;;
+                # suspend-to-ram
+                logger "Sleep Button pressed: $2, suspending..."
+                zzz
+                ;;
+            *)  logger "ACPI action undefined: $2" ;;
         esac
         ;;
     ac_adapter)
@@ -75,16 +75,18 @@ case "$1" in
         esac
         ;;
     button/lid)
-	case "$3" in
-		close)
-			# suspend-to-ram
-			logger "LID closed, suspending..."
-			zzz
-			;;
-		open)	logger "LID opened" ;;
-		*) logger "ACPI action undefined (LID): $2";;
-	esac
-	;;
+        case "$3" in
+            close)
+                # suspend-to-ram
+                logger "LID closed, suspending..."
+                zzz
+                ;;
+            open)
+                logger "LID opened"
+                ;;
+            *)  logger "ACPI action undefined (LID): $2";;
+        esac
+        ;;
     *)
         logger "ACPI group/action undefined: $1 / $2"
         ;;

From 9b9486d1309285c552d6dc1f5cc305b5b1632d11 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:54:27 -0500
Subject: [PATCH 3/6] acpid: Quote all parameter expansions

---
 srcpkgs/acpid/files/handler.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index 0da0d5a094a..700ec46ffad 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -11,11 +11,11 @@ setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
 set $*
 
 PID=$(pgrep dbus-launch)
-export USER=$(ps -o user --no-headers $PID)
-USERHOME=$(getent passwd $USER | cut -d: -f6)
+export USER=$(ps -o user --no-headers "$PID")
+USERHOME=$(getent passwd "$USER" | cut -d: -f6)
 export XAUTHORITY="$USERHOME/.Xauthority"
 for x in /tmp/.X11-unix/*; do
-    displaynum=$(echo $x | sed s#/tmp/.X11-unix/X##)
+    displaynum=$(echo "$x" | sed s#/tmp/.X11-unix/X##)
     if [ x"$XAUTHORITY" != x"" ]; then
         export DISPLAY=":$displaynum"
     fi
@@ -47,11 +47,11 @@ case "$1" in
             AC|ACAD|ADP0)
                 case "$4" in
                     00000000)
-                        echo -n $minspeed >$setspeed
+                        echo -n "$minspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode start
                     ;;
                     00000001)
-                        echo -n $maxspeed >$setspeed
+                        echo -n "$maxspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode stop
                     ;;
                 esac

From 8501a8c44544cc098f45b7fb7cf9b3676086f221 Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:55:56 -0500
Subject: [PATCH 4/6] acpid: Use a parameter expansion rather than sed

---
 srcpkgs/acpid/files/handler.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index 700ec46ffad..fb90b501a58 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -15,7 +15,7 @@ export USER=$(ps -o user --no-headers "$PID")
 USERHOME=$(getent passwd "$USER" | cut -d: -f6)
 export XAUTHORITY="$USERHOME/.Xauthority"
 for x in /tmp/.X11-unix/*; do
-    displaynum=$(echo "$x" | sed s#/tmp/.X11-unix/X##)
+    displaynum=${x#/tmp/.X11-unix/X}
     if [ x"$XAUTHORITY" != x"" ]; then
         export DISPLAY=":$displaynum"
     fi

From 37e95a80e0d2fd966904adbf4c1c3aeda7e6207c Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sat, 19 Sep 2020 08:56:19 -0500
Subject: [PATCH 5/6] acpid: Use printf instead of echo

echo with arguments is not well defined by POSIX. Additionally if the
variable starts with -, the results are further undefined. Use printf to
avoid all issues.
---
 srcpkgs/acpid/files/handler.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index fb90b501a58..dd5aa6e03f8 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -47,11 +47,11 @@ case "$1" in
             AC|ACAD|ADP0)
                 case "$4" in
                     00000000)
-                        echo -n "$minspeed" >"$setspeed"
+                        printf '%s' "$minspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode start
                     ;;
                     00000001)
-                        echo -n "$maxspeed" >"$setspeed"
+                        printf '%s' "$maxspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode stop
                     ;;
                 esac

From aa3066bf879c3eeb4c8a0502fedf936afebeb8cd Mon Sep 17 00:00:00 2001
From: Matthew Martin <phy1729@gmail.com>
Date: Sun, 25 Oct 2020 22:33:12 -0500
Subject: [PATCH 6/6] acpid: Add screen brightness controls

---
 srcpkgs/acpid/files/handler.sh | 15 +++++++++++++++
 srcpkgs/acpid/template         |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index dd5aa6e03f8..7c23e3b94ed 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -4,6 +4,15 @@
 # NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
 #       modify it to not use /sys
 
+# $1 should be + or - to step up or down the brightness.
+step_backlight() {
+    for backlight in /sys/class/backlight/*/; do
+        [ -d "$backlight" ] || continue
+        step=$(( $(cat "$backlight/max_brightness") / 20 ))
+        printf '%s' "$(( $(cat "$backlight/brightness") $1 step ))" >"$backlight/brightness"
+    done
+}
+
 minspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
 maxspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
 setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
@@ -87,6 +96,12 @@ case "$1" in
             *)  logger "ACPI action undefined (LID): $2";;
         esac
         ;;
+    video/brightnessdown)
+        step_backlight -
+        ;;
+    video/brightnessup)
+        step_backlight +
+        ;;
     *)
         logger "ACPI group/action undefined: $1 / $2"
         ;;
diff --git a/srcpkgs/acpid/template b/srcpkgs/acpid/template
index 8312d0e4e15..a45294f1c57 100644
--- a/srcpkgs/acpid/template
+++ b/srcpkgs/acpid/template
@@ -1,7 +1,7 @@
 # Template file for 'acpid'
 pkgname=acpid
 version=2.0.32
-revision=1
+revision=2
 build_style=gnu-configure
 short_desc="The ACPI Daemon (acpid) With Netlink Support"
 maintainer="Enno Boland <gottox@voidlinux.org>"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Update acpid handler
  2020-10-27  3:26 [PR PATCH] Update acpid handler phy1729
                   ` (3 preceding siblings ...)
  2020-10-30  3:05 ` [PR PATCH] [Updated] " phy1729
@ 2020-10-30  3:20 ` phy1729
  2021-10-17 22:05 ` [PR PATCH] [Closed]: " Piraty
  5 siblings, 0 replies; 7+ messages in thread
From: phy1729 @ 2020-10-30  3:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 170 bytes --]

New comment by phy1729 on void-packages repository

https://github.com/void-linux/void-packages/pull/25909#issuecomment-719146925

Comment:
Rebased with a revision bump.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Closed]: Update acpid handler
  2020-10-27  3:26 [PR PATCH] Update acpid handler phy1729
                   ` (4 preceding siblings ...)
  2020-10-30  3:20 ` phy1729
@ 2021-10-17 22:05 ` Piraty
  5 siblings, 0 replies; 7+ messages in thread
From: Piraty @ 2021-10-17 22:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

There's a closed pull request on the void-packages repository

Update acpid handler
https://github.com/void-linux/void-packages/pull/25909

Description:
The first 5 commits are various cleanups that should have no functional change. The last commit adds support for increasing and decreasing the backlight brightness. If preferred I can rebase that out and keep it as a local modification. (I have another local modification for the volume keys that I don't think can be made generic and upstreamed anyway.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-17 22:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27  3:26 [PR PATCH] Update acpid handler phy1729
2020-10-27  3:31 ` fosslinux
2020-10-27  3:49 ` phy1729
2020-10-30  1:09 ` ericonr
2020-10-30  3:05 ` [PR PATCH] [Updated] " phy1729
2020-10-30  3:20 ` phy1729
2021-10-17 22:05 ` [PR PATCH] [Closed]: " Piraty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).