summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorVi0L02016-06-08 19:33:19 +0200
committerVi0L02016-06-08 19:33:19 +0200
commitdbfea0194e3d0af691b7c8e173b06a0b218077b1 (patch)
tree85dc0a191158b605dbc6fd7dd66c21446f324732
parent7b0005d6e9b87b2273ba127dddeddf5753ea44ff (diff)
downloadaur-dbfea0194e3d0af691b7c8e173b06a0b218077b1.tar.gz
15.9-3: added acpi script from aslmaswd
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD15
-rw-r--r--a-ac-aticonfig6
-rw-r--r--a-lid-aticonfig4
-rwxr-xr-xati-powermode.sh107
5 files changed, 49 insertions, 91 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d8f4b327deba..731ff8bbcc74 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = catalyst-utils
pkgver = 15.9
- pkgrel = 2
+ pkgrel = 3
url = http://www.amd.com
arch = i686
arch = x86_64
@@ -14,8 +14,6 @@ pkgbase = catalyst-utils
source = atieventsd.sh
source = atieventsd.service
source = ati-powermode.sh
- source = a-ac-aticonfig
- source = a-lid-aticonfig
source = catalyst.conf
source = arch-fglrx-authatieventsd_new.patch
source = switchlibGL
@@ -27,9 +25,7 @@ pkgbase = catalyst-utils
md5sums = bdafe749e046bfddee2d1c5e90eabd83
md5sums = 9d9ea496eadf7e883d56723d65e96edf
md5sums = b79e144932616221f6d01c4b05dc9306
- md5sums = 514899437eb209a1d4670df991cdfc10
- md5sums = 80fdfbff93d96a1dfca2c7f684be8cc1
- md5sums = 9054786e08cf3ea2a549fe22d7f2cd92
+ md5sums = 9e2a7ded987b7d2b2cfffc7281ebd8a5
md5sums = 3e19c2285c76f4cb92108435a1e9c302
md5sums = b3ceefeb97c609037845f65d0956c4f0
md5sums = 394bc493fdf493a5093f9e2095096d02
diff --git a/PKGBUILD b/PKGBUILD
index 43d6d9be71f6..8d22b18db98e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,12 +6,13 @@
# Contributor: zoqaeski (authatieventsd' patch for lightdm)
# Contributor: zoopp
# Contributor: solar (authatieventsd' patch s/-1/255)
+# Contributor: aslmaswd (acpi main script)
pkgbase=catalyst-utils
pkgname=('catalyst-utils' 'catalyst-libgl' 'opencl-catalyst')
pkgver=15.9
-pkgrel=2
+pkgrel=3
_amdver=15.201.1151
arch=('i686' 'x86_64')
url="http://www.amd.com"
@@ -27,8 +28,6 @@ source=(
atieventsd.sh
atieventsd.service
ati-powermode.sh
- a-ac-aticonfig
- a-lid-aticonfig
catalyst.conf
arch-fglrx-authatieventsd_new.patch
switchlibGL
@@ -41,9 +40,7 @@ md5sums=('d2de2df6946b452c266a3c892e6e46ff'
'bdafe749e046bfddee2d1c5e90eabd83'
'9d9ea496eadf7e883d56723d65e96edf'
'b79e144932616221f6d01c4b05dc9306'
- '514899437eb209a1d4670df991cdfc10'
- '80fdfbff93d96a1dfca2c7f684be8cc1'
- '9054786e08cf3ea2a549fe22d7f2cd92'
+ '9e2a7ded987b7d2b2cfffc7281ebd8a5'
'3e19c2285c76f4cb92108435a1e9c302'
'b3ceefeb97c609037845f65d0956c4f0'
'394bc493fdf493a5093f9e2095096d02'
@@ -247,11 +244,9 @@ package_catalyst-utils() {
# ACPI example files
# install -m755 usr/share/doc/fglrx/examples/etc/acpi/*.sh ${pkgdir}/etc/acpi
# sed -i -e "s/usr\/X11R6/usr/g" ${pkgdir}/etc/acpi/ati-powermode.sh
-# install -m644 usr/share/doc/fglrx/examples/etc/acpi/events/* ${pkgdir}/etc/acpi/events
- # lets check our own files - V
+ install -m644 usr/share/doc/fglrx/examples/etc/acpi/events/* ${pkgdir}/etc/acpi/events
+ # put version modified by aslmaswd - V
install -m755 ${srcdir}/ati-powermode.sh ${pkgdir}/etc/acpi
- install -m644 ${srcdir}/a-ac-aticonfig ${pkgdir}/etc/acpi/events
- install -m644 ${srcdir}/a-lid-aticonfig ${pkgdir}/etc/acpi/events
# Add ATI Events Daemon launcher
install -m755 ${srcdir}/atieventsd.sh ${pkgdir}/etc/rc.d/atieventsd
diff --git a/a-ac-aticonfig b/a-ac-aticonfig
deleted file mode 100644
index 753e3af063f9..000000000000
--- a/a-ac-aticonfig
+++ /dev/null
@@ -1,6 +0,0 @@
-# /etc/acpi/events/ac
-# Called when the user connects ac power to us
-#
-
-event=ac_adapter
-action=/etc/acpi/ati-powermode.sh "%e"
diff --git a/a-lid-aticonfig b/a-lid-aticonfig
deleted file mode 100644
index 021f834ba6dd..000000000000
--- a/a-lid-aticonfig
+++ /dev/null
@@ -1,4 +0,0 @@
-# Called when the user opens/closes the laptop lid
-
-event=button/lid
-action=/etc/acpi/ati-powermode.sh "%e"
diff --git a/ati-powermode.sh b/ati-powermode.sh
index ded996c43057..6c2ad527d0cb 100755
--- a/ati-powermode.sh
+++ b/ati-powermode.sh
@@ -5,6 +5,10 @@
#
getXuser() {
+# user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
+# if [ x"$user" = x"" ]; then
+# user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
+# fi
user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'`
if [ x"$user" = x"" ]; then
startx=`pgrep -n startx`
@@ -18,11 +22,30 @@ getXuser() {
else
export XAUTHORITY=""
fi
- export XUSER=$user
}
+
+grep -q closed /proc/acpi/button/lid/*/state
+if [ $? = 0 ]; then
+ lid_closed=1
+ echo "Lid Closed"
+else
+ lid_closed=0
+ echo "Lid Open"
+fi
+
+#grep -q off-line /proc/acpi/ac_adapter/*/state
+grep -q 0 /sys/class/power_supply/ADP*/online
+
+if [ $? = 0 ]; then
+ echo "On DC"
+ on_dc=1
+else
+ echo "On AC"
+ on_dc=0
+fi
+
#Find the right XServer to be configured.
-getXserver() {
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
@@ -30,10 +53,8 @@ for x in /tmp/.X11-unix/*; do
export DISPLAY=":$displaynum"
fi
done
-}
#If PPLIB is enabled
-checkPPLIB() {
su $user -c '/usr/bin/aticonfig --pplib-cmd="get version"' | grep PPLIB
if [ $? = 0 ]; then
echo "Has PPLIB"
@@ -42,65 +63,21 @@ else
echo "No PPLIB"
has_pplib=0
fi
-}
-case "$1" in
- ac_adapter)
- case "$2" in
- AC|ACAD|ADP0)
- case "$4" in
- 00000000)
- logger 'AC unpluged'
- getXserver;
- checkPPLIB;
- if [ ${has_pplib} -eq 1 ]; then
- su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
- else
- su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
- fi
- ;;
- 00000001)
- logger 'AC pluged'
- getXserver;
- checkPPLIB;
- if [ ${has_pplib} -eq 1 ]; then
- su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
- else
- su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
- fi
- ;;
- esac
- ;;
- *)
- logger "ACPI action undefined: $2"
- ;;
- esac
- ;;
- button/lid)
- case "$3" in
- close)
- logger 'LID closed'
- getXserver;
- checkPPLIB;
- if [ ${has_pplib} -eq 1 ]; then
- su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
- else
- su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
- fi
- ;;
- open)
- logger 'LID opened'
- getXserver;
- checkPPLIB;
- if [ ${has_pplib} -eq 1 ]; then
- su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
- else
- su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
- fi
- ;;
- *)
- logger "ACPI action undefined: $3"
- ;;
- esac
- ;;
-esac \ No newline at end of file
+
+
+if [ ${lid_closed} -eq 1 -o ${on_dc} -eq 1 ]; then
+ echo "Low power"
+ if [ ${has_pplib} -eq 1 ]; then
+ su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
+ else
+ su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
+ fi
+else
+ echo "high power"
+ if [ ${has_pplib} -eq 1 ]; then
+ su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
+ else
+ su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
+ fi
+fi \ No newline at end of file