summarylogtreecommitdiffstats
path: root/ibam-0.5.2-debian-sysfs-lenovo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'ibam-0.5.2-debian-sysfs-lenovo.patch')
-rw-r--r--ibam-0.5.2-debian-sysfs-lenovo.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/ibam-0.5.2-debian-sysfs-lenovo.patch b/ibam-0.5.2-debian-sysfs-lenovo.patch
new file mode 100644
index 000000000000..1da897f8897f
--- /dev/null
+++ b/ibam-0.5.2-debian-sysfs-lenovo.patch
@@ -0,0 +1,76 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 05_sysfs_lenovo.dpatch by Martin Wuertele <maxx@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: add lenovo sysfs detection
+
+@DPATCH@
+
+--- ibam-0.5.2/ibam.inl.orig 2011-02-15 21:42:39.000000000 +0100
++++ ibam-0.5.2/ibam.inl 2011-02-15 21:41:08.000000000 +0100
+@@ -540,6 +540,7 @@
+
+ if(present)
+ {
++ // try charge_full
+ in.open((((Path)+battery_entry->d_name)+"/charge_full").c_str());
+ if(!in.fail())
+ {
+@@ -547,10 +548,19 @@
+ total_capacity+=capacity;
+ }
+ in.close();
++ // try energy_full
++ in.open((((Path)+battery_entry->d_name)+"/energy_full").c_str());
++ if(!in.fail())
++ {
++ in>>capacity;
++ total_capacity+=capacity;
++ }
++ in.close();
+ }
+
+ if(present && capacity)
+ {
++ // try charge_now
+ in.open((((Path)+battery_entry->d_name)+"/charge_now").c_str());
+ if(!in.fail())
+ {
+@@ -558,10 +568,19 @@
+ total_remain+=remain;
+ }
+ in.close();
+- }
++ // try energy_now
++ in.open((((Path)+battery_entry->d_name)+"/energy_now").c_str());
++ if(!in.fail())
++ {
++ in>>remain;
++ total_remain+=remain;
++ }
++ in.close();
++ }
+
+ if(present && capacity)
+ {
++ // try current_now
+ in.open((((Path)+battery_entry->d_name)+"/current_now").c_str());
+ if(!in.fail())
+ {
+@@ -569,7 +588,15 @@
+ total_rate+=rate;
+ }
+ in.close();
+- }
++ // try energy_now
++ in.open((((Path)+battery_entry->d_name)+"/energy_now").c_str());
++ if(!in.fail())
++ {
++ in>>rate;
++ total_rate+=rate;
++ }
++ in.close();
++ }
+
+ if(present && capacity)
+ {