temp/xfce4-battery-plugin: drop fork, upstreamed
This commit is contained in:
parent
296b8c57d0
commit
d5552a21e1
3 changed files with 0 additions and 120 deletions
|
@ -1,71 +0,0 @@
|
||||||
diff --git a/panel-plugin/battery.c b/panel-plugin/battery.c
|
|
||||||
index b730274..aa0d993 100644
|
|
||||||
--- a/panel-plugin/battery.c
|
|
||||||
+++ b/panel-plugin/battery.c
|
|
||||||
@@ -160,6 +160,7 @@ update_apm_status(t_battmon *battmon)
|
|
||||||
int method = BM_BROKEN;
|
|
||||||
int present = 0, charge = 0, rate = 0;
|
|
||||||
int lcapacity = 0, ccapacity = 0;
|
|
||||||
+ int percentage = 0;
|
|
||||||
gboolean fan = FALSE;
|
|
||||||
const char *temp;
|
|
||||||
static int old_state = -1, new_state = BM_MISSING;
|
|
||||||
@@ -216,6 +217,7 @@ update_apm_status(t_battmon *battmon)
|
|
||||||
lcapacity += acpiinfo->last_full_capacity;
|
|
||||||
ccapacity += acpistate->rcapacity;
|
|
||||||
rate += acpistate->prate;
|
|
||||||
+ percentage += acpistate->percentage;
|
|
||||||
}
|
|
||||||
|
|
||||||
sum_lcapacity += lcapacity;
|
|
||||||
@@ -241,7 +243,10 @@ update_apm_status(t_battmon *battmon)
|
|
||||||
rate = last_rate;
|
|
||||||
}
|
|
||||||
|
|
||||||
- charge = (((float)ccapacity)/((float)lcapacity))*100;
|
|
||||||
+ if (lcapacity > 0)
|
|
||||||
+ charge = (((float)ccapacity)/((float)lcapacity))*100;
|
|
||||||
+ else if (percentage > 0 && present > 0)
|
|
||||||
+ charge = percentage/present;
|
|
||||||
|
|
||||||
if (last_acline)
|
|
||||||
time_remaining = ((float)(lcapacity-ccapacity)/(float)(rate))*60;
|
|
||||||
diff --git a/panel-plugin/libacpi.c b/panel-plugin/libacpi.c
|
|
||||||
index 0755585..2737fe3 100644
|
|
||||||
--- a/panel-plugin/libacpi.c
|
|
||||||
+++ b/panel-plugin/libacpi.c
|
|
||||||
@@ -518,6 +518,7 @@ read_acpi_state_sysfs(int battery)
|
|
||||||
DIR *sysfs;
|
|
||||||
struct dirent *propety;
|
|
||||||
char *name;
|
|
||||||
+ int percentage_found;
|
|
||||||
|
|
||||||
sysfs = opendir(batteries[battery]);
|
|
||||||
if (sysfs == 0)
|
|
||||||
@@ -559,7 +560,11 @@ read_acpi_state_sysfs(int battery)
|
|
||||||
{
|
|
||||||
sprintf(buf,"%s/%s",batteries[battery], name);
|
|
||||||
acpistate->rcapacity = read_sysfs_int(buf);
|
|
||||||
- acpistate->percentage = (((float) acpistate->rcapacity)/acpiinfo->last_full_capacity) * 100;
|
|
||||||
+ /* calculate percentage based on remaining capacity only if actual percentage is not found */
|
|
||||||
+ if (!percentage_found)
|
|
||||||
+ {
|
|
||||||
+ acpistate->percentage = (((float) acpistate->rcapacity)/acpiinfo->last_full_capacity) * 100;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((strcmp(name,"current_now") == 0) || (strcmp(name,"power_now") == 0))
|
|
||||||
@@ -577,6 +582,13 @@ read_acpi_state_sysfs(int battery)
|
|
||||||
sprintf(buf,"%s/%s",batteries[battery], name);
|
|
||||||
acpistate->pvoltage = read_sysfs_int(buf);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if (strcmp(name,"capacity") == 0)
|
|
||||||
+ {
|
|
||||||
+ sprintf(buf,"%s/%s",batteries[battery], name);
|
|
||||||
+ acpistate->percentage = read_sysfs_int(buf);
|
|
||||||
+ percentage_found = 1;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir(sysfs);
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Forked from Alpine to fix battery percentage detection
|
|
||||||
|
|
||||||
pkgname=xfce4-battery-plugin
|
|
||||||
pkgver=1.1.3
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="A battery monitor plugin for the Xfce panel"
|
|
||||||
url="http://goodies.xfce.org/projects/panel-plugins/xfce4-battery-plugin"
|
|
||||||
arch="all"
|
|
||||||
license="GPL-2.0-or-later"
|
|
||||||
makedepends="xfce4-panel-dev libxfce4ui-dev perl-xml-parser intltool linux-headers"
|
|
||||||
subpackages="$pkgname-lang"
|
|
||||||
source="https://archive.xfce.org/src/panel-plugins/xfce4-battery-plugin/${pkgver%.*}/xfce4-battery-plugin-$pkgver.tar.bz2
|
|
||||||
00-fix-percentage-detection.patch
|
|
||||||
"
|
|
||||||
build() {
|
|
||||||
./configure \
|
|
||||||
--prefix=/usr \
|
|
||||||
--sysconfdir=/etc \
|
|
||||||
--libexecdir=/usr/lib \
|
|
||||||
--localstatedir=/var \
|
|
||||||
--disable-static
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
make DESTDIR="$pkgdir" install
|
|
||||||
}
|
|
||||||
|
|
||||||
sha512sums="a591fb37855efbd54d18ae97e320fa4521da611c8ea107813bfd66fa570e8c84576fcf779c7b676ee9918709912de728b0fed490e64d3d2ad403baf719db4520 xfce4-battery-plugin-1.1.3.tar.bz2
|
|
||||||
b40d122d5b80ac548f739dcda3e9a049b9183b5aa8d0f2e0e5b7f4bb91024bdc0722ecb6492dc0296c6b0a50598a871a254181f33ce3cea2f4bdd7a64b32343e 00-fix-percentage-detection.patch"
|
|
|
@ -1,19 +0,0 @@
|
||||||
--- a/panel-plugin/libacpi.c
|
|
||||||
+++ b/panel-plugin/libacpi.c
|
|
||||||
@@ -29,7 +29,6 @@
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <glob.h>
|
|
||||||
-#include <unistd.h>
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <fcntl.h>
|
|
||||||
@@ -55,6 +54,8 @@
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
+
|
|
||||||
+#include <unistd.h>
|
|
||||||
|
|
||||||
#include "libacpi.h"
|
|
||||||
|
|
Loading…
Reference in a new issue