acpid: Only read cpuinfo_{min,max}_freq when needed
Previously handler.sh would unconditionally fork/exec 'cat' twice to read these files on any invocation, though their values are only used for ac_adapter events. Tidy it up to only read them when handling that case.
This commit is contained in:
parent
376ff6e1c4
commit
60dcf2183e
|
@ -14,8 +14,8 @@ step_backlight() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
minspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
|
minspeed="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq"
|
||||||
maxspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
|
maxspeed="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
|
||||||
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
|
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ case "$1" in
|
||||||
AC|ACAD|ADP0)
|
AC|ACAD|ADP0)
|
||||||
case "$4" in
|
case "$4" in
|
||||||
00000000)
|
00000000)
|
||||||
printf '%s' "$minspeed" >"$setspeed"
|
cat "$minspeed" >"$setspeed"
|
||||||
#/etc/laptop-mode/laptop-mode start
|
#/etc/laptop-mode/laptop-mode start
|
||||||
;;
|
;;
|
||||||
00000001)
|
00000001)
|
||||||
printf '%s' "$maxspeed" >"$setspeed"
|
cat "$maxspeed" >"$setspeed"
|
||||||
#/etc/laptop-mode/laptop-mode stop
|
#/etc/laptop-mode/laptop-mode stop
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'acpid'
|
# Template file for 'acpid'
|
||||||
pkgname=acpid
|
pkgname=acpid
|
||||||
version=2.0.34
|
version=2.0.34
|
||||||
revision=2
|
revision=3
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
short_desc="ACPI Daemon (acpid) With Netlink Support"
|
short_desc="ACPI Daemon (acpid) With Netlink Support"
|
||||||
maintainer="Enno Boland <gottox@voidlinux.org>"
|
maintainer="Enno Boland <gottox@voidlinux.org>"
|
||||||
|
|
Loading…
Reference in New Issue