This commit is contained in:
4fury-c3440d8
2022-11-10 09:09:58 +03:00
parent 9f4d9f19e8
commit 250ea8efe0
4 changed files with 211 additions and 105 deletions
+1 -5
View File
@@ -4,9 +4,7 @@
# Licensed under the GNU General Public License, version 3. # Licensed under the GNU General Public License, version 3.
# See the file https://www.gnu.org/licenses/gpl-3.0.txt # See the file https://www.gnu.org/licenses/gpl-3.0.txt
from pisi.actionsapi import autotools from pisi.actionsapi import autotools, pisitools, get
from pisi.actionsapi import pisitools
from pisi.actionsapi import get
def setup(): def setup():
autotools.configure() autotools.configure()
@@ -16,5 +14,3 @@ def build():
def install(): def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR()) autotools.rawInstall("DESTDIR=%s" % get.installDIR())
pisitools.dodoc('README', 'COPYING')
@@ -0,0 +1,3 @@
# Pass all events to our one handler script
event=.*
action=/etc/acpi/handler.sh %e
@@ -0,0 +1,96 @@
#!/bin/sh
# Default acpi script that takes an entry for all actions
# 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 ))
[ "$step" -gt "1" ] || step=1 #fallback if gradation is too low
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"
case "$1" in
button/power)
case "$2" in
PBTN|PWRF)
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" ;;
esac
;;
ac_adapter)
case "$2" in
AC|ACAD|ADP0)
case "$4" in
00000000)
printf '%s' "$minspeed" >"$setspeed"
#/etc/laptop-mode/laptop-mode start
;;
00000001)
printf '%s' "$maxspeed" >"$setspeed"
#/etc/laptop-mode/laptop-mode stop
;;
esac
;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
battery)
case "$2" in
BAT0)
case "$4" in
00000000) #echo "offline" >/dev/tty5
;;
00000001) #echo "online" >/dev/tty5
;;
esac
;;
CPU0)
;;
*) logger "ACPI action undefined: $2" ;;
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
;;
video/brightnessdown)
step_backlight -
;;
video/brightnessup)
step_backlight +
;;
*)
logger "ACPI group/action undefined: $1 / $2"
;;
esac
+17 -6
View File
@@ -8,14 +8,16 @@
<Name>PisiLinux Community</Name> <Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email> <Email>admins@pisilinux.org</Email>
</Packager> </Packager>
<License>GPLv2+</License> <License>GPL-2</License>
<IsA>service</IsA> <IsA>service</IsA>
<IsA>app:console</IsA> <IsA>app:console</IsA>
<Summary>ACPI daemon that dispatches ACPI events to user-space programs</Summary> <Summary>ACPI daemon that dispatches ACPI events to user-space programs</Summary>
<Description>acpid is a flexible and extensible daemon for ACPI (Advanced Configuration and Power Interface) event dispatching.</Description> <Description>acpid is a flexible and extensible daemon for ACPI (Advanced Configuration and Power Interface) event dispatching.</Description>
<Archive sha1sum="b3e06c3f2213db8ee1a9024cf372fb30e2fab637" type="tarxz">mirrors://sourceforge/acpid2/acpid-2.0.33.tar.xz</Archive> <Archive sha1sum="9322112027e4aa5a8d1b97ec64ef1d150ff0f4fc" type="tarxz">
mirrors://sourceforge/acpid2/acpid-2.0.34.tar.xz
</Archive>
<Patches> <Patches>
<!-- <Patch level="1">acpid-2.0.32-powerbtn-gsd-power.patch</Patch> --> <!-- <Patch level="1"></Patch> -->
</Patches> </Patches>
</Source> </Source>
@@ -24,7 +26,7 @@
<Files> <Files>
<Path fileType="executable">/usr/bin</Path> <Path fileType="executable">/usr/bin</Path>
<Path fileType="executable">/usr/sbin</Path> <Path fileType="executable">/usr/sbin</Path>
<Path fileType="executable">/etc/acpi/actions</Path> <Path fileType="executable">/etc/acpi</Path>
<Path fileType="data">/etc/acpi/events</Path> <Path fileType="data">/etc/acpi/events</Path>
<Path fileType="config">/etc/conf.d</Path> <Path fileType="config">/etc/conf.d</Path>
<Path fileType="data">/usr/share/dbus-1/services/acpid.service</Path> <Path fileType="data">/usr/share/dbus-1/services/acpid.service</Path>
@@ -32,10 +34,12 @@
<Path fileType="man">/usr/share/man</Path> <Path fileType="man">/usr/share/man</Path>
</Files> </Files>
<AdditionalFiles> <AdditionalFiles>
<AdditionalFile owner="root" permission="0755" target="/etc/acpi/actions/power.sh">acpid.power.sh</AdditionalFile> <AdditionalFile owner="root" permission="0755" target="/etc/acpi/handler.sh">handler.sh</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/etc/acpi/events/anything">anything</AdditionalFile>
<!-- <AdditionalFile owner="root" permission="0755" target="/etc/acpi/actions/power.sh">acpid.power.sh</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/etc/acpi/events/power.conf">fedora/acpid.power.conf</AdditionalFile> <AdditionalFile owner="root" permission="0644" target="/etc/acpi/events/power.conf">fedora/acpid.power.conf</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/etc/acpi/events/video.conf">fedora/acpid.video.conf</AdditionalFile> <AdditionalFile owner="root" permission="0644" target="/etc/acpi/events/video.conf">fedora/acpid.video.conf</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/etc/conf.d/acpid">fedora/acpid.sysconfig</AdditionalFile> <AdditionalFile owner="root" permission="0644" target="/etc/conf.d/acpid">fedora/acpid.sysconfig</AdditionalFile> -->
</AdditionalFiles> </AdditionalFiles>
<Provides> <Provides>
<COMAR script="service.py">System.Service</COMAR> <COMAR script="service.py">System.Service</COMAR>
@@ -43,6 +47,13 @@
</Package> </Package>
<History> <History>
<Update release="9">
<Date>2022-11-10</Date>
<Version>2.0.34</Version>
<Comment>Version bump.</Comment>
<Name>fury</Name>
<Email>uglyside@yandex.ru</Email>
</Update>
<Update release="8"> <Update release="8">
<Date>2021-11-04</Date> <Date>2021-11-04</Date>
<Version>2.0.33</Version> <Version>2.0.33</Version>