summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorkyak2015-08-11 17:46:04 +0300
committerkyak2015-08-11 17:46:04 +0300
commitfc43cc384fe315195645d2f84072294f7389c8e5 (patch)
tree8c124bbb3f50ef7a59ddfbfd51f8904adafe293c
downloadaur-fc43cc384fe315195645d2f84072294f7389c8e5.tar.gz
Initial import
-rw-r--r--.SRCINFO20
-rw-r--r--0001-Use-dynamic-structures-instead-of-predefined-ones.patch70
-rw-r--r--PKGBUILD35
-rw-r--r--linux-3.0.patch18
-rw-r--r--sysfs-battery.patch52
5 files changed, 195 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..6923dea33678
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,20 @@
+pkgbase = acpitool
+ pkgdesc = ACPI client - replacement for apm tool
+ pkgver = 0.5.1
+ pkgrel = 6
+ url = http://sourceforge.net/projects/acpitool/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ depends = gcc-libs
+ source = http://downloads.sourceforge.net/sourceforge/acpitool/acpitool-0.5.1.tar.bz2
+ source = linux-3.0.patch
+ source = sysfs-battery.patch
+ source = 0001-Use-dynamic-structures-instead-of-predefined-ones.patch
+ md5sums = 9e4ec55201be0be71ffbc56d38b42b57
+ md5sums = eb149edb32be6cdf20a7d16beb3e9f70
+ md5sums = 969fc4929cc215756db27168646c2b7a
+ md5sums = e5baf736eac5b030355533782660c92b
+
+pkgname = acpitool
+
diff --git a/0001-Use-dynamic-structures-instead-of-predefined-ones.patch b/0001-Use-dynamic-structures-instead-of-predefined-ones.patch
new file mode 100644
index 000000000000..b36d7306bddf
--- /dev/null
+++ b/0001-Use-dynamic-structures-instead-of-predefined-ones.patch
@@ -0,0 +1,70 @@
+From 3a87a4132667f78fc85c54ad89992bbdd02d1e55 Mon Sep 17 00:00:00 2001
+From: Carlos Alberto Lopez Perez <clopez@igalia.com>
+Date: Thu, 6 Oct 2011 03:12:55 +0200
+Subject: [PATCH] Use dynamic structures instead of predefined ones
+
+ * The file /proc/acpi/wakeup can have much more than 25 entries.
+ In my computer (Dell E6420) I have 27 entries.
+ So instead of using an array of [x] entries better use dynamic
+ vectors and push the new entries when a new line from the file
+ is read.
+
+ * The name of the device is not ever 4 characters. For example I
+ have a device called "LID" which is 3 characters long.
+ Instead of using a fixed size for the device we split the line
+ on the first tab (\t) and use the first part.
+---
+ src/acpitool.cpp | 23 +++++++++++------------
+ 1 files changed, 11 insertions(+), 12 deletions(-)
+
+diff --git a/src/acpitool.cpp b/src/acpitool.cpp
+index 2a610a5..71e01d7 100644
+--- a/src/acpitool.cpp
++++ b/src/acpitool.cpp
+@@ -460,16 +460,14 @@ int Show_WakeUp_Devices(int verbose)
+
+ int Toggle_WakeUp_Device(const int Device, int verbose)
+ {
+- ifstream file_in;
+ ofstream file_out;
+- char *filename, str[50];
+- int index = 1;
+- char Name[25][5]; // 25 should be enough I guess, I have only 9 so far //
+-
++ char *filename; string str;
++ int index = 1; int charindex = 0;
++ std::vector <std::string> Name(index); // Never is enough, use dynamic structures //
+ filename = "/proc/acpi/wakeup";
+
+- file_in.open(filename);
+- if (!file_in)
++ ifstream file_in(filename, ifstream::in);
++ if (!file_in.good()) // if opening is not successful
+ {
+ if(!verbose)
+ {
+@@ -484,14 +482,15 @@ int Toggle_WakeUp_Device(const int Device, int verbose)
+ }
+ }
+
+- file_in.getline(str, 50); // first line are just headers //
++ getline(file_in, str); // first line are just headers //
+ while(!file_in.eof()) // count all devices and store their names//
+ {
+- file_in.getline(str, 50);
+- if(strlen(str)!=0) // avoid empty last line //
++ getline(file_in, str);
++ if( str.length() != 0 ) // avoid empty last line //
+ {
+- memset(Name[index], '\0', 5);
+- strncpy(Name[index], str, 4);
++ charindex = 0; // reset to zero
++ while ( (str[++charindex]!='\t') ); // stop on first tab and get the array index
++ Name.push_back(str.substr(0,charindex)); // Push the name into the vector
+ index++;
+ }
+ }
+--
+1.7.5.4
+
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..88652ccc22a5
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,35 @@
+# Maintainer: Igor Ramos Tiburcio <irtigor@yahoo.com.br>
+# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Gerhard Brauer <gerhard.brauer@web.de>
+# Contributor: Milosz Piglas <archeofuture@gmail.com>
+
+pkgname=acpitool
+pkgver=0.5.1
+pkgrel=6
+pkgdesc="ACPI client - replacement for apm tool"
+url="http://sourceforge.net/projects/acpitool/"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('gcc-libs')
+source=(http://downloads.sourceforge.net/sourceforge/acpitool/acpitool-$pkgver.tar.bz2
+ linux-3.0.patch
+ sysfs-battery.patch
+ 0001-Use-dynamic-structures-instead-of-predefined-ones.patch)
+md5sums=('9e4ec55201be0be71ffbc56d38b42b57'
+ 'eb149edb32be6cdf20a7d16beb3e9f70'
+ '969fc4929cc215756db27168646c2b7a'
+ 'e5baf736eac5b030355533782660c92b')
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ patch -p1 <$srcdir/linux-3.0.patch
+ patch -p1 <$srcdir/sysfs-battery.patch
+ patch -p1 <$srcdir/0001-Use-dynamic-structures-instead-of-predefined-ones.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make prefix="$pkgdir/usr" install
+}
diff --git a/linux-3.0.patch b/linux-3.0.patch
new file mode 100644
index 000000000000..ba454a0c2051
--- /dev/null
+++ b/linux-3.0.patch
@@ -0,0 +1,18 @@
+diff -wbBur acpitool-0.5.1/src/acpitool.cpp acpitool-0.5.1.my/src/acpitool.cpp
+--- acpitool-0.5.1/src/acpitool.cpp 2009-08-13 23:37:48.000000000 +0400
++++ acpitool-0.5.1.my/src/acpitool.cpp 2011-08-11 21:53:17.000000000 +0400
+@@ -205,8 +205,12 @@
+ Kernel_24 = 1;
+ Kernel_26 = 0;
+ }
+-
+- if(strncmp(str,"2.6",3)==0)
++ else if(strncmp(str,"2.6",3)==0)
++ {
++ Kernel_24 = 0;
++ Kernel_26 = 1;
++ }
++ else
+ {
+ Kernel_24 = 0;
+ Kernel_26 = 1;
diff --git a/sysfs-battery.patch b/sysfs-battery.patch
new file mode 100644
index 000000000000..4f6898a78b83
--- /dev/null
+++ b/sysfs-battery.patch
@@ -0,0 +1,52 @@
+diff -wbBur acpitool-0.5.1/src/acpitool.h acpitool-0.5.1.my/src/acpitool.h
+--- acpitool-0.5.1/src/acpitool.h 2008-10-16 19:38:12.000000000 +0400
++++ acpitool-0.5.1.my/src/acpitool.h 2011-11-10 21:55:23.000000000 +0400
+@@ -29,11 +29,11 @@
+
+ struct Battery_Info {
+ int Battery_Present;
+- char Charging_State[12];
+- char Remaining_Cap[10];
+- char Design_Cap[10];
+- char LastFull_Cap[10];
+- char Present_Rate[10];
++ char Charging_State[13];
++ char Remaining_Cap[13];
++ char Design_Cap[13];
++ char LastFull_Cap[13];
++ char Present_Rate[13];
+ char Technology[13];
+ char Model[13];
+ char Serial[13];
+diff -wbBur acpitool-0.5.1/src/battery.cpp acpitool-0.5.1.my/src/battery.cpp
+--- acpitool-0.5.1/src/battery.cpp 2009-08-13 23:42:43.000000000 +0400
++++ acpitool-0.5.1.my/src/battery.cpp 2011-11-10 21:48:22.000000000 +0400
+@@ -614,7 +614,7 @@
+ }
+
+ memset(str, '\0', 100);
+- for(int t=0; t<5; t++)
++ for(int t=0; t<1; t++)
+ fgets(str, 100, power_fp); /* skip first 5 lines */
+
+ /* get battery status (full, charging, ...) */
+@@ -664,8 +664,8 @@
+
+
+
+- fgets(str, 100, power_fp); /* skip 1 line */
+-
++ fgets(str, 100, power_fp); /* cycle count - skip 1 line */
++ fgets(str, 100, power_fp); /* voltage_min - skip 1 line */
+
+ /* get voltage_now */
+ memset(str, '\0', 100);
+@@ -756,7 +756,7 @@
+ else
+ strncpy(batt_info->Model, "unknown", 7);
+
+- fgets(str, 100, power_fp);
++ fgets(str, 100, power_fp); /* manufacturer - skip 1 line */
+
+ /* get serial */
+ memset(str, '\0', 100);