mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
79 lines
2.1 KiB
Diff
79 lines
2.1 KiB
Diff
|
diff -aur acpitool-0.4.7.pristine/src/acpitool.cpp acpitool-0.4.7.new/src/acpitool.cpp
|
||
|
--- acpitool-0.4.7.pristine/src/acpitool.cpp 2007-02-06 21:03:02.000000000 +0100
|
||
|
+++ acpitool-0.4.7.new/src/acpitool.cpp 2007-05-15 13:25:26.000000000 +0200
|
||
|
@@ -56,13 +56,14 @@
|
||
|
filename = "/proc/acpi/info";
|
||
|
|
||
|
file_in.open(filename);
|
||
|
- if (!file_in)
|
||
|
- return 0;
|
||
|
- else
|
||
|
- {
|
||
|
- file_in.close();
|
||
|
- return 1;
|
||
|
+ if(!file_in.is_open()) {
|
||
|
+ filename = "/sys/module/acpi/parameters/acpica_version";
|
||
|
+ file_in.open(filename);
|
||
|
}
|
||
|
+ if(!file_in.is_open()) return 0;
|
||
|
+
|
||
|
+ file_in.close();
|
||
|
+ return 1;
|
||
|
}
|
||
|
|
||
|
int Print_ACPI_Info(int show_ac, int show_therm, int show_trip, int show_fan, int show_batteries, int show_empty, int show_version, int show_cpu, int show_wake, int e_set, int info_level, int verbose)
|
||
|
@@ -98,26 +99,38 @@
|
||
|
filename = "/proc/acpi/info";
|
||
|
|
||
|
file_in.open(filename);
|
||
|
- if (!file_in)
|
||
|
- {
|
||
|
- if(!verbose)
|
||
|
- {
|
||
|
- strcpy(c, "<n.a>");
|
||
|
- return 0;
|
||
|
- }
|
||
|
- else
|
||
|
- {
|
||
|
- cout<<" Could not open file : "<<filename<<endl;
|
||
|
- cout<<" Make sure your kernel has ACPI support enabled."<<endl;
|
||
|
- return -1;
|
||
|
- }
|
||
|
+ if(!file_in.is_open()) {
|
||
|
+ filename = "/sys/module/acpi/parameters/acpica_version";
|
||
|
+ file_in.open(filename);
|
||
|
+ }
|
||
|
+ if(!file_in.is_open()) {
|
||
|
+ // failure
|
||
|
+ if(!verbose) {
|
||
|
+ strcpy(c, "<n.a>");
|
||
|
+ return 0;
|
||
|
+ }
|
||
|
+ else {
|
||
|
+ cout<<" Could not open file : "<<filename<<endl;
|
||
|
+ cout<<" Make sure your kernel has ACPI support enabled."<<endl;
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
file_in.getline(str, 50);
|
||
|
file_in.close();
|
||
|
|
||
|
- /* version takes 8 chars starting from pos 26 */
|
||
|
- strncpy(c, str+25,8);
|
||
|
+ // Find a better way to respect new ACPI behavior for
|
||
|
+ // kernel >2.6.20 !
|
||
|
+ // But hey, this is just a dirty patch
|
||
|
+ if (strncmp(filename,"/sys",4)==0)
|
||
|
+ {
|
||
|
+ /* version takes 8 chars */
|
||
|
+ strncpy(c, str,8);
|
||
|
+ }
|
||
|
+ else {
|
||
|
+ /* version takes 8 chars starting from pos 26 */
|
||
|
+ strncpy(c, str+25, 8);
|
||
|
+ }
|
||
|
|
||
|
return 0;
|
||
|
}
|