added current governor check
This commit is contained in:
parent
d880c794b9
commit
a380465707
|
@ -5,7 +5,18 @@
|
|||
#define SETSPDPATH "/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed"
|
||||
#define CURTEMPPATH "/sys/devices/virtual/thermal/thermal_zone0/temp"
|
||||
|
||||
void getfilec(FILE *file, char arr[]){
|
||||
int comparestrings(char *a, char *b){
|
||||
int c = 0;
|
||||
while(a[c]!='\0' && b[c]!='\0'){
|
||||
if(a[c] != b[c]){
|
||||
return 1;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getfilec(FILE *file, char arr[]){
|
||||
int c, i;
|
||||
i=0;
|
||||
while((c=fgetc(file)) != EOF){
|
||||
|
@ -13,10 +24,17 @@ void getfilec(FILE *file, char arr[]){
|
|||
i++;
|
||||
}
|
||||
arr[i]='\0';
|
||||
return i;
|
||||
}
|
||||
|
||||
int main(){
|
||||
char gov[20];
|
||||
FILE *govfile = fopen(CURGOV, "r");
|
||||
getfilec(govfile, gov);
|
||||
if (comparestrings(gov, "userspace\n") != 0){
|
||||
printf("error: userspace governor not set\n");
|
||||
return 1;
|
||||
}
|
||||
FILE *freqsfile = fopen(FREQS, "r");
|
||||
FILE *curmaxfile = fopen(MAXSPDPATH, "r");
|
||||
FILE *setspeedfile = fopen(SETSPDPATH, "r");
|
||||
|
|
Loading…
Reference in New Issue