[arch-commits] Commit in osdbattery/repos/community-x86_64 (7 files)

Antonio Rojas arojas at archlinux.org
Sat Jun 9 08:40:47 UTC 2018


    Date: Saturday, June 9, 2018 @ 08:40:47
  Author: arojas
Revision: 342146

archrelease: copy trunk to community-x86_64

Added:
  osdbattery/repos/community-x86_64/PKGBUILD
    (from rev 342145, osdbattery/trunk/PKGBUILD)
  osdbattery/repos/community-x86_64/osdbattery.install
    (from rev 342145, osdbattery/trunk/osdbattery.install)
  osdbattery/repos/community-x86_64/showbatt
    (from rev 342145, osdbattery/trunk/showbatt)
  osdbattery/repos/community-x86_64/sysfs.patch
    (from rev 342145, osdbattery/trunk/sysfs.patch)
Deleted:
  osdbattery/repos/community-x86_64/PKGBUILD
  osdbattery/repos/community-x86_64/osdbattery.install
  osdbattery/repos/community-x86_64/showbatt

--------------------+
 PKGBUILD           |   71 +++++++++++++++---------------
 osdbattery.install |   18 +++----
 showbatt           |   24 +++++-----
 sysfs.patch        |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 175 insertions(+), 57 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2018-06-09 08:40:21 UTC (rev 342145)
+++ PKGBUILD	2018-06-09 08:40:47 UTC (rev 342146)
@@ -1,36 +0,0 @@
-# $Id$
-# Maintainer: Jaroslav Lichtblau <dragonlord at aur.archlinux.org>
-# Contributor: dibblethewrecker <dibblethewrecker at jiwe.org>
-
-pkgname=osdbattery
-pkgver=1.4
-pkgrel=6
-pkgdesc="Displays battery information in the OSD style"
-arch=('i686' 'x86_64')
-url="http://osdbattery.sourceforge.net/"
-license=('GPL2')
-depends=('xosd')
-makedepends=('patch')
-install=$pkgname.install
-source=(http://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}_${pkgver}.tar.gz
-        sysfs.patch::"http://sourceforge.net/tracker/download.php?group_id=120528&atid=687314&file_id=429967&aid=3450277"
-        showbatt)
-sha256sums=('b1f775c746cd78b6aa7fc9ee75ecf2806ef3da93a42dd806c0414dcae55aed9f'
-            'd7a00e918929d36aaf3eb398649ea070ed6c4840e3da2407226fc5d9ae15d776'
-            '69969053235642315b49fe6ea5df7f8c391befbf492fd4ff71afbf4d438333b2')
-
-build() {
-  cd ${srcdir}/${pkgname}_${pkgver}
-  
-  patch -i ${srcdir}/sysfs.patch
-
-  make
-}
-
-package() {
-  cd ${srcdir}/${pkgname}_${pkgver}
-
-  install -D -m755 $pkgname ${pkgdir}/usr/bin/${pkgname}
-  install -D -m755 ${srcdir}/showbatt ${pkgdir}/usr/bin/showbatt
-  install -D -m644 $pkgname.cfg ${pkgdir}/etc/${pkgname}/${pkgname}.cfg
-}

Copied: osdbattery/repos/community-x86_64/PKGBUILD (from rev 342145, osdbattery/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2018-06-09 08:40:47 UTC (rev 342146)
@@ -0,0 +1,35 @@
+# $Id$
+# Maintainer: Jaroslav Lichtblau <dragonlord at aur.archlinux.org>
+# Contributor: dibblethewrecker <dibblethewrecker at jiwe.org>
+
+pkgname=osdbattery
+pkgver=1.4
+pkgrel=7
+pkgdesc="Displays battery information in the OSD style"
+arch=('x86_64')
+url="http://osdbattery.sourceforge.net/"
+license=('GPL2')
+depends=('xosd')
+makedepends=('patch')
+install=$pkgname.install
+source=(http://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}_${pkgver}.tar.gz
+        sysfs.patch showbatt)
+sha256sums=('b1f775c746cd78b6aa7fc9ee75ecf2806ef3da93a42dd806c0414dcae55aed9f'
+            'd7a00e918929d36aaf3eb398649ea070ed6c4840e3da2407226fc5d9ae15d776'
+            '69969053235642315b49fe6ea5df7f8c391befbf492fd4ff71afbf4d438333b2')
+
+build() {
+  cd ${srcdir}/${pkgname}_${pkgver}
+  
+  patch -i ${srcdir}/sysfs.patch
+
+  make
+}
+
+package() {
+  cd ${srcdir}/${pkgname}_${pkgver}
+
+  install -D -m755 $pkgname ${pkgdir}/usr/bin/${pkgname}
+  install -D -m755 ${srcdir}/showbatt ${pkgdir}/usr/bin/showbatt
+  install -D -m644 $pkgname.cfg ${pkgdir}/etc/${pkgname}/${pkgname}.cfg
+}

Deleted: osdbattery.install
===================================================================
--- osdbattery.install	2018-06-09 08:40:21 UTC (rev 342145)
+++ osdbattery.install	2018-06-09 08:40:47 UTC (rev 342146)
@@ -1,9 +0,0 @@
-post_install() {
-  echo "  : Remember to copy /etc/osdbattery/osdbattery.cfg to a ".osdbattery" directory in your home dir"
-  echo "  : mkdir ~/.osdbattery"
-  echo "  : cp /etc/osdbattery/osdbattery.cfg ~/.osdbattery"
-  echo
-  echo "  : The /usr/bin/showbatt script can be bound to a key combo to"
-  echo "  : easily show and hide the monitor"
-}
-

Copied: osdbattery/repos/community-x86_64/osdbattery.install (from rev 342145, osdbattery/trunk/osdbattery.install)
===================================================================
--- osdbattery.install	                        (rev 0)
+++ osdbattery.install	2018-06-09 08:40:47 UTC (rev 342146)
@@ -0,0 +1,9 @@
+post_install() {
+  echo "  : Remember to copy /etc/osdbattery/osdbattery.cfg to a ".osdbattery" directory in your home dir"
+  echo "  : mkdir ~/.osdbattery"
+  echo "  : cp /etc/osdbattery/osdbattery.cfg ~/.osdbattery"
+  echo
+  echo "  : The /usr/bin/showbatt script can be bound to a key combo to"
+  echo "  : easily show and hide the monitor"
+}
+

Deleted: showbatt
===================================================================
--- showbatt	2018-06-09 08:40:21 UTC (rev 342145)
+++ showbatt	2018-06-09 08:40:47 UTC (rev 342146)
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# osdbattery start/stop script - best bound to a keyboard combo
-
-PID=`pidof -o %PPID /usr/bin/osdbattery`
-if [ -z "$PID" ] ; then
-	/usr/bin/osdbattery &
-	echo $PID > /var/run/osdbattery.pid
-elif [ ! -z "$PID" ] ; then
-	kill $PID &> /dev/null
-	rm /var/run/osdbattery.pid
-fi

Copied: osdbattery/repos/community-x86_64/showbatt (from rev 342145, osdbattery/trunk/showbatt)
===================================================================
--- showbatt	                        (rev 0)
+++ showbatt	2018-06-09 08:40:47 UTC (rev 342146)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# osdbattery start/stop script - best bound to a keyboard combo
+
+PID=`pidof -o %PPID /usr/bin/osdbattery`
+if [ -z "$PID" ] ; then
+	/usr/bin/osdbattery &
+	echo $PID > /var/run/osdbattery.pid
+elif [ ! -z "$PID" ] ; then
+	kill $PID &> /dev/null
+	rm /var/run/osdbattery.pid
+fi

Copied: osdbattery/repos/community-x86_64/sysfs.patch (from rev 342145, osdbattery/trunk/sysfs.patch)
===================================================================
--- sysfs.patch	                        (rev 0)
+++ sysfs.patch	2018-06-09 08:40:47 UTC (rev 342146)
@@ -0,0 +1,119 @@
+--- osdbattery.c	2005-08-23 09:31:10.000000000 +0200
++++ osdbattery-1.5.c	2011-12-03 23:41:24.655759085 +0100
+@@ -17,77 +17,55 @@
+ #include <xosd.h>
+ #endif
+ 
++int get_acpi_line(char* file, char* b, int size) {
++        FILE *fp;
++        fp = fopen(file, "r");
++        if (fp == NULL) {
++                printf("Cannot open ACPI info: \"%s\"\n Is ACPI supported by the kernel and is the \"display battery\" configuration correct?\n",file);
++                exit(1);
++        }
++
++        if (fgets(b, size, fp) == NULL) {
++                fclose(fp);
++                return 0;
++        }
++        b[strlen(b)-1] = 0; /* remove trailing newline*/
++
++        fclose(fp);
++        return 1;
++}
++
+ int get_battery_state(battery_state_struct* battery_state, int bnum) {
+-	char present_voltage[64];
+-	char charging_state[64];
+-	char remaining_capacity[64];
+ 	char file[64];
+-	char b[256];
+-	FILE *fp;
++	char b[64];
+ 
+-	sprintf(file, "/proc/acpi/battery/BAT%d/state", bnum );
++        sprintf(file, "/sys/class/power_supply/BAT%d/status", bnum);
++        if ( get_acpi_line(file, b, sizeof(b)) )
++                strcpy(battery_state->charging_state, b);
++
++        sprintf(file, "/sys/class/power_supply/BAT%d/voltage_now", bnum);
++        if ( get_acpi_line(file, b, sizeof(b)) )
++                battery_state->present_voltage = atoi(b);
++
++        sprintf(file, "/sys/class/power_supply/BAT%d/charge_now", bnum);
++        if ( get_acpi_line(file, b, sizeof(b)) )
++                battery_state->remaining_capacity = atoi(b);
+ 
+-	fp = fopen(file, "r");
+-	if (fp == NULL) {
+-		printf("Cannot open ACPI info! Is ACPI supported by the kernel?\n");
+-		exit(1);
+-	}
+-
+-	rewind(fp);
+-	while (!feof(fp)) {
+-
+-		if (fgets(b, 256, fp) == NULL) {
+-			fclose(fp);
+-			return 0;
+-		} 		
+-
+-		if (sscanf(b, "present voltage: %63s", present_voltage ) != errno) {
+-			battery_state->present_voltage = atoi(present_voltage);
+-		}
+-
+-		if (sscanf(b, "charging state: %63s", charging_state ) != errno) {
+-			strcpy(battery_state->charging_state, charging_state);
+-		}
+-
+-		if (sscanf(b, "remaining capacity: %63s", remaining_capacity ) != errno) {
+-			battery_state->remaining_capacity = atoi(remaining_capacity);
+-
+-		}
+-	}	
+-	fclose(fp);
+ 	return 0;
+ }
++
+ int get_battery_info(battery_info_struct* battery_info, int bnum) { 	
+-	char design_voltage[64];
+-	char last_full_capacity[64];
+ 	char file[64];
++	char b[64];
+ 
+-	sprintf(file, "/proc/acpi/battery/BAT%d/info", bnum );
+-
+-	FILE *fp = fopen(file,"r");
+-	if (fp == NULL) {
+-		printf("can not open acpi info, acpi supported by kernel?\n");
+-		exit(1);
+-	}
+-
+-	rewind(fp);
+-	char b[256];
+-
+-	while (!feof(fp)) {
+-
+-		if (fgets(b, 256, fp) == NULL) {
+-			fclose(fp);
+-			return 0;
+-		}
+-
+-		if (sscanf(b, "design voltage: %63s", design_voltage) != errno) {
+-			battery_info->design_voltage = atoi(design_voltage);							   	}
+-
+-		if (sscanf(b, "last full capacity: %63s", last_full_capacity) != errno) {
+-			battery_info->last_full_capacity = atoi(last_full_capacity);	
+-		}
++        sprintf(file, "/sys/class/power_supply/BAT%d/voltage_min_design", bnum);
++        if ( get_acpi_line(file, b, sizeof(b)) )
++                battery_info->design_voltage = atoi(b);
++
++        sprintf(file, "/sys/class/power_supply/BAT%d/charge_full", bnum);
++        if ( get_acpi_line(file, b, sizeof(b)) )
++                battery_info->last_full_capacity = atoi(b);
+ 
+-	}
+ 	return 0;
+ }
+ 



More information about the arch-commits mailing list