summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorQue Quotion2017-04-05 03:36:59 +0900
committerQue Quotion2017-04-05 03:36:59 +0900
commit05fac17e79e86da012311b490a816bfadbbe3f13 (patch)
tree21207c7f1f3a9d784485718efada233410fb8129
parent2134915e18e889ac4d41472c6677e5e9970885cc (diff)
downloadaur-05fac17e79e86da012311b490a816bfadbbe3f13.tar.gz
Patch cleanup; setting governor from indicator works again (via sysfs); removed cpufreq/cpupower dependencies!
-rw-r--r--.SRCINFO27
-rw-r--r--0001_Use_cpupower.patch12
-rw-r--r--PKGBUILD44
-rw-r--r--com.ubuntu.indicator.policy.in.patch60
-rw-r--r--cpu-online.patch22
-rw-r--r--indicator-cpufreq-selector.patch81
-rw-r--r--indicator-powersave.patch267
-rw-r--r--indicator.py.patch208
-rw-r--r--no-cpufreq.patch211
-rw-r--r--schedutil.patch10
-rw-r--r--use-sysfs.patch90
11 files changed, 590 insertions, 442 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e722c5f9cb00..d635c47bcbe0 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,15 +1,14 @@
# Generated by mksrcinfo v8
-# Thu Mar 30 04:46:08 UTC 2017
+# Tue Apr 4 18:35:10 UTC 2017
pkgbase = indicator-powersave
pkgdesc = User discretion power managment utility forked from CPU frequency indicator (bzr version)
- pkgver = r98.7
- pkgrel = 2
+ pkgver = r98.8
+ pkgrel = 1
url = https://launchpad.net/indicator-cpufreq
arch = i686
arch = x86_64
license = GPL
makedepends = python2-distutils-extra
- depends = cpupower
depends = libappindicator3
depends = python2
depends = python2-dbus
@@ -28,21 +27,19 @@ pkgbase = indicator-powersave
conflicts = indicator-cpufreq-bzr
source = bzr+lp:indicator-cpufreq
source = indicator-cpufreq.rules
- source = 0001_Use_cpupower.patch
- source = indicator-powersave.patch
- source = cpu-online.patch
- source = schedutil.patch
- source = use-sysfs.patch
+ source = com.ubuntu.indicator.policy.in.patch
+ source = indicator-cpufreq-selector.patch
+ source = indicator.py.patch
+ source = no-cpufreq.patch
source = throttle
source = throttle-cut.service
sha512sums = SKIP
sha512sums = 5427f1dcd51fe7fb43bbce1bc020a32312e2f82ccf643129b9887262730989197e2ce2cd4494922df058e78bdb8fbe220eccd69588ff917a891d5a56b3366a24
- sha512sums = 8aad00c00a95d71f221647263422eef89a0207bdb55d883520f3871f28551c316860560207c96144e22dda2ab5f5fc9b8c7bfa0fc642283de160bfd61458b8c0
- sha512sums = d9ea712c0a0d6da9dc291b75322a207d83f73bd2a6e92111167679e53469cf3608e56ca40437bdc4a584d519d07e799292905d33d4dca65fff35bc7b0987b0a5
- sha512sums = 8e929aa5d00a17be32b33085eb09aa66002a48696651adcd99678663230d73ed215b88634bb6364867140b8a336566cd02e0b04927423980ca4be9833f316b2a
- sha512sums = 56f87addd1d2479446bfed262f4e95b5494fd958c6138dc68c03071b74dacba24c40e7cd946233816fde963e3bcbaf5cab4b1cf19288dfb8058ee9ff424ca367
- sha512sums = b39f5bf06ce8c65f315582e92db34649f5967936ba2e5b27b61532314dc5e39cd6172f7e2da701e5f1de962e29021d041a770384a91267d819daa35fc8d45384
- sha512sums = eb93e350ab73b576169323d41a810a476df9a00d3e74e98965e2cd621553c6338506d1b9b13754ec68b7e58b5133a4f7c4b1ccd5f00daa21e579001c391910ac
+ sha512sums = 9b57d18ef9edc6b609b24f6a62c93c472bc2b72dd158728af1a1d0833a308a72457b0ad32c2d51b357650fa69c0f7f595fa55901ea490a7a3fda3c7c998de2bd
+ sha512sums = 7e30098e35a72d66a885290a2be2aaf86b72f0242fd4d7ed62e81f9f6e7da378d70c7f7ef54701374dd1440f64173330457cdaf58a3a9bca35a59a57b29123a7
+ sha512sums = a0da38fbc7e28189bdb95992880cba5a8b4882a02cac00c13415b5a59c1dc63152965fc221069aafbd39e1e12bd93e3b7d028f50ebd215223e9ace3ee2f8642d
+ sha512sums = 2b1229ad56651a8d55590256785119da4eba2a2f8d74e57475a8303dc076d5e9067a6481e3245d05557ea0f983d8fa1f1ac02f705fe695f4a4ef79fa86b00b89
+ sha512sums = c93dcee71e9ad465ca555a2c8f7da32247b4323a428ce1a63ecdab17fd471d51ffb86b174fa0f9662a27b656217d1bf73f9b47d6646cf99fb12f3df464d66073
sha512sums = aa86b5d6028033d6fbcc3d74d63c33298c0d437972d576990dfc4cae51d5c5128d789695e98fc5612ec7f8a4e2e68ea0576cf072e98fce4e0c22896be2f8b996
pkgname = indicator-powersave
diff --git a/0001_Use_cpupower.patch b/0001_Use_cpupower.patch
deleted file mode 100644
index 73c2588caace..000000000000
--- a/0001_Use_cpupower.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Nru indicator-cpufreq-0.1.4.orig/indicator_cpufreq/cpufreq.py indicator-cpufreq-0.1.4/indicator_cpufreq/cpufreq.py
---- indicator-cpufreq-0.1.4.orig/indicator_cpufreq/cpufreq.py 2012-10-23 17:26:18.919464853 -0400
-+++ indicator-cpufreq-0.1.4/indicator_cpufreq/cpufreq.py 2012-10-23 17:26:44.372792374 -0400
-@@ -17,7 +17,7 @@
- from ctypes import *
- from ctypes.util import find_library
-
--_libcpufreq = cdll.LoadLibrary(find_library("cpufreq"))
-+_libcpufreq = cdll.LoadLibrary(find_library("cpupower"))
-
- class _cpufreq_policy(Structure):
- _fields_ = [
diff --git a/PKGBUILD b/PKGBUILD
index 550c24cad832..ba94f5e8cb11 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,64 +2,56 @@
# Contributor: Xiao-Long Chen <chenxiaolongcxl.epac.to>
pkgname=indicator-powersave
-pkgver=r98.7
-pkgrel=2
+pkgver=r98.8
+pkgrel=1
pkgdesc="User discretion power managment utility forked from CPU frequency indicator (bzr version)"
arch=('i686' 'x86_64')
url="https://launchpad.net/indicator-cpufreq"
license=('GPL')
-depends=('cpupower' 'libappindicator3' 'python2' 'python2-dbus' 'python2-gobject' 'pygtk' 'polkit-gnome' 'indicator-application')
+depends=('libappindicator3' 'python2' 'python2-dbus' 'python2-gobject' 'pygtk' 'polkit-gnome' 'indicator-application')
optdepends=('x86_energy_perf_policy' 'hdparm' 'nvidia-utils' 'iw' 'ethtool')
makedepends=('python2-distutils-extra')
provides=('indicator-cpufreq' 'indicator-cpufreq-bzr')
conflicts=('indicator-cpufreq' 'indicator-cpufreq-bzr')
source=("bzr+lp:indicator-cpufreq"
'indicator-cpufreq.rules'
- '0001_Use_cpupower.patch'
- 'indicator-powersave.patch'
- 'cpu-online.patch'
- 'schedutil.patch'
- 'use-sysfs.patch'
+ 'com.ubuntu.indicator.policy.in.patch'
+ 'indicator-cpufreq-selector.patch'
+ 'indicator.py.patch'
+ 'no-cpufreq.patch'
'throttle'
'throttle-cut.service')
sha512sums=('SKIP'
'5427f1dcd51fe7fb43bbce1bc020a32312e2f82ccf643129b9887262730989197e2ce2cd4494922df058e78bdb8fbe220eccd69588ff917a891d5a56b3366a24'
- '8aad00c00a95d71f221647263422eef89a0207bdb55d883520f3871f28551c316860560207c96144e22dda2ab5f5fc9b8c7bfa0fc642283de160bfd61458b8c0'
- 'd9ea712c0a0d6da9dc291b75322a207d83f73bd2a6e92111167679e53469cf3608e56ca40437bdc4a584d519d07e799292905d33d4dca65fff35bc7b0987b0a5'
- '8e929aa5d00a17be32b33085eb09aa66002a48696651adcd99678663230d73ed215b88634bb6364867140b8a336566cd02e0b04927423980ca4be9833f316b2a'
- '56f87addd1d2479446bfed262f4e95b5494fd958c6138dc68c03071b74dacba24c40e7cd946233816fde963e3bcbaf5cab4b1cf19288dfb8058ee9ff424ca367'
- 'b39f5bf06ce8c65f315582e92db34649f5967936ba2e5b27b61532314dc5e39cd6172f7e2da701e5f1de962e29021d041a770384a91267d819daa35fc8d45384'
- 'eb93e350ab73b576169323d41a810a476df9a00d3e74e98965e2cd621553c6338506d1b9b13754ec68b7e58b5133a4f7c4b1ccd5f00daa21e579001c391910ac'
+ '9b57d18ef9edc6b609b24f6a62c93c472bc2b72dd158728af1a1d0833a308a72457b0ad32c2d51b357650fa69c0f7f595fa55901ea490a7a3fda3c7c998de2bd'
+ '7e30098e35a72d66a885290a2be2aaf86b72f0242fd4d7ed62e81f9f6e7da378d70c7f7ef54701374dd1440f64173330457cdaf58a3a9bca35a59a57b29123a7'
+ 'a0da38fbc7e28189bdb95992880cba5a8b4882a02cac00c13415b5a59c1dc63152965fc221069aafbd39e1e12bd93e3b7d028f50ebd215223e9ace3ee2f8642d'
+ '2b1229ad56651a8d55590256785119da4eba2a2f8d74e57475a8303dc076d5e9067a6481e3245d05557ea0f983d8fa1f1ac02f705fe695f4a4ef79fa86b00b89'
+ 'c93dcee71e9ad465ca555a2c8f7da32247b4323a428ce1a63ecdab17fd471d51ffb86b174fa0f9662a27b656217d1bf73f9b47d6646cf99fb12f3df464d66073'
'aa86b5d6028033d6fbcc3d74d63c33298c0d437972d576990dfc4cae51d5c5128d789695e98fc5612ec7f8a4e2e68ea0576cf072e98fce4e0c22896be2f8b996')
pkgver() {
cd indicator-cpufreq
- printf "r%s" "$(bzr revno).7"
+ printf "r%s" "$(bzr revno).8"
}
prepare() {
cd "${srcdir}/indicator-cpufreq"
#Indicator-Powersave
- patch -Np1 < "${srcdir}/indicator-powersave.patch"
+ patch -Np0 < "${srcdir}/com.ubuntu.indicator.policy.in.patch"
+ patch -Np0 < "${srcdir}/indicator-cpufreq-selector.patch"
+ patch -Np0 < "${srcdir}/indicator.py.patch"
+ patch -Np0 < "${srcdir}/no-cpufreq.patch"
- #Fixes
- printf "0001_Use_cpupower.patch\n"
- patch -Np1 < "${srcdir}/0001_Use_cpupower.patch"
- printf "cpu-online.patch\n"
- patch -Np2 < "${srcdir}/cpu-online.patch"
- printf "schedutil.patch\n"
- patch -Np2 < "${srcdir}/schedutil.patch"
- printf "use-sysfs.patch\n"
- patch -Np2 < "${srcdir}/use-sysfs.patch"
}
package() {
cd "${srcdir}/indicator-cpufreq"
python2 setup.py install --root="${pkgdir}/" --optimize=1
- install -dm700 -o polkitd "${pkgdir}/usr/share/polkit-1/rules.d/"
+ install -dm750 -o polkitd "${pkgdir}/usr/share/polkit-1/rules.d/"
install -m644 "${srcdir}/indicator-cpufreq.rules" \
"${pkgdir}/usr/share/polkit-1/rules.d/"
diff --git a/com.ubuntu.indicator.policy.in.patch b/com.ubuntu.indicator.policy.in.patch
new file mode 100644
index 000000000000..f6b356b5d398
--- /dev/null
+++ b/com.ubuntu.indicator.policy.in.patch
@@ -0,0 +1,60 @@
+--- indicator_cpufreq/com.ubuntu.indicatorcpufreq.policy.in 2014-12-27 02:48:58.330816000 +0900
++++ indicator_cpufreq/com.ubuntu.indicatorcpufreq.policy.in 2014-12-27 02:29:19.809678757 +0900
+@@ -13,13 +13,55 @@
+ <vendor_url>https://launchpad.net/indicator-cpufreq</vendor_url>
+ <icon_name>indicator-cpufreq</icon_name>
+
++ <action id="com.ubuntu.indicatorcpufreqselector.setthrottle">
++ <_description>Change device powersaving settings</_description>
++ <_message>System policy prevents you from changing system throttle.</_message>
++
++ <defaults>
++ <allow_inactive>no</allow_inactive>
++ <allow_active>yes</allow_active>
++ </defaults>
++ </action>
++
+ <action id="com.ubuntu.indicatorcpufreqselector.setfrequencyscaling">
+ <_description>Change CPU frequency scaling</_description>
+ <_message>System policy prevents you from changing CPU frequency scaling.</_message>
+
+ <defaults>
+ <allow_inactive>no</allow_inactive>
+- <allow_active>auth_admin_keep</allow_active>
++ <allow_active>yes</allow_active>
++ </defaults>
++ </action>
++
++ <action id="com.ubuntu.indicatorcpufreqselector.setpsturbo">
++ <_description>Change Intel P-State Turbo settings</_description>
++ <_message>System policy prevents you from changing P-State Turbo.</_message>
++
++ <defaults>
++ <allow_inactive>no</allow_inactive>
++ <allow_active>yes</allow_active>
++ </defaults>
++ </action>
++
++ <action id="com.ubuntu.indicatorcpufreqselector.sethyperthreads">
++ <_description>Change hyperthreading settings</_description>
++ <_message>System policy prevents you from changing hyperthreading.</_message>
++
++ <defaults>
++ <allow_inactive>no</allow_inactive>
++ <allow_active>yes</allow_active>
+ </defaults>
+ </action>
++
++ <action id="com.ubuntu.indicatorcpufreqselector.setgputhrottle">
++ <_description>Change GPU throttle settings</_description>
++ <_message>System policy prevents you from changing GPU throttle.</_message>
++
++ <defaults>
++ <allow_inactive>no</allow_inactive>
++ <allow_active>yes</allow_active>
++ </defaults>
++ </action>
++
++
+ </policyconfig>
+
diff --git a/cpu-online.patch b/cpu-online.patch
deleted file mode 100644
index 3009200acd24..000000000000
--- a/cpu-online.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- src/indicator-cpufreq/indicator_cpufreq/cpufreq.py 2016-10-19 07:45:42.210318252 +0900
-+++ src/indicator-cpufreq/indicator_cpufreq/cpufreq.py 2016-10-19 08:13:35.815333349 +0900
-@@ -56,8 +56,8 @@
-
- ###############################################################################
-
--_libcpufreq.cpufreq_cpu_exists.argtypes = [c_uint]
--_libcpufreq.cpufreq_cpu_exists.restype = c_int
-+_libcpufreq.cpupower_is_cpu_online.argtypes = [c_uint]
-+_libcpufreq.cpupower_is_cpu_online.restype = c_int
-
- _libcpufreq.cpufreq_get_freq_kernel.argtypes = [c_uint]
- _libcpufreq.cpufreq_get_freq_kernel.restype = c_ulong
-@@ -118,7 +118,7 @@
- _libcpufreq.cpufreq_set_frequency.restype = c_int
-
- def cpu_exists(cpu):
-- return _libcpufreq.cpufreq_cpu_exists(cpu)
-+ return _libcpufreq.cpupower_is_cpu_online(cpu)
-
- def get_freq_kernel(cpu):
- return _libcpufreq.cpufreq_get_freq_kernel(cpu)
diff --git a/indicator-cpufreq-selector.patch b/indicator-cpufreq-selector.patch
new file mode 100644
index 000000000000..4b7a937eca57
--- /dev/null
+++ b/indicator-cpufreq-selector.patch
@@ -0,0 +1,81 @@
+=== modified file 'bin/indicator-cpufreq-selector'
+--- bin/indicator-cpufreq-selector 2013-01-25 14:15:03 +0000
++++ bin/indicator-cpufreq-selector 2017-04-04 16:48:53 +0000
+@@ -21,7 +21,7 @@
+ import dbus.service
+ import dbus.mainloop.glib
+
+-from indicator_cpufreq import cpufreq
++import subprocess
+
+ class PermissionDeniedByPolicy(dbus.DBusException):
+ _dbus_error_name = 'com.ubuntu.DeviceDriver.PermissionDeniedByPolicy'
+@@ -42,24 +42,49 @@
+ self._package_operation_in_progress = False
+
+ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
+- in_signature='auu',
+- out_signature='',
+- sender_keyword='sender',
+- connection_keyword='conn')
+- def SetFrequency(self, cpus, frequency, sender=None, conn=None):
+- self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setfrequencyscaling')
+- for cpu in cpus:
+- error = cpufreq.set_frequency(cpu, frequency)
+-
+- @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
+- in_signature='aus',
+- out_signature='',
+- sender_keyword='sender',
+- connection_keyword='conn')
+- def SetGovernor(self, cpus, governor, sender=None, conn=None):
+- self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setfrequencyscaling')
+- for cpu in cpus:
+- error = cpufreq.modify_policy_governor(cpu, governor)
++ in_signature='as',
++ out_signature='',
++ sender_keyword='sender',
++ connection_keyword='conn')
++ def SetThrottle(self, throttle, sender=None, conn=None):
++ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setthrottle')
++ error = subprocess.Popen(["/bin/sh", "throttle", throttle])
++
++ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
++ in_signature='as',
++ out_signature='',
++ sender_keyword='sender',
++ connection_keyword='conn')
++ def SetGovernor(self, governor, sender=None, conn=None):
++ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setfrequencyscaling')
++ error = subprocess.Popen(["/bin/sh", "throttle", governor])
++
++ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
++ in_signature='as',
++ out_signature='',
++ sender_keyword='sender',
++ connection_keyword='conn')
++ def SetPSTurbo(self, psturbo, sender=None, conn=None):
++ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setpsturbo')
++ error = subprocess.Popen(["/bin/sh", "throttle", psturbo])
++
++ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
++ in_signature='as',
++ out_signature='',
++ sender_keyword='sender',
++ connection_keyword='conn')
++ def SetHyperthreads(self, hyperthreads, sender=None, conn=None):
++ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.sethyperthreads')
++ error = subprocess.Popen(["/bin/sh", "throttle", hyperthreads])
++
++ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
++ in_signature='as',
++ out_signature='',
++ sender_keyword='sender',
++ connection_keyword='conn')
++ def SetGPUThrottle(self, gputhrottle, sender=None, conn=None):
++ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setgputhrottle')
++ error = subprocess.Popen(["/bin/sh", "throttle", gputhrottle])
+
+ def _check_polkit_privilege(self, sender, conn, privilege):
+ '''Verify that sender has a given PolicyKit privilege.
+
diff --git a/indicator-powersave.patch b/indicator-powersave.patch
deleted file mode 100644
index 986a49b7b2a6..000000000000
--- a/indicator-powersave.patch
+++ /dev/null
@@ -1,267 +0,0 @@
---- indicator-cpufreq/bin/indicator-cpufreq-selector 2014-12-27 02:48:58.330816000 +0900
-+++ indicator-cpufreq/bin/indicator-cpufreq-selector 2014-12-27 02:25:45.903998358 +0900
-@@ -21,6 +21,8 @@
- import dbus.service
- import dbus.mainloop.glib
-
-+import subprocess
-+
- from indicator_cpufreq import cpufreq
-
- class PermissionDeniedByPolicy(dbus.DBusException):
-@@ -42,6 +44,15 @@
- self._package_operation_in_progress = False
-
- @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
-+ in_signature='as',
-+ out_signature='',
-+ sender_keyword='sender',
-+ connection_keyword='conn')
-+ def SetThrottle(self, throttle, sender=None, conn=None):
-+ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setthrottle')
-+ error = subprocess.Popen(["/bin/sh", "throttle", throttle])
-+
-+ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
- in_signature='auu',
- out_signature='',
- sender_keyword='sender',
-@@ -61,6 +72,33 @@
- for cpu in cpus:
- error = cpufreq.modify_policy_governor(cpu, governor)
-
-+ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
-+ in_signature='as',
-+ out_signature='',
-+ sender_keyword='sender',
-+ connection_keyword='conn')
-+ def SetPSTurbo(self, psturbo, sender=None, conn=None):
-+ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setpsturbo')
-+ error = subprocess.Popen(["/bin/sh", "throttle", psturbo])
-+
-+ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
-+ in_signature='as',
-+ out_signature='',
-+ sender_keyword='sender',
-+ connection_keyword='conn')
-+ def SetHyperthreads(self, hyperthreads, sender=None, conn=None):
-+ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.sethyperthreads')
-+ error = subprocess.Popen(["/bin/sh", "throttle", hyperthreads])
-+
-+ @dbus.service.method(dbus_interface='com.ubuntu.IndicatorCpufreqSelector',
-+ in_signature='as',
-+ out_signature='',
-+ sender_keyword='sender',
-+ connection_keyword='conn')
-+ def SetGPUThrottle(self, gputhrottle, sender=None, conn=None):
-+ self._check_polkit_privilege(sender, conn, 'com.ubuntu.indicatorcpufreqselector.setgputhrottle')
-+ error = subprocess.Popen(["/bin/sh", "throttle", gputhrottle])
-+
- def _check_polkit_privilege(self, sender, conn, privilege):
- '''Verify that sender has a given PolicyKit privilege.
-
---- indicator-cpufreq/indicator_cpufreq/com.ubuntu.indicatorcpufreq.policy.in 2014-12-27 02:48:58.330816000 +0900
-+++ indicator-cpufreq/indicator_cpufreq/com.ubuntu.indicatorcpufreq.policy.in 2014-12-27 02:29:19.809678757 +0900
-@@ -13,13 +13,55 @@
- <vendor_url>https://launchpad.net/indicator-cpufreq</vendor_url>
- <icon_name>indicator-cpufreq</icon_name>
-
-+ <action id="com.ubuntu.indicatorcpufreqselector.setthrottle">
-+ <_description>Change device powersaving settings</_description>
-+ <_message>System policy prevents you from changing system throttle.</_message>
-+
-+ <defaults>
-+ <allow_inactive>no</allow_inactive>
-+ <allow_active>yes</allow_active>
-+ </defaults>
-+ </action>
-+
- <action id="com.ubuntu.indicatorcpufreqselector.setfrequencyscaling">
- <_description>Change CPU frequency scaling</_description>
- <_message>System policy prevents you from changing CPU frequency scaling.</_message>
-
- <defaults>
- <allow_inactive>no</allow_inactive>
-- <allow_active>auth_admin_keep</allow_active>
-+ <allow_active>yes</allow_active>
-+ </defaults>
-+ </action>
-+
-+ <action id="com.ubuntu.indicatorcpufreqselector.setpsturbo">
-+ <_description>Change Intel P-State Turbo settings</_description>
-+ <_message>System policy prevents you from changing P-State Turbo.</_message>
-+
-+ <defaults>
-+ <allow_inactive>no</allow_inactive>
-+ <allow_active>yes</allow_active>
-+ </defaults>
-+ </action>
-+
-+ <action id="com.ubuntu.indicatorcpufreqselector.sethyperthreads">
-+ <_description>Change hyperthreading settings</_description>
-+ <_message>System policy prevents you from changing hyperthreading.</_message>
-+
-+ <defaults>
-+ <allow_inactive>no</allow_inactive>
-+ <allow_active>yes</allow_active>
- </defaults>
- </action>
-+
-+ <action id="com.ubuntu.indicatorcpufreqselector.setgputhrottle">
-+ <_description>Change GPU throttle settings</_description>
-+ <_message>System policy prevents you from changing GPU throttle.</_message>
-+
-+ <defaults>
-+ <allow_inactive>no</allow_inactive>
-+ <allow_active>yes</allow_active>
-+ </defaults>
-+ </action>
-+
-+
- </policyconfig>
---- indicator-cpufreq/indicator_cpufreq/indicator.py 2015-09-10 14:46:45.814511000 +0900
-+++ indicator-cpufreq/indicator_cpufreq/indicator.py 2015-09-10 14:46:45.989929097 +0900
-@@ -29,6 +29,10 @@
- from gettext import gettext as _
- #gettext.textdomain('indicator-cpufreq')
-
-+
-+def readable_throttle(t):
-+ return t
-+
- def readable_frequency(f):
- # temp hack for properly displaying intel turbo mode (actual freq + 1000kHz)
- label = _("%s GHz") % locale.format(_("%.2f"), f / 1.0e6)
-@@ -50,6 +54,15 @@
- else:
- return g
-
-+def readable_psturbo(t):
-+ return t
-+
-+def readable_hyperthreads(h):
-+ return h
-+
-+def readable_gputhrottles(gt):
-+ return gt
-+
- class MyIndicator(object):
- def __init__(self, show_frequency=False):
- self.show_frequency = show_frequency
-@@ -71,28 +84,90 @@
- maxcpu += 1
- self.cpus = range(maxcpu)
-
-+ # throttle menu items
-+ throttles = ['full', 'cut']
-+ throtmenu = Gtk.Menu()
-+ throtm = Gtk.MenuItem("System Throttle")
-+ throtm.set_submenu(throtmenu)
-+ for toggle in throttles:
-+ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_throttle(toggle))
-+ group = menu_item.get_group()
-+ throtmenu.append(menu_item)
-+ menu_item.connect('activate', self.select_activated, 'throttle', toggle)
-+ self.select_items[toggle] = menu_item
-+ menu.append(throtm)
-+
-+ menu.append(Gtk.SeparatorMenuItem())
-+
- # frequency menu items
- #freqs = cpufreq.get_available_frequencies(self.cpus[0])
- freqs = reversed(sorted(set(cpufreq.get_available_frequencies(self.cpus[0]))))
-+ freqmenu = Gtk.Menu()
-+ freqm = Gtk.MenuItem("CPU Frequency")
-+ freqm.set_submenu(freqmenu)
- for freq in freqs:
- menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_frequency(freq))
- group = menu_item.get_group()
-- menu.append(menu_item)
-+ freqmenu.append(menu_item)
- menu_item.connect("activate", self.select_activated, 'frequency', freq)
- self.select_items[freq] = menu_item
--
-- menu.append(Gtk.SeparatorMenuItem())
-+ menu.append(freqm)
-
- # governor menu items
- governors = cpufreq.get_available_governors(self.cpus[0])
-+ govmenu = Gtk.Menu()
-+ govm = Gtk.MenuItem("CPU Governor")
-+ govm.set_submenu(govmenu)
- for governor in governors:
- if governor == 'userspace':
- continue
- menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_governor(governor))
- group = menu_item.get_group()
-- menu.append(menu_item)
-+ govmenu.append(menu_item)
- menu_item.connect('activate', self.select_activated, 'governor', governor)
- self.select_items[governor] = menu_item
-+ menu.append(govm)
-+
-+ # p-state turbo menu items
-+ psturbo = ['on', 'off']
-+ pstmenu = Gtk.Menu()
-+ pstm = Gtk.MenuItem("P-State Turbo")
-+ pstm.set_submenu(pstmenu)
-+ for toggle in psturbo:
-+ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_psturbo(toggle))
-+ group = menu_item.get_group()
-+ pstmenu.append(menu_item)
-+ menu_item.connect('activate', self.select_activated, 'psturbo', toggle)
-+ self.select_items[toggle] = menu_item
-+ menu.append(pstm)
-+
-+ # hyperthreading menu items
-+ hyperthreads = ['on', 'off']
-+ htmenu = Gtk.Menu()
-+ htm = Gtk.MenuItem("Hyperthreads")
-+ htm.set_submenu(htmenu)
-+ for toggle in hyperthreads:
-+ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_hyperthreads(toggle))
-+ group = menu_item.get_group()
-+ htmenu.append(menu_item)
-+ menu_item.connect('activate', self.select_activated, 'hyperthreads', toggle)
-+ self.select_items[toggle] = menu_item
-+ menu.append(htm)
-+
-+ menu.append(Gtk.SeparatorMenuItem())
-+
-+ # gpu runtime pm menu items
-+ gputhrottles = ['full', 'cut']
-+ gpumenu = Gtk.Menu()
-+ gpum = Gtk.MenuItem("GPU Throttle")
-+ gpum.set_submenu(gpumenu)
-+ for toggle in gputhrottles:
-+ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_gputhrottles(toggle))
-+ group = menu_item.get_group()
-+ gpumenu.append(menu_item)
-+ menu_item.connect('activate', self.select_activated, 'gputhrottle', toggle)
-+ self.select_items[toggle] = menu_item
-+ menu.append(gpum)
-
- menu.show_all()
- self.ind.set_menu(menu)
-@@ -134,9 +209,21 @@
- bus = dbus.SystemBus()
- proxy = bus.get_object("com.ubuntu.IndicatorCpufreqSelector", "/Selector", introspect=False)
- cpus = [dbus.UInt32(cpu) for cpu in self.cpus]
-- if select == 'frequency':
-+ if select == 'throttle':
-+ proxy.SetThrottle(value,
-+ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
-+ elif select == 'frequency':
- proxy.SetFrequency(cpus, dbus.UInt32(value),
- dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
-+ elif select == 'psturbo':
-+ proxy.SetPSTurbo("turbo-" + value,
-+ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
-+ elif select == 'hyperthreads':
-+ proxy.SetHyperthreads("ht-" + value,
-+ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
-+ elif select == 'gputhrottle':
-+ proxy.SetGPUThrottle("gpu-" + value,
-+ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
- else:
- proxy.SetGovernor(cpus, value,
- dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
diff --git a/indicator.py.patch b/indicator.py.patch
new file mode 100644
index 000000000000..a11151568c82
--- /dev/null
+++ b/indicator.py.patch
@@ -0,0 +1,208 @@
+=== modified file 'indicator_cpufreq/indicator.py'
+--- indicator_cpufreq/indicator.py 2013-02-20 03:47:48 +0000
++++ indicator_cpufreq/indicator.py 2017-04-04 16:49:04 +0000
+@@ -23,12 +23,15 @@
+ import locale
+ import dbus
+
+-from indicator_cpufreq import cpufreq
+-
+ import gettext
+ from gettext import gettext as _
+ #gettext.textdomain('indicator-cpufreq')
+
++import glob
++
++def readable_throttle(t):
++ return t
++
+ def readable_frequency(f):
+ # temp hack for properly displaying intel turbo mode (actual freq + 1000kHz)
+ label = _("%s GHz") % locale.format(_("%.2f"), f / 1.0e6)
+@@ -37,9 +40,9 @@
+ return label
+
+ governor_names = {
++ 'schedutil': _("Scheduler"),
+ 'conservative': _("Conservative"),
+ 'ondemand': _("Ondemand"),
+- #'userspace': _("Userspace"),
+ 'powersave': _("Powersave"),
+ 'performance': _("Performance"),
+ }
+@@ -50,6 +53,15 @@
+ else:
+ return g
+
++def readable_psturbo(t):
++ return t
++
++def readable_hyperthreads(h):
++ return h
++
++def readable_gputhrottles(gt):
++ return gt
++
+ class MyIndicator(object):
+ def __init__(self, show_frequency=False):
+ self.show_frequency = show_frequency
+@@ -66,33 +78,81 @@
+ self.select_items = {}
+ group = []
+
+- maxcpu = 0
+- while cpufreq.cpu_exists(maxcpu) == 0:
+- maxcpu += 1
+- self.cpus = range(maxcpu)
+-
+- # frequency menu items
+- #freqs = cpufreq.get_available_frequencies(self.cpus[0])
+- freqs = reversed(sorted(set(cpufreq.get_available_frequencies(self.cpus[0]))))
+- for freq in freqs:
+- menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_frequency(freq))
++ # throttle menu items
++ throttles = ['full', 'cut']
++ throtmenu = Gtk.Menu()
++ throtm = Gtk.MenuItem("System Throttle")
++ throtm.set_submenu(throtmenu)
++ for toggle in throttles:
++ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_throttle(toggle))
+ group = menu_item.get_group()
+- menu.append(menu_item)
+- menu_item.connect("activate", self.select_activated, 'frequency', freq)
+- self.select_items[freq] = menu_item
++ throtmenu.append(menu_item)
++ menu_item.connect('activate', self.select_activated, 'throttle', toggle)
++ self.select_items[toggle] = menu_item
++ menu.append(throtm)
+
+ menu.append(Gtk.SeparatorMenuItem())
+
+ # governor menu items
+- governors = cpufreq.get_available_governors(self.cpus[0])
+- for governor in governors:
+- if governor == 'userspace':
+- continue
++ govFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors")
++ governors = govFile.readline().strip("\n")
++ govList = governors.split(" ")
++ govmenu = Gtk.Menu()
++ govm = Gtk.MenuItem("CPU Governor")
++ govm.set_submenu(govmenu)
++ for governor in govList:
++ if governor == 'performance':
++ toggle = 'full'
++ else:
++ toggle = 'cut'
+ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_governor(governor))
+ group = menu_item.get_group()
+- menu.append(menu_item)
+- menu_item.connect('activate', self.select_activated, 'governor', governor)
++ govmenu.append(menu_item)
++ menu_item.connect('activate', self.select_activated, 'governor', toggle)
+ self.select_items[governor] = menu_item
++ menu.append(govm)
++ govFile.close
++
++ # p-state turbo menu items
++ psturbo = ['on', 'off']
++ pstmenu = Gtk.Menu()
++ pstm = Gtk.MenuItem("P-State Turbo")
++ pstm.set_submenu(pstmenu)
++ for toggle in psturbo:
++ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_psturbo(toggle))
++ group = menu_item.get_group()
++ pstmenu.append(menu_item)
++ menu_item.connect('activate', self.select_activated, 'psturbo', toggle)
++ self.select_items[toggle] = menu_item
++ menu.append(pstm)
++
++ # hyperthreading menu items
++ hyperthreads = ['on', 'off']
++ htmenu = Gtk.Menu()
++ htm = Gtk.MenuItem("Hyperthreads")
++ htm.set_submenu(htmenu)
++ for toggle in hyperthreads:
++ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_hyperthreads(toggle))
++ group = menu_item.get_group()
++ htmenu.append(menu_item)
++ menu_item.connect('activate', self.select_activated, 'hyperthreads', toggle)
++ self.select_items[toggle] = menu_item
++ menu.append(htm)
++
++ menu.append(Gtk.SeparatorMenuItem())
++
++ # gpu runtime pm menu items
++ gputhrottles = ['full', 'cut']
++ gpumenu = Gtk.Menu()
++ gpum = Gtk.MenuItem("GPU Throttle")
++ gpum.set_submenu(gpumenu)
++ for toggle in gputhrottles:
++ menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_gputhrottles(toggle))
++ group = menu_item.get_group()
++ gpumenu.append(menu_item)
++ menu_item.connect('activate', self.select_activated, 'gputhrottle', toggle)
++ self.select_items[toggle] = menu_item
++ menu.append(gpum)
+
+ menu.show_all()
+ self.ind.set_menu(menu)
+@@ -107,13 +167,29 @@
+ for i in self.select_items.values():
+ i.handler_block_by_func(self.select_activated)
+
+- fmin, fmax, governor = cpufreq.get_policy(self.cpus[0])
++ govFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_governor", 'r')
++ governor = govFile.readline().strip("\n")
++ fmnFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq", 'r')
++ fmin = int(fmnFile.readline().strip("\n"))
++ fmxFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq", 'r')
++ fmax = int(fmxFile.readline().strip("\n"))
+ # use the highest freq among cores for display
+- freq = max([cpufreq.get_freq_kernel(cpu) for cpu in self.cpus])
++ freq_list = glob.glob('/sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq')
++ freqs = []
++ for cur_freq in freq_list:
++ f = open(cur_freq, 'r')
++ freqs.append(int(f.readline().strip("\n")))
++ f.close
++
++ freq = max(freqs)
+
+ ratio = min([25, 50, 75, 100], key=lambda x: abs((fmax - fmin) * x / 100.0 - (freq - fmin)))
+ if freq < fmax and ratio == 100:
+ ratio = 75
++
++ govFile.close
++ fmnFile.close
++ fmxFile.close
+
+ #self.set_icon(get_data_file('media', 'indicator-cpufreq-%d.png' % ratio))
+ self.ind.set_icon('indicator-cpufreq-%d' % ratio)
+@@ -133,12 +209,21 @@
+ if menuitem.get_active():
+ bus = dbus.SystemBus()
+ proxy = bus.get_object("com.ubuntu.IndicatorCpufreqSelector", "/Selector", introspect=False)
+- cpus = [dbus.UInt32(cpu) for cpu in self.cpus]
+- if select == 'frequency':
+- proxy.SetFrequency(cpus, dbus.UInt32(value),
++ #cpus = [dbus.UInt32(cpu) for cpu in self.cpus]
++ if select == 'throttle':
++ proxy.SetThrottle(value,
++ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
++ elif select == 'psturbo':
++ proxy.SetPSTurbo("turbo-" + value,
++ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
++ elif select == 'hyperthreads':
++ proxy.SetHyperthreads("ht-" + value,
++ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
++ elif select == 'gputhrottle':
++ proxy.SetGPUThrottle("gpu-" + value,
+ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
+ else:
+- proxy.SetGovernor(cpus, value,
++ proxy.SetGovernor("gov-" + value,
+ dbus_interface='com.ubuntu.IndicatorCpufreqSelector')
+
+ def can_set(self):
+
diff --git a/no-cpufreq.patch b/no-cpufreq.patch
new file mode 100644
index 000000000000..794491624578
--- /dev/null
+++ b/no-cpufreq.patch
@@ -0,0 +1,211 @@
+--- indicator_cpufreq/cpufreq.py 2017-04-05 01:11:16.147391000 +0900
++++ /dev/null 2017-04-05 01:32:18.574219424 +0900
+@@ -1,208 +0,0 @@
+-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
+-### BEGIN LICENSE
+-# Copyright (C) 2010 Artem Popov <artfwo@gmail.com>
+-# This program is free software: you can redistribute it and/or modify it
+-# under the terms of the GNU General Public License version 3, as published
+-# by the Free Software Foundation.
+-#
+-# This program is distributed in the hope that it will be useful, but
+-# WITHOUT ANY WARRANTY; without even the implied warranties of
+-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+-# PURPOSE. See the GNU General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License along
+-# with this program. If not, see <http://www.gnu.org/licenses/>.
+-### END LICENSE
+-
+-from ctypes import *
+-from ctypes.util import find_library
+-
+-_libcpufreq = cdll.LoadLibrary(find_library("cpufreq"))
+-
+-class _cpufreq_policy(Structure):
+- _fields_ = [
+- ("min", c_ulong),
+- ("max", c_ulong),
+- ("governor", c_char_p)]
+-
+-class _cpufreq_available_governors(Structure):
+- pass
+-_cpufreq_available_governors._fields_ = [
+- ("governor", c_char_p),
+- ("next", POINTER(_cpufreq_available_governors)),
+- ("first", POINTER(_cpufreq_available_governors))]
+-
+-class _cpufreq_available_frequencies(Structure):
+- pass
+-_cpufreq_available_frequencies._fields_ = [
+- ("frequency", c_ulong),
+- ("next", POINTER(_cpufreq_available_frequencies)),
+- ("first", POINTER(_cpufreq_available_frequencies))]
+-
+-class _cpufreq_affected_cpus(Structure):
+- pass
+-_cpufreq_affected_cpus._fields_ = [
+- ("cpu", c_uint),
+- ("next", POINTER(_cpufreq_affected_cpus)),
+- ("first", POINTER(_cpufreq_affected_cpus))]
+-
+-class _cpufreq_stats(Structure):
+- pass
+-_cpufreq_stats._fields_ = [
+- ("frequency", c_ulong),
+- ("time_in_state", c_ulonglong),
+- ("next", POINTER(_cpufreq_stats)),
+- ("first", POINTER(_cpufreq_stats))]
+-
+-###############################################################################
+-
+-_libcpufreq.cpufreq_cpu_exists.argtypes = [c_uint]
+-_libcpufreq.cpufreq_cpu_exists.restype = c_int
+-
+-_libcpufreq.cpufreq_get_freq_kernel.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_freq_kernel.restype = c_ulong
+-
+-_libcpufreq.cpufreq_get_freq_hardware.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_freq_hardware.restype = c_ulong
+-
+-_libcpufreq.cpufreq_get_transition_latency.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_transition_latency.restype = c_ulong
+-
+-_libcpufreq.cpufreq_get_hardware_limits.argtypes = [c_uint, POINTER(c_ulong), POINTER(c_ulong)]
+-_libcpufreq.cpufreq_get_hardware_limits.restype = c_int
+-
+-_libcpufreq.cpufreq_get_driver.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_driver.restype = c_char_p
+-#extern void cpufreq_put_driver(char * ptr);
+-
+-_libcpufreq.cpufreq_get_policy.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_policy.restype = POINTER(_cpufreq_policy)
+-#extern void cpufreq_put_policy(struct cpufreq_policy *policy);
+-
+-_libcpufreq.cpufreq_get_available_governors.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_available_governors.restype = POINTER(_cpufreq_available_governors)
+-#extern void cpufreq_put_available_governors(struct _cpufreq_available_governors *first);
+-
+-_libcpufreq.cpufreq_get_available_frequencies.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_available_frequencies.restype = POINTER(_cpufreq_available_frequencies)
+-#extern void cpufreq_put_available_frequencies(struct _cpufreq_available_frequencies *first);
+-
+-_libcpufreq.cpufreq_get_affected_cpus.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_affected_cpus.restype = POINTER(_cpufreq_affected_cpus)
+-#extern void cpufreq_put_affected_cpus(struct _cpufreq_affected_cpus *first);
+-
+-_libcpufreq.cpufreq_get_related_cpus.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_related_cpus.restype = POINTER(_cpufreq_affected_cpus)
+-#extern void cpufreq_put_related_cpus(struct _cpufreq_affected_cpus *first);
+-
+-_libcpufreq.cpufreq_get_stats.argtypes = [c_uint, POINTER(c_ulonglong)]
+-_libcpufreq.cpufreq_get_stats.restype = POINTER(_cpufreq_stats)
+-#extern void cpufreq_put_stats(struct _cpufreq_stats *stats);
+-
+-_libcpufreq.cpufreq_get_transitions.argtypes = [c_uint]
+-_libcpufreq.cpufreq_get_transitions.restype = c_ulong
+-
+-_libcpufreq.cpufreq_set_policy.argtypes = [c_uint, POINTER(_cpufreq_policy)]
+-_libcpufreq.cpufreq_set_policy.restype = c_int
+-
+-_libcpufreq.cpufreq_modify_policy_min.argtypes = [c_uint, c_ulong]
+-_libcpufreq.cpufreq_modify_policy_min.restype = c_int
+-
+-_libcpufreq.cpufreq_modify_policy_max.argtypes = [c_uint, c_ulong]
+-_libcpufreq.cpufreq_modify_policy_max.restype = c_int
+-
+-_libcpufreq.cpufreq_modify_policy_governor.argtypes = [c_uint, c_char_p]
+-_libcpufreq.cpufreq_modify_policy_governor.restype = c_int
+-
+-_libcpufreq.cpufreq_set_frequency.argtypes = [c_uint, c_ulong]
+-_libcpufreq.cpufreq_set_frequency.restype = c_int
+-
+-def cpu_exists(cpu):
+- return _libcpufreq.cpufreq_cpu_exists(cpu)
+-
+-def get_freq_kernel(cpu):
+- return _libcpufreq.cpufreq_get_freq_kernel(cpu)
+-
+-def get_freq_hardware(cpu):
+- return _libcpufreq.cpufreq_get_freq_hardware(cpu)
+-
+-def get_transition_latency(cpu):
+- return _libcpufreq.cpufreq_get_transition_latency(cpu)
+-
+-def get_hardware_limits(cpu):
+- min = c_ulong()
+- max = c_ulong()
+- _libcpufreq.cpufreq_get_hardware_limits(cpu, byref(min), byref(max))
+- return (min.value, max.value)
+-
+-def get_driver(cpu):
+- return _libcpufreq.cpufreq_get_driver(cpu).decode()
+-
+-def get_policy(cpu):
+- p = _libcpufreq.cpufreq_get_policy(cpu)
+- policy = (p.contents.min, p.contents.max, p.contents.governor.decode())
+- _libcpufreq.cpufreq_put_policy(p)
+- return policy
+-
+-def _marshall_structs(first, field, decode=False):
+- values = []
+- p = first
+- while p:
+- if decode:
+- values.append(getattr(p.contents, field).decode())
+- else:
+- values.append(getattr(p.contents, field))
+- p = p.contents.next
+- return values
+-
+-def get_available_governors(cpu):
+- structs = _libcpufreq.cpufreq_get_available_governors(cpu)
+- values = _marshall_structs(structs, 'governor', decode=True)
+- _libcpufreq.cpufreq_put_available_governors(structs)
+- return values
+-
+-def get_available_frequencies(cpu):
+- structs = _libcpufreq.cpufreq_get_available_frequencies(cpu)
+- values = _marshall_structs(structs, 'frequency')
+- _libcpufreq.cpufreq_put_available_frequencies(structs)
+- return values
+-
+-def get_affected_cpus(cpu):
+- structs = _libcpufreq.cpufreq_get_affected_cpus(cpu)
+- values = _marshall_structs(structs, 'cpu')
+- _libcpufreq.cpufreq_put_affected_cpus(structs)
+- return values
+-
+-def get_related_cpus(cpu):
+- structs = _libcpufreq.cpufreq_get_related_cpus(cpu)
+- values = _marshall_structs(structs, 'cpu')
+- _libcpufreq.cpufreq_put_related_cpus(structs)
+- return values
+-
+-def get_stats(cpu):
+- total_time = c_ulonglong()
+- p = _libcpufreq.cpufreq_get_stats(cpu, byref(total_time))
+- stats = []
+- while p:
+- stats.append((p.contents.frequency, p.contents.time_in_state))
+- p = p.contents.next
+- _libcpufreq.cpufreq_put_stats(p)
+- return total_time.value, stats
+-
+-def get_transitions(cpu):
+- return _libcpufreq.cpufreq_get_transitions(cpu)
+-
+-def set_policy(cpu, min, max, governor):
+- return _libcpufreq.cpufreq_set_policy(cpu, _cpufreq_policy(min, max, governor))
+-
+-def modify_policy_min(cpu, min_freq):
+- return _libcpufreq.cpufreq_modify_policy_min(cpu, min_freq)
+-
+-def modify_policy_min(cpu, max_freq):
+- return _libcpufreq.cpufreq_modify_policy_max(cpu, max_freq)
+-
+-def modify_policy_governor(cpu, governor):
+- return _libcpufreq.cpufreq_modify_policy_governor(cpu, governor.encode())
+-
+-def set_frequency(cpu, target_frequency):
+- return _libcpufreq.cpufreq_set_frequency(cpu, target_frequency)
diff --git a/schedutil.patch b/schedutil.patch
deleted file mode 100644
index 7bd78a875c5a..000000000000
--- a/schedutil.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/indicator-cpufreq/indicator_cpufreq/indicator.py 2016-10-23 20:53:24.000000000 +0900
-+++ src/indicator-cpufreq/indicator_cpufreq/indicator.py 2017-02-15 21:58:39.846113600 +0900
-@@ -46,6 +46,7 @@
- #'userspace': _("Userspace"),
- 'powersave': _("Powersave"),
- 'performance': _("Performance"),
-+ 'schedutil': _("Scheduler"),
- }
-
- def readable_governor(g):
diff --git a/use-sysfs.patch b/use-sysfs.patch
deleted file mode 100644
index 9b06a5071e0e..000000000000
--- a/use-sysfs.patch
+++ /dev/null
@@ -1,90 +0,0 @@
---- src/indicator-cpufreq/indicator_cpufreq/indicator.py 2016-10-23 20:53:24.066983494 +0900
-+++ src/indicator-cpufreq/indicator_cpufreq/indicator.py 2017-02-16 01:09:11.625695652 +0900
-@@ -29,6 +29,7 @@
- from gettext import gettext as _
- #gettext.textdomain('indicator-cpufreq')
-
-+import glob
-
- def readable_throttle(t):
- return t
-@@ -101,24 +103,26 @@
-
- # frequency menu items
- #freqs = cpufreq.get_available_frequencies(self.cpus[0])
-- freqs = reversed(sorted(set(cpufreq.get_available_frequencies(self.cpus[0]))))
-- freqmenu = Gtk.Menu()
-- freqm = Gtk.MenuItem("CPU Frequency")
-- freqm.set_submenu(freqmenu)
-- for freq in freqs:
-- menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_frequency(freq))
-- group = menu_item.get_group()
-- freqmenu.append(menu_item)
-- menu_item.connect("activate", self.select_activated, 'frequency', freq)
-- self.select_items[freq] = menu_item
-- menu.append(freqm)
-+ #freqs = reversed(sorted(set(cpufreq.get_available_frequencies(self.cpus[0]))))
-+ #freqmenu = Gtk.Menu()
-+ #freqm = Gtk.MenuItem("CPU Frequency")
-+ #freqm.set_submenu(freqmenu)
-+ #for freq in freqs:
-+ # menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_frequency(freq))
-+ # group = menu_item.get_group()
-+ # freqmenu.append(menu_item)
-+ # menu_item.connect("activate", self.select_activated, 'frequency', freq)
-+ # self.select_items[freq] = menu_item
-+ #menu.append(freqm)
-
- # governor menu items
-- governors = cpufreq.get_available_governors(self.cpus[0])
-+ govFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors")
-+ governors = govFile.readline().strip("\n")
-+ govList = governors.split(" ")
- govmenu = Gtk.Menu()
- govm = Gtk.MenuItem("CPU Governor")
- govm.set_submenu(govmenu)
-- for governor in governors:
-+ for governor in govList:
- if governor == 'userspace':
- continue
- menu_item = Gtk.RadioMenuItem.new_with_label(group, readable_governor(governor))
-@@ -127,6 +131,7 @@
- menu_item.connect('activate', self.select_activated, 'governor', governor)
- self.select_items[governor] = menu_item
- menu.append(govm)
-+ govFile.close
-
- # p-state turbo menu items
- psturbo = ['on', 'off']
-@@ -182,13 +187,29 @@
- for i in self.select_items.values():
- i.handler_block_by_func(self.select_activated)
-
-- fmin, fmax, governor = cpufreq.get_policy(self.cpus[0])
-+ govFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_governor", 'r')
-+ governor = govFile.readline().strip("\n")
-+ fmnFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq", 'r')
-+ fmin = int(fmnFile.readline().strip("\n"))
-+ fmxFile = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq", 'r')
-+ fmax = int(fmxFile.readline().strip("\n"))
- # use the highest freq among cores for display
-- freq = max([cpufreq.get_freq_kernel(cpu) for cpu in self.cpus])
-+ freq_list = glob.glob('/sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq')
-+ freqs = []
-+ for cur_freq in freq_list:
-+ f = open(cur_freq, 'r')
-+ freqs.append(int(f.readline().strip("\n")))
-+ f.close
-+
-+ freq = max(freqs)
-
- ratio = min([25, 50, 75, 100], key=lambda x: abs((fmax - fmin) * x / 100.0 - (freq - fmin)))
- if freq < fmax and ratio == 100:
- ratio = 75
-+
-+ govFile.close
-+ fmnFile.close
-+ fmxFile.close
-
- #self.set_icon(get_data_file('media', 'indicator-cpufreq-%d.png' % ratio))
- self.ind.set_icon('indicator-cpufreq-%d' % ratio)