Your message dated Sat, 19 Jan 2019 18:20:21 +0000
with message-id <[email protected]>
and subject line Bug#817875: fixed in libacpi 0.2-5
has caused the Debian Bug report #817875,
regarding libacpi: Patch used in NMU 0.2-4.1
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
817875: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=817875
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: src:libacpi
Version: 0.2-4.1
Severity: wishlist
Tags: patch

The libacpi package have not been able to extract battery status for a
while, and this break several packages, among them battery-stats.  I
wanted to do something about this, so I just uploaded an NMU fixing the
bugs in the package.  As the maintainer is listed as having a low NMU
threshold, I decided to upload directly into unstable instead of using
the delayed queue.  The attached patch is the changes I made to the
source package:

  * Change source format to 3.0 (quilt).
  * Adjusted library to handle new file names in
    /sys/ (Closes: #479096, #484264).
  * Added simple autopkgtest to the package.  Patch from
    Vibhav Pant and Ubuntu (Closes: #701683).
  * Changed Standards-Version from 3.7.3 to 3.9.7.
  * Switched from debhelper 5 to 9.
  * Added 'arm64' to list of build architectures (Closes: #791969).

It fixes all open Debian bugs and clean up the code slightly.
--
Happy hacking
Petter Reinholdtsen
diff -Nru libacpi-0.2/debian/changelog libacpi-0.2/debian/changelog
--- libacpi-0.2/debian/changelog	2016-03-11 08:38:45.000000000 +0000
+++ libacpi-0.2/debian/changelog	2016-03-11 08:37:19.000000000 +0000
@@ -1,3 +1,17 @@
+libacpi (0.2-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Change source format to 3.0 (quilt).
+  * Adjusted library to handle new file names in
+    /sys/ (Closes: #479096, #484264).
+  * Added simple autopkgtest to the package.  Patch from
+    Vibhav Pant and Ubuntu (Closes: #701683).
+  * Changed Standards-Version from 3.7.3 to 3.9.7.
+  * Switched from debhelper 5 to 9.
+  * Added 'arm64' to list of build architectures (Closes: #791969).
+
+ -- Petter Reinholdtsen <[email protected]>  Fri, 11 Mar 2016 09:37:08 +0100
+
 libacpi (0.2-4) unstable; urgency=low
 
   * Fix interface incompatibilities introduced by last patch (Closes: #464276).
diff -Nru libacpi-0.2/debian/compat libacpi-0.2/debian/compat
--- libacpi-0.2/debian/compat	2016-03-11 08:38:45.000000000 +0000
+++ libacpi-0.2/debian/compat	2016-03-11 08:32:27.000000000 +0000
@@ -1 +1 @@
-5
+9
diff -Nru libacpi-0.2/debian/control libacpi-0.2/debian/control
--- libacpi-0.2/debian/control	2016-03-11 08:38:45.000000000 +0000
+++ libacpi-0.2/debian/control	2016-03-11 08:34:12.000000000 +0000
@@ -1,15 +1,16 @@
 Source: libacpi
 Priority: optional
 Maintainer: Nico Golde <[email protected]>
-Build-Depends: debhelper (>= 5)
-Standards-Version: 3.7.3
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.7
 Section: libs
+Testsuite: autopkgtest
 Homepage: http://www.ngolde.de/libacpi.html
 
 Package: libacpi-dev
 Section: libdevel
-Architecture: i386 ia64 amd64
-Depends: libacpi0 (= ${binary:Version})
+Architecture: i386 ia64 amd64 arm64
+Depends: ${misc:Depends}, libacpi0 (= ${binary:Version})
 Description: development files for libacpi
  libacpi is a general purpose shared library for programs gathering
  ACPI data on Linux. It implements thermal zones, battery information,
@@ -20,7 +21,7 @@
 
 Package: libacpi0
 Section: libs
-Architecture: i386 ia64 amd64
+Architecture: i386 ia64 amd64 arm64
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: general purpose library for ACPI
  libacpi is a general purpose shared library for programs gathering
diff -Nru libacpi-0.2/debian/patches/01-newer-linux-kernels.patch libacpi-0.2/debian/patches/01-newer-linux-kernels.patch
--- libacpi-0.2/debian/patches/01-newer-linux-kernels.patch	1970-01-01 00:00:00.000000000 +0000
+++ libacpi-0.2/debian/patches/01-newer-linux-kernels.patch	2016-03-11 08:23:54.000000000 +0000
@@ -0,0 +1,319 @@
+Description: handle newer linux kernels
+ Patch to use files in /sys/, and handle that some of the files
+ changed name over time.
+ Make sure to skip the AC "battery" as it is really the external power
+ and not a battery.
+Author: Petter Reinholdtsen <[email protected]>,
+        Joseph Spillner <[email protected]>
+Bug-Debian: https://bugs.debian.org/463982
+Bug-Debian: https://bugs.debian.org/463986
+Bug-Debian: https://bugs.debian.org/464276
+Bug-Debian: https://bugs.debian.org/479096
+Forwarded: no
+Reviewed-By: Petter Reinholdtsen <[email protected]>
+Last-Update: 2016-03-11
+
+--- libacpi-0.2.orig/libacpi.c
++++ libacpi-0.2/libacpi.c
+@@ -14,8 +14,9 @@
+ #include "libacpi.h"
+ #include "list.h"
+ 
+-static int read_acpi_battinfo(const int num);
+-static int read_acpi_battalarm(const int num);
++
++static int read_acpi_battinfo(const int num, const int sysstyle);
++static int read_acpi_battalarm(const int num, const int sysstyle);
+ static int read_acpi_battstate(const int num);
+ static void read_acpi_thermalzones(global_t *globals);
+ 
+@@ -144,9 +145,19 @@ init_acpi_batt(global_t *globals){
+ 	int i = 0;
+ 
+ 	globals->batt_count = 0;
++	globals->sysstyle = 0;
+ 	if((lst = dir_list(PROC_ACPI "battery")) == NULL || !lst->top)
+-		return NOT_SUPPORTED;
++	{
++		/* check for new Linux 2.6.24+ layout */
++		if((lst = dir_list(SYS_POWER)) == NULL || !lst->top)
++			return NOT_SUPPORTED;
++		else
++			globals->sysstyle = 1;
++	}
+ 	for(node = lst->top; node; node=node->next){
++		/* Skip non-battery AC power */
++		if (0 == strcmp("AC", node->name))
++			continue;
+ 		if((names[globals->batt_count] = strdup(node->name)) == NULL){
+ 			delete_list(lst);
+ 			return ALLOC_ERR;
+@@ -174,11 +185,20 @@ init_acpi_batt(global_t *globals){
+ 	for (i=0; i < globals->batt_count && i < MAX_ITEMS; i++){
+ 		binfo = &batteries[i];
+ 		snprintf(binfo->name, MAX_NAME, "%s", names[i]);
+-		snprintf(binfo->state_file, MAX_NAME, PROC_ACPI "battery/%s/state", names[i]);
+-		snprintf(binfo->info_file, MAX_NAME, PROC_ACPI "battery/%s/info", names[i]);
+-		snprintf(binfo->alarm_file, MAX_NAME, PROC_ACPI "battery/%s/alarm", names[i]);
+-		read_acpi_battinfo(i);
+-		read_acpi_battalarm(i);
++		if(globals->sysstyle)
++		{
++			snprintf(binfo->state_file, MAX_NAME, "/%s/present", names[i]);
++			snprintf(binfo->info_file, MAX_NAME, SYS_POWER "/%s", names[i]);
++			snprintf(binfo->alarm_file, MAX_NAME, SYS_POWER "/%s/alarm", names[i]);
++		}
++		else
++		{
++			snprintf(binfo->state_file, MAX_NAME, PROC_ACPI "battery/%s/state", names[i]);
++			snprintf(binfo->info_file, MAX_NAME, PROC_ACPI "battery/%s/info", names[i]);
++			snprintf(binfo->alarm_file, MAX_NAME, PROC_ACPI "battery/%s/alarm", names[i]);
++		}
++		read_acpi_battinfo(i, globals->sysstyle);
++		read_acpi_battalarm(i, globals->sysstyle);
+ 		free(names[i]);
+ 	}
+ 	delete_list(lst);
+@@ -196,11 +216,22 @@ read_acpi_acstate(global_t *globals){
+ 		ac->ac_state = P_ERR;
+ 		return;
+ 	}
+-	if((tmp = scan_acpi_value(buf, "state:")) && !strncmp(tmp, "on-line", 7))
+-		ac->ac_state = P_AC;
+-	else if(tmp && !strncmp(tmp, "off-line", 8))
+-		ac->ac_state = P_BATT;
+-	else ac->ac_state = P_ERR;
++	if(globals->sysstyle)
++	{
++		if(!strcmp(buf, "1"))
++			ac->ac_state = P_AC;
++		else if(!strcmp(buf, "0"))
++			ac->ac_state = P_BATT;
++		else ac->ac_state = P_ERR;
++	}
++	else
++	{
++		if((tmp = scan_acpi_value(buf, "state:")) && !strncmp(tmp, "on-line", 7))
++			ac->ac_state = P_AC;
++		else if(tmp && !strncmp(tmp, "off-line", 8))
++			ac->ac_state = P_BATT;
++		else ac->ac_state = P_ERR;
++	}
+ 	free(buf);
+ 	free(tmp);
+ }
+@@ -212,14 +243,22 @@ init_acpi_acadapt(global_t *globals){
+ 	list_t *lst = NULL;
+ 	adapter_t *ac = &globals->adapt;
+ 
++	globals->sysstyle = 0;
+ 	if((lst = dir_list(PROC_ACPI "ac_adapter")) == NULL || !lst->top)
+-		return NOT_SUPPORTED;
+-
++	{
++		if((lst = dir_list(SYS_POWER "/AC")) == NULL || !lst->top)
++			return NOT_SUPPORTED;
++		else
++			globals->sysstyle = 1;
++	}
+ 	if((!lst->top->name || ((ac->name = strdup(lst->top->name)) == NULL))){
+ 		delete_list(lst);
+ 		return ALLOC_ERR;
+ 	}
+-	snprintf(ac->state_file, MAX_NAME, PROC_ACPI "ac_adapter/%s/state", ac->name);
++	if(globals->sysstyle)
++		snprintf(ac->state_file, MAX_NAME, SYS_POWER "/AC/online");
++	else
++		snprintf(ac->state_file, MAX_NAME, PROC_ACPI "ac_adapter/%s/state", ac->name);
+ 	delete_list(lst);
+ 	read_acpi_acstate(globals);
+ 	return SUCCESS;
+@@ -450,7 +489,7 @@ fill_charge_state(const char *state, bat
+ 
+ /* read alarm capacity, return 0 on success, negative values on error */
+ static int
+-read_acpi_battalarm(const int num){
++read_acpi_battalarm(const int num, const int sysstyle){
+ 	char *buf = NULL;
+ 	char *tmp = NULL;
+ 	battery_t *info = &batteries[num];
+@@ -458,10 +497,22 @@ read_acpi_battalarm(const int num){
+ 	if((buf = get_acpi_content(info->alarm_file)) == NULL)
+ 		return NOT_SUPPORTED;
+ 
+-	if((tmp = scan_acpi_value(buf, "alarm:")) && tmp[0] != 'u')
+-		info->alarm = strtol(tmp, NULL, 10);
++	if(sysstyle)
++	{
++		if(!strcmp(buf, "0"))
++			info->alarm = 0;
++		else if(!strcmp(buf, "1"))
++			info->alarm = 1;
++		else
++			info->alarm = NOT_SUPPORTED;
++	}
+ 	else
+-		info->alarm = NOT_SUPPORTED;
++	{
++		if((tmp = scan_acpi_value(buf, "alarm:")) && tmp[0] != 'u')
++			info->alarm = strtol(tmp, NULL, 10);
++		else
++			info->alarm = NOT_SUPPORTED;
++	}
+ 	free(buf);
+ 	free(tmp);
+ 	return SUCCESS;
+@@ -469,11 +520,70 @@ read_acpi_battalarm(const int num){
+ 
+ /* reads static values for a battery (info file), returns SUCCESS */
+ static int
+-read_acpi_battinfo(const int num){
++read_acpi_battinfo(const int num, const int sysstyle){
+ 	char *buf = NULL;
+ 	char *tmp = NULL;
+ 	battery_t *info = &batteries[num];
+ 	int i = 0;
++	char sysfile[MAX_NAME];
++
++	if(sysstyle)
++	{
++		snprintf(sysfile, MAX_NAME, "%s/present", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL)
++			return NOT_SUPPORTED;
++		if(!strcmp(buf, "1")) {
++			info->present = 1;
++		} else {
++			info->present = 0;
++			return NOT_PRESENT;
++		}
++
++		snprintf(sysfile, MAX_NAME, "%s/charge_full_design", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL) {
++			snprintf(sysfile, MAX_NAME, "%s/energy_full_design",
++				 info->info_file);
++			if((buf = get_acpi_content(sysfile)) == NULL)
++				return NOT_SUPPORTED;
++		}
++		info->design_cap = strtol(buf, NULL, 10);
++
++		snprintf(sysfile, MAX_NAME, "%s/charge_full", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL) {
++			snprintf(sysfile, MAX_NAME, "%s/energy_full",
++				 info->info_file);
++			if((buf = get_acpi_content(sysfile)) == NULL)
++				return NOT_SUPPORTED;
++		}
++		info->last_full_cap = strtol(buf, NULL, 10);
++
++		snprintf(sysfile, MAX_NAME, "%s/charge_now", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL) {
++			snprintf(sysfile, MAX_NAME, "%s/energy_now",
++				 info->info_file);
++			if((buf = get_acpi_content(sysfile)) == NULL)
++				return NOT_SUPPORTED;
++		}
++		info->remaining_cap = strtol(buf, NULL, 10);
++
++		snprintf(sysfile, MAX_NAME, "%s/voltage_min_design", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL)
++			return NOT_SUPPORTED;
++		info->design_voltage = strtol(buf, NULL, 10);
++
++		snprintf(sysfile, MAX_NAME, "%s/voltage_now", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL)
++			return NOT_SUPPORTED;
++		info->present_voltage = strtol(buf, NULL, 10);
++
++		/* FIXME: is rate == current here? */
++		snprintf(sysfile, MAX_NAME, "%s/current_now", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL)
++			return NOT_SUPPORTED;
++		info->present_rate = strtol(buf, NULL, 10);
++
++		return SUCCESS;
++	}
+ 
+ 	if((buf = get_acpi_content(info->info_file)) == NULL)
+ 		return NOT_SUPPORTED;
+@@ -520,9 +630,23 @@ read_acpi_battstate(const int num){
+ 	char *tmp = NULL;
+ 	battery_t *info = &batteries[num];
+ 	unsigned int i = 0;
++	char sysfile[MAX_NAME];
+ 
+-	if((buf = get_acpi_content(info->state_file)) == NULL)
+-		return NOT_SUPPORTED;
++	if((buf = get_acpi_content(info->state_file)) == NULL) {
++		snprintf(sysfile, MAX_NAME, "%s/status", info->info_file);
++		if((buf = get_acpi_content(sysfile)) == NULL)
++			return NOT_SUPPORTED;
++		if(!strcmp(buf, "Discharging"))
++			info->charge_state = C_DISCHARGE;
++		else if(!strcmp(buf, "Charging"))
++			info->charge_state = C_CHARGE;
++		else if(!strcmp(buf, "Full"))
++			info->charge_state = C_CHARGED;
++		else
++			info->charge_state = C_NOINFO;
++
++		return SUCCESS;
++	}
+ 	
+ 	if((tmp = scan_acpi_value(buf, "present:")) && !strncmp(tmp, "yes", 3)) {
+ 		info->present = 1;
+@@ -608,7 +732,7 @@ int
+ read_acpi_batt(const int num){
+ 	if(num > MAX_ITEMS) return ITEM_EXCEED;
+ 	read_acpi_battstate(num);
+-	read_acpi_battalarm(num);
++	read_acpi_battalarm(num, 0);
+ 	calc_remain_perc(num);
+ 	calc_remain_chargetime(num);
+ 	calc_remain_time(num);
+--- libacpi-0.2.orig/libacpi.h
++++ libacpi-0.2/libacpi.h
+@@ -12,6 +12,8 @@
+ #define __LIBACPI_H__
+ 
+ #define PROC_ACPI "/proc/acpi/"
++#define SYS_POWER "/sys/class/power_supply"
++
+ #define LINE_MAX 256
+ #define MAX_NAME 512
+ #define MAX_BUF 1024
+@@ -177,6 +179,7 @@ typedef struct {
+ 	int fan_count;                /**< number of found fans */
+ 	int temperature;              /**< system temperature if we only have on thermal zone */
+ 	adapter_t adapt;              /**< ac adapter */
++	int sysstyle;
+ } global_t;
+ 
+ /**
+@@ -239,6 +242,7 @@ int read_acpi_batt(const int num);
+  * Looks up if the ac adapter is plugged in or not
+  * and sets the values in a struct
+  * @param globals pointer to the global acpi structure
++ * @param sysstyle whether or not to use the /sys interface
+  */
+ void read_acpi_acstate(global_t *globals);
+ /**
+--- libacpi-0.2.orig/test-libacpi.c
++++ libacpi-0.2/test-libacpi.c
+@@ -46,6 +46,7 @@ main(void){
+ 			read_acpi_batt(i);
+ 
+ 			if(binfo->present)
++			{
+ 				printf("\n%s:\tpresent: %d\n"
+ 						"\tdesign capacity: %d\n"
+ 						"\tlast full capacity: %d\n"
+@@ -65,6 +66,9 @@ main(void){
+ 						binfo->batt_state, binfo->percentage, 
+ 						binfo->charge_time / 60, binfo->charge_time % 60,
+ 						binfo->remaining_time / 60, binfo->remaining_time % 60);
++				if(binfo->alarm)
++					printf("%s: Alarm!\n", binfo->name);
++			}
+ 		}
+ 	} else printf("Battery information:\tnot supported\n");
+ 	
diff -Nru libacpi-0.2/debian/patches/series libacpi-0.2/debian/patches/series
--- libacpi-0.2/debian/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ libacpi-0.2/debian/patches/series	2016-03-11 08:18:41.000000000 +0000
@@ -0,0 +1 @@
+01-newer-linux-kernels.patch
diff -Nru libacpi-0.2/debian/rules libacpi-0.2/debian/rules
--- libacpi-0.2/debian/rules	2016-03-11 08:38:45.000000000 +0000
+++ libacpi-0.2/debian/rules	2016-03-11 08:32:03.000000000 +0000
@@ -27,7 +27,7 @@
 install: build
 	dh_testdir
 	dh_testroot
-	dh_clean -k 
+	dh_prep
 	dh_installdirs
 
 	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr install
diff -Nru libacpi-0.2/debian/source/format libacpi-0.2/debian/source/format
--- libacpi-0.2/debian/source/format	1970-01-01 00:00:00.000000000 +0000
+++ libacpi-0.2/debian/source/format	2016-03-11 08:18:03.000000000 +0000
@@ -0,0 +1 @@
+3.0 (quilt)
diff -Nru libacpi-0.2/debian/tests/build libacpi-0.2/debian/tests/build
--- libacpi-0.2/debian/tests/build	1970-01-01 00:00:00.000000000 +0000
+++ libacpi-0.2/debian/tests/build	2016-03-11 08:28:45.000000000 +0000
@@ -0,0 +1,30 @@
+#!/bin/sh
+# autopkgtest check: Build and run a program against libacpi, to verify that the
+# headers are correctly installed
+# (C) 2013 Vibhav Pant
+# Author: Vibhav Pant <[email protected]>
+
+set -e
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+cat <<EOF > libacpi_test.c
+#include <libacpi.h>
+
+int main(void)
+{
+	global_t global;
+
+	check_acpi_support();
+	init_acpi_thermal(&global);
+	read_acpi_acstate(&global);
+	return 0;
+}
+EOF
+
+gcc -o libacpi_test libacpi_test.c -lacpi -Wall -Werror
+echo "build: OK"
+[ -x libacpi_test ]
+./libacpi_test
+echo "run: OK"
diff -Nru libacpi-0.2/debian/tests/control libacpi-0.2/debian/tests/control
--- libacpi-0.2/debian/tests/control	1970-01-01 00:00:00.000000000 +0000
+++ libacpi-0.2/debian/tests/control	2016-03-11 08:28:45.000000000 +0000
@@ -0,0 +1,2 @@
+Tests: build
+Depends: libacpi-dev, build-essential
diff -Nru libacpi-0.2/libacpi.c libacpi-0.2/libacpi.c
--- libacpi-0.2/libacpi.c	2016-03-11 08:38:45.000000000 +0000
+++ libacpi-0.2/libacpi.c	2007-07-29 12:09:34.000000000 +0000
@@ -14,9 +14,8 @@
 #include "libacpi.h"
 #include "list.h"
 
-
-static int read_acpi_battinfo(const int num, const int sysstyle);
-static int read_acpi_battalarm(const int num, const int sysstyle);
+static int read_acpi_battinfo(const int num);
+static int read_acpi_battalarm(const int num);
 static int read_acpi_battstate(const int num);
 static void read_acpi_thermalzones(global_t *globals);
 
@@ -145,15 +144,8 @@
 	int i = 0;
 
 	globals->batt_count = 0;
-	globals->sysstyle = 0;
 	if((lst = dir_list(PROC_ACPI "battery")) == NULL || !lst->top)
-	{
-		/* check for new Linux 2.6.24+ layout */
-		if((lst = dir_list(SYS_POWER)) == NULL || !lst->top)
-			return NOT_SUPPORTED;
-		else
-			globals->sysstyle = 1;
-	}
+		return NOT_SUPPORTED;
 	for(node = lst->top; node; node=node->next){
 		if((names[globals->batt_count] = strdup(node->name)) == NULL){
 			delete_list(lst);
@@ -182,20 +174,11 @@
 	for (i=0; i < globals->batt_count && i < MAX_ITEMS; i++){
 		binfo = &batteries[i];
 		snprintf(binfo->name, MAX_NAME, "%s", names[i]);
-		if(globals->sysstyle)
-		{
-			snprintf(binfo->state_file, MAX_NAME, "/%s/present", names[i]);
-			snprintf(binfo->info_file, MAX_NAME, SYS_POWER "/%s", names[i]);
-			snprintf(binfo->alarm_file, MAX_NAME, SYS_POWER "/%s/alarm", names[i]);
-		}
-		else
-		{
-			snprintf(binfo->state_file, MAX_NAME, PROC_ACPI "battery/%s/state", names[i]);
-			snprintf(binfo->info_file, MAX_NAME, PROC_ACPI "battery/%s/info", names[i]);
-			snprintf(binfo->alarm_file, MAX_NAME, PROC_ACPI "battery/%s/alarm", names[i]);
-		}
-		read_acpi_battinfo(i, globals->sysstyle);
-		read_acpi_battalarm(i, globals->sysstyle);
+		snprintf(binfo->state_file, MAX_NAME, PROC_ACPI "battery/%s/state", names[i]);
+		snprintf(binfo->info_file, MAX_NAME, PROC_ACPI "battery/%s/info", names[i]);
+		snprintf(binfo->alarm_file, MAX_NAME, PROC_ACPI "battery/%s/alarm", names[i]);
+		read_acpi_battinfo(i);
+		read_acpi_battalarm(i);
 		free(names[i]);
 	}
 	delete_list(lst);
@@ -213,22 +196,11 @@
 		ac->ac_state = P_ERR;
 		return;
 	}
-	if(globals->sysstyle)
-	{
-		if(!strcmp(buf, "1"))
-			ac->ac_state = P_AC;
-		else if(!strcmp(buf, "0"))
-			ac->ac_state = P_BATT;
-		else ac->ac_state = P_ERR;
-	}
-	else
-	{
-		if((tmp = scan_acpi_value(buf, "state:")) && !strncmp(tmp, "on-line", 7))
-			ac->ac_state = P_AC;
-		else if(tmp && !strncmp(tmp, "off-line", 8))
-			ac->ac_state = P_BATT;
-		else ac->ac_state = P_ERR;
-	}
+	if((tmp = scan_acpi_value(buf, "state:")) && !strncmp(tmp, "on-line", 7))
+		ac->ac_state = P_AC;
+	else if(tmp && !strncmp(tmp, "off-line", 8))
+		ac->ac_state = P_BATT;
+	else ac->ac_state = P_ERR;
 	free(buf);
 	free(tmp);
 }
@@ -240,22 +212,14 @@
 	list_t *lst = NULL;
 	adapter_t *ac = &globals->adapt;
 
-	globals->sysstyle = 0;
 	if((lst = dir_list(PROC_ACPI "ac_adapter")) == NULL || !lst->top)
-	{
-		if((lst = dir_list(SYS_POWER "/AC")) == NULL || !lst->top)
-			return NOT_SUPPORTED;
-		else
-			globals->sysstyle = 1;
-	}
+		return NOT_SUPPORTED;
+
 	if((!lst->top->name || ((ac->name = strdup(lst->top->name)) == NULL))){
 		delete_list(lst);
 		return ALLOC_ERR;
 	}
-	if(globals->sysstyle)
-		snprintf(ac->state_file, MAX_NAME, SYS_POWER "/AC/online");
-	else
-		snprintf(ac->state_file, MAX_NAME, PROC_ACPI "ac_adapter/%s/state", ac->name);
+	snprintf(ac->state_file, MAX_NAME, PROC_ACPI "ac_adapter/%s/state", ac->name);
 	delete_list(lst);
 	read_acpi_acstate(globals);
 	return SUCCESS;
@@ -486,7 +450,7 @@
 
 /* read alarm capacity, return 0 on success, negative values on error */
 static int
-read_acpi_battalarm(const int num, const int sysstyle){
+read_acpi_battalarm(const int num){
 	char *buf = NULL;
 	char *tmp = NULL;
 	battery_t *info = &batteries[num];
@@ -494,22 +458,10 @@
 	if((buf = get_acpi_content(info->alarm_file)) == NULL)
 		return NOT_SUPPORTED;
 
-	if(sysstyle)
-	{
-		if(!strcmp(buf, "0"))
-			info->alarm = 0;
-		else if(!strcmp(buf, "1"))
-			info->alarm = 1;
-		else
-			info->alarm = NOT_SUPPORTED;
-	}
+	if((tmp = scan_acpi_value(buf, "alarm:")) && tmp[0] != 'u')
+		info->alarm = strtol(tmp, NULL, 10);
 	else
-	{
-		if((tmp = scan_acpi_value(buf, "alarm:")) && tmp[0] != 'u')
-			info->alarm = strtol(tmp, NULL, 10);
-		else
-			info->alarm = NOT_SUPPORTED;
-	}
+		info->alarm = NOT_SUPPORTED;
 	free(buf);
 	free(tmp);
 	return SUCCESS;
@@ -517,58 +469,11 @@
 
 /* reads static values for a battery (info file), returns SUCCESS */
 static int
-read_acpi_battinfo(const int num, const int sysstyle){
+read_acpi_battinfo(const int num){
 	char *buf = NULL;
 	char *tmp = NULL;
 	battery_t *info = &batteries[num];
 	int i = 0;
-	char sysfile[MAX_NAME];
-
-	if(sysstyle)
-	{
-		snprintf(sysfile, MAX_NAME, "%s/present", info->info_file);
-		if((buf = get_acpi_content(sysfile)) == NULL)
-			return NOT_SUPPORTED;
-		if(!strcmp(buf, "1")) {
-			info->present = 1;
-		} else {
-			info->present = 0;
-			return NOT_PRESENT;
-		}
-
-		snprintf(sysfile, MAX_NAME, "%s/charge_full_design", info->info_file);
-		if((buf = get_acpi_content(sysfile)) == NULL)
-			return NOT_SUPPORTED;
-		info->design_cap = strtol(buf, NULL, 10);
-
-		snprintf(sysfile, MAX_NAME, "%s/charge_full", info->info_file);
-		if((buf = get_acpi_content(sysfile)) == NULL)
-			return NOT_SUPPORTED;
-		info->last_full_cap = strtol(buf, NULL, 10);
-
-		snprintf(sysfile, MAX_NAME, "%s/charge_now", info->info_file);
-		if((buf = get_acpi_content(sysfile)) == NULL)
-			return NOT_SUPPORTED;
-		info->remaining_cap = strtol(buf, NULL, 10);
-
-		snprintf(sysfile, MAX_NAME, "%s/voltage_min_design", info->info_file);
-		if((buf = get_acpi_content(sysfile)) == NULL)
-			return NOT_SUPPORTED;
-		info->design_voltage = strtol(buf, NULL, 10);
-
-		snprintf(sysfile, MAX_NAME, "%s/voltage_now", info->info_file);
-		if((buf = get_acpi_content(sysfile)) == NULL)
-			return NOT_SUPPORTED;
-		info->present_voltage = strtol(buf, NULL, 10);
-
-		/* FIXME: is rate == current here? */
-		snprintf(sysfile, MAX_NAME, "%s/current_now", info->info_file);
-		if((buf = get_acpi_content(sysfile)) == NULL)
-			return NOT_SUPPORTED;
-		info->present_rate = strtol(buf, NULL, 10);
-
-		return SUCCESS;
-	}
 
 	if((buf = get_acpi_content(info->info_file)) == NULL)
 		return NOT_SUPPORTED;
@@ -703,7 +608,7 @@
 read_acpi_batt(const int num){
 	if(num > MAX_ITEMS) return ITEM_EXCEED;
 	read_acpi_battstate(num);
-	read_acpi_battalarm(num, 0);
+	read_acpi_battalarm(num);
 	calc_remain_perc(num);
 	calc_remain_chargetime(num);
 	calc_remain_time(num);
diff -Nru libacpi-0.2/libacpi.h libacpi-0.2/libacpi.h
--- libacpi-0.2/libacpi.h	2016-03-11 08:38:45.000000000 +0000
+++ libacpi-0.2/libacpi.h	2007-07-29 12:09:34.000000000 +0000
@@ -12,8 +12,6 @@
 #define __LIBACPI_H__
 
 #define PROC_ACPI "/proc/acpi/"
-#define SYS_POWER "/sys/class/power_supply"
-
 #define LINE_MAX 256
 #define MAX_NAME 512
 #define MAX_BUF 1024
@@ -179,7 +177,6 @@
 	int fan_count;                /**< number of found fans */
 	int temperature;              /**< system temperature if we only have on thermal zone */
 	adapter_t adapt;              /**< ac adapter */
-	int sysstyle;
 } global_t;
 
 /**
@@ -242,7 +239,6 @@
  * Looks up if the ac adapter is plugged in or not
  * and sets the values in a struct
  * @param globals pointer to the global acpi structure
- * @param sysstyle whether or not to use the /sys interface
  */
 void read_acpi_acstate(global_t *globals);
 /**
diff -Nru libacpi-0.2/test-libacpi.c libacpi-0.2/test-libacpi.c
--- libacpi-0.2/test-libacpi.c	2016-03-11 08:38:45.000000000 +0000
+++ libacpi-0.2/test-libacpi.c	2007-07-29 12:09:34.000000000 +0000
@@ -46,7 +46,6 @@
 			read_acpi_batt(i);
 
 			if(binfo->present)
-			{
 				printf("\n%s:\tpresent: %d\n"
 						"\tdesign capacity: %d\n"
 						"\tlast full capacity: %d\n"
@@ -66,9 +65,6 @@
 						binfo->batt_state, binfo->percentage, 
 						binfo->charge_time / 60, binfo->charge_time % 60,
 						binfo->remaining_time / 60, binfo->remaining_time % 60);
-				if(binfo->alarm)
-					printf("%s: Alarm!\n", binfo->name);
-			}
 		}
 	} else printf("Battery information:\tnot supported\n");
 	

--- End Message ---
--- Begin Message ---
Source: libacpi
Source-Version: 0.2-5

We believe that the bug you reported is fixed in the latest version of
libacpi, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Petter Reinholdtsen <[email protected]> (supplier of updated libacpi package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sat, 19 Jan 2019 17:59:14 +0000
Source: libacpi
Binary: libacpi-dev libacpi0
Architecture: source
Version: 0.2-5
Distribution: unstable
Urgency: medium
Maintainer: Debian QA Group <[email protected]>
Changed-By: Petter Reinholdtsen <[email protected]>
Description:
 libacpi-dev - development files for libacpi
 libacpi0   - general purpose library for ACPI
Closes: 817875 865833
Changes:
 libacpi (0.2-5) unstable; urgency=medium
 .
   * QA upload.
   * Change owner to Debian QA Group, see bug #842559. (Closes: #817875)
   * Changed Standards-Version from 3.9.7 to 4.3.0.
   * Fix FTCBFS (Closes: #865833)
   * Dropped obsolete Testsuite field from d/control.
   * Switched d/rules to dh.
   * Fixed typos in manual page.  Thank you lintian.
Checksums-Sha1:
 36f6963a5eadfea54d7cb29590dec5a07c906810 1861 libacpi_0.2-5.dsc
 9f18dc08761f97df3d6d5aebd839e83907554610 6252 libacpi_0.2-5.debian.tar.xz
 ef06be23bcfe6dc38f75239beda54e1311e9e464 5672 libacpi_0.2-5_source.buildinfo
Checksums-Sha256:
 0ce6dd74293e7eaba14b0f2fe04efc12f5ec56da188abb7f3d27baa21543250c 1861 
libacpi_0.2-5.dsc
 bc1d13190bab0dbf28001f1f5db10a8fcd8f0f005f71969ddc2374fe2d13d5b3 6252 
libacpi_0.2-5.debian.tar.xz
 af41724dd808e82c467334925b6b802da697eace1ecc7724f8c4ab81c702c4a0 5672 
libacpi_0.2-5_source.buildinfo
Files:
 d68752de9ef68f3d793eaa3a071378cf 1861 libs optional libacpi_0.2-5.dsc
 5061eb164872e2c4908dc0f64260b66c 6252 libs optional libacpi_0.2-5.debian.tar.xz
 e3509331c6b756b31925f2b6c63f9c44 5672 libs optional 
libacpi_0.2-5_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEERqLf4owIeylOb9kkgSgKoIe6+w4FAlxDZfoACgkQgSgKoIe6
+w5m2g/8DLbT+MhPm4cebq9L25CgzpMN6TidJrj5gBo6WbisHAyEpToHAo+QG4Ew
JAuCk6G6AImJ1cB8mbbS0b+m/Vy2sepH9Ko+eAGUVpFVA3NGCaQqwZ+24BAv5mMU
CDcIJDpCT2dw5lLife1+qj8Kq9bf6tGMjqZ3JYSK/ADVYmMgp4p73gSC8TUTwnqD
ePM0CFq++PEO4oWS+HdljqX/fZMLVUOoUNRlSAn7ZlqVJIpGKKSuD3da/jvHTRS6
eQ6zgsevJoCRL86RiPCzQmVRZxP9XV+YguWJw6gdxtJ0jNedRuUTAx6Wvwz+NX9v
osnV82WjZUnL1Yi7bq4v1Y1TV2J6aYKi3PRiE2nNnxFCCiIKHDShDwZepeMi9pB/
J4TK9acbGyoUDABK5nw7CYyIzM32vsMqk/kSldccGEg4eS59pt5ng5h/Tb05wy1t
g8MEddx9OtKsY30g2vC+yipQ3AEAi6YHeL1diz2y8C1+ljvwI4ZlMR4F0qNGkdOg
rdkILX6nKukOaOSJrDNX89ng2TZZWd5bFwcfSUqpYSx1gbmSX6zH619d0wp/ghiu
Tpsb2Fjb0qCEMarLfgsl/9m5l1q+9mYgBxY/JY4dm/hwlZ3MttoY++71OH5T6/Ml
0mncWqnMhIl+y9kwbLZOrfEemhXw5Pjkue60zNQWCeIJuq7jB7E=
=mwMp
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to