Currently powertop uses the /etc/boardname to retrive the boardname
as well as set the global_fixed_parameters and global_power_override
global variables. /etc/boardname is a meego specific feature and not
present in Android. This patch enables powertop to get the board name
using getprop system call in case of Android devices and creates a
file for saved parameters with boardname extension at /data/local/powertop
directory
---
main.cpp | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/main.cpp b/main.cpp
index 7861c37..700f9af 100644
--- a/main.cpp
+++ b/main.cpp
@@ -199,12 +199,33 @@ static void load_board_params()
string boardname;
char filename[4096];
- boardname = read_sysfs_string("/etc/boardname");
+ if (access("/etc/boardname", R_OK ) == 0){
+ boardname = read_sysfs_string("/etc/boardname");
- if (boardname.length() < 2)
- return;
+ if (boardname.length() < 2)
+ return;
+
+ sprintf(filename,
"/var/cache/powertop/saved_parameters.powertop.%s", boardname.c_str());
+ }
+ else if (access("/data", R_OK ) == 0){
+ FILE *fp;
+ char data[512];
+ fp = popen("getprop ro.build.product","r");
+
+ if(!fp){
+ fprintf(stderr, "Could not open pipe for output.\n");
+ return;
+ }
- sprintf(filename, "/var/cache/powertop/saved_parameters.powertop.%s",
boardname.c_str());
+ if (fgets(data, 512 , fp)== NULL)
+ return;
+
+ pclose(fp);
+
+ sprintf(filename,
"/data/local/powertop/saved_parameters.powertop.%s", data);
+ }
+ else
+ return;
if (access(filename, R_OK))
return;
--
1.7.0.4
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
Power mailing list
[email protected]
https://bughost.org/mailman/listinfo/power