Compare commits

...

63 commits

Author SHA1 Message Date
Fedora Release Engineering
ba553b4282 Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-16 03:25:37 +00:00
Fedora Release Engineering
309c399a90 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-23 16:44:13 +00:00
Fedora Release Engineering
b70483d286 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-16 10:32:38 +00:00
Miroslav Suchý
5caa08a94b convert GPLv2+ license to SPDX
This is part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_4
2024-07-25 22:52:58 +02:00
Fedora Release Engineering
4edc48bea7 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-17 16:34:04 +00:00
Software Management Team
eb5e9f80e9 Eliminate use of obsolete %patchN syntax (#2283636) 2024-05-30 12:46:46 +02:00
Fedora Release Engineering
6b2226a1e1 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-22 22:37:47 +00:00
Fedora Release Engineering
fcb60b9af7 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-19 12:07:10 +00:00
Fedora Release Engineering
fe84dd803a Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-19 12:52:32 +00:00
Fedora Release Engineering
3e8f93fb1a Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-18 21:22:11 +00:00
Fedora Release Engineering
6c568b2912 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-20 20:24:45 +00:00
Fedora Release Engineering
e8bc537ffb - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-19 20:54:02 +00:00
Fedora Release Engineering
805c5c1344 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 17:13:57 +00:00
Fedora Release Engineering
419ab8b221 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 12:18:48 +00:00
Fedora Release Engineering
0afad633c5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-25 23:46:43 +00:00
Tom Stellard
205da264ab Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-15 01:45:06 +00:00
Fedora Release Engineering
d16214805c - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-31 23:48:21 +00:00
Fedora Release Engineering
4130e7b6c6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-27 11:43:00 +00:00
Fedora Release Engineering
9206ee53fa - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-28 11:10:45 +00:00
Fedora Release Engineering
6289c94414 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-24 17:30:50 +00:00
Al Stone
4d93de1927 Cache size was reported incorrectly
Incorporate patch provided in BZ

Signed-off-by: Al Stone <ahs3@redhat.com>
2019-05-28 14:52:47 -06:00
Fedora Release Engineering
09d5b0651a - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-01-31 12:55:33 +00:00
Igor Gnatenko
ee834b82e2 Remove obsolete Group tag
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-01-28 20:17:38 +01:00
Al Stone
8cd89eeab0 Did a lot of cleanup and bug fixing, trying to make this viable
Signed-off-by: Al Stone <ahs3@redhat.com>
2018-10-26 15:11:23 -06:00
Al Stone
0a14b68e60 Added in BuildRequires for C++. Closes BZ1603341.
Signed-off-by: Al Stone <ahs3@redhat.com>
2018-07-23 17:37:20 -06:00
Fedora Release Engineering
a9f458f8ee - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-12 19:58:04 +00:00
Jason Tibbitts
f0f7566c82 Remove needless use of %defattr 2018-07-10 00:09:23 -05:00
Igor Gnatenko
6c2335c40c
Remove %clean section
None of currently supported distributions need that.
Last one was EL5 which is EOL for a while.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-14 09:29:37 +01:00
Igor Gnatenko
9fbaa32edb Remove BuildRoot definition
None of currently supported distributions need that.
It was needed last for EL5 which is EOL now

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-13 23:00:56 +01:00
Fedora Release Engineering
e514d84591 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-07 01:49:53 +00:00
Fedora Release Engineering
c19d38203c - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-02 17:23:25 +00:00
Fedora Release Engineering
a49cec32c2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 02:34:25 +00:00
Fedora Release Engineering
9ee8c311a5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-10 05:43:53 +00:00
Dennis Gilmore
209419fafc - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-03 15:57:59 +00:00
Dennis Gilmore
66359550ff - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-16 23:35:47 +00:00
Kalev Lember
b2c6e20d86 Rebuilt for GCC 5 C++11 ABI change 2015-05-02 11:36:14 +02:00
Peter Robinson
e8a3099fd9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-15 19:58:41 +00:00
Dennis Gilmore
7c4384785a - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-06 19:04:25 -05:00
Dennis Gilmore
db3551e542 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-02 19:13:08 -05:00
Dennis Gilmore
7e7423565f - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild 2013-02-13 10:15:41 -06:00
Dennis Gilmore
8f795411f7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 2012-07-18 10:33:35 -05:00
Dennis Gilmore
f11ffdf722 - Rebuilt for c++ ABI breakage 2012-02-28 11:38:49 -06:00
Dennis Gilmore
38296ee912 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild 2012-01-12 15:00:06 -06:00
Dennis Gilmore
5decee4a3c - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild 2011-02-07 18:17:04 -06:00
Fedora Release Engineering
1001aa7b45 dist-git conversion 2010-07-28 09:35:22 +00:00
Bill Nottingham
70707a400e Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-25 22:38:24 +00:00
Steven M. Parrish
ec82f400cd various minor fixes (fixing memleaks, removing of limit on thermal zones) 2009-08-26 18:04:03 +00:00
Jesse Keating
c63692ad44 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild 2009-07-24 16:34:35 +00:00
Jesse Keating
3f73641b19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild 2009-02-24 00:05:18 +00:00
pertusus
7d4fcb3f0b - update to 0.5 2008-09-18 15:01:23 +00:00
Tom Callaway
f50ed533bb fix license tag 2008-07-14 17:12:23 +00:00
Jesse Keating
363934a0a7 - Autorebuild for GCC 4.3 2008-02-19 17:56:44 +00:00
pertusus
96000d79f7 - fixes for gcc 4.3 2008-01-03 23:02:41 +00:00
pertusus
8dedb5f0e6 use .tar.bz2 2007-12-17 18:19:53 +00:00
pertusus
0af13a8b70 cosmetic spec file changes 2007-11-18 20:55:53 +00:00
pertusus
af84c874f3 - update to 0.4.7 2007-05-24 17:32:28 +00:00
pertusus
026bcc72fa - set Group to Applications/System (fix #209230) 2006-10-06 07:25:10 +00:00
pertusus
cc4be43495 - update to 0.4.6 2006-08-28 09:38:48 +00:00
Ville Skyttä
c279a62f19 http://fedoraproject.org/wiki/Extras/Schedule/FC6MassRebuild 2006-08-27 20:14:00 +00:00
pertusus
2cca35f520 - update to 0.4.5 2006-05-21 11:05:29 +00:00
pertusus
647d87a738 bump release to rebuild for modified changelog 2006-02-16 20:57:03 +00:00
pertusus
066ec69c65 correct changelog 2006-02-16 20:55:04 +00:00
pertusus
ae21a9daef - bump release
- remove now unneeded patch
2006-02-16 20:50:40 +00:00
14 changed files with 1297 additions and 79 deletions

View file

@ -1 +0,0 @@
acpitool-0.3.0.tar.gz

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
acpitool-0.5.1.tar.bz2

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: acpitool
# $Id$
NAME := acpitool
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

73
ac_adapter.patch Normal file
View file

@ -0,0 +1,73 @@
Author: Michael Meskes <meskes@debian.org>
Description: Fix reading of ac_adapter information.
--- acpitool-0.5.1/src/ac_adapter.cpp 2009-08-13 21:26:02.000000000 +0200
+++ acpitool-0.5.1.fixed/src/ac_adapter.cpp 2010-03-09 12:26:22.000000000 +0100
@@ -149,7 +149,7 @@
int Do_AC_Info_Sys()
{
ifstream file_in;
- char filename[2][65], str[100], temp[100];
+ char filename[2][65], str[100], temp[100], attr[100];
int ac_count = 0, start = 0, findex = 0;
DIR *ac_dir;
char *name, *dirname;
@@ -206,31 +206,40 @@
if(ac_count>0)
{
- for(int i=0; i<ac_count; i++) /* I don't expect to find > 1, but you never know */
+ for(int i=0, t=0; i<ac_count; i++) /* I don't expect to find > 1, but you never know */
{
FILE *power_fp = fopen(filename[i], "r");
if(power_fp)
{
- for(int t=0; t<5; t++)
- fgets(str, 100, power_fp); /* just skip the first 5 lines */
-
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
+ // see linux-2.6/drivers/power/power_supply_sysfs.c
+ // there can be different number of lines, so read up to 40 lines
+ for(; t<40; t++)
+ {
+ memset(str, '\0', 100);
+ fgets(str, 100, power_fp);
- if (strlen(str)!=0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+ if (strlen(str)!=0)
+ {
+ memset(temp, '\0', 100);
+ memset(attr, '\0', 100);
+ sscanf(str, "%[^=]s %*s %[^\n]", attr);
+ sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- /* keep this for debugging */
- /* printf(" from Do_AC_SYS: temp = %s \n", temp);*/
-
- if(strncmp(temp,"1",1)==0)
- printf(" AC adapter : online \n");
- else
- printf(" AC adapter : off-line \n");
+ /* keep this for debugging */
+ /* printf(" from Do_AC_SYS: temp = %s \n", temp);*/
+
+ if (strcmp(attr, "POWER_SUPPLY_ONLINE") == 0)
+ {
+ if(strncmp(temp,"1",1)==0)
+ printf(" AC adapter : online \n");
+ else
+ printf(" AC adapter : off-line \n");
+
+ break;
+ }
+ }
}
- else
+ if (t == 40)
printf(" AC adapter : <info not available> \n");
}
else

View file

@ -1,30 +0,0 @@
--- acpitool-0.3.0-orig/configure 2005-10-22 15:10:09.000000000 +0200
+++ acpitool-0.3.0/configure 2005-11-10 23:49:15.000000000 +0100
@@ -3374,27 +3374,6 @@
-CXXFLAGS="-O2 -Wall"
-
-
-case ${host_cpu} in
-*586)
- CXXFLAGS="${CXXFLAGS} -mcpu=i586 -march=i586"
- ;;
-*686)
- CXXFLAGS="${CXXFLAGS} -mcpu=i686 -march=i686"
- ;;
-x86-64)
- CXXFLAGS="${CXXFLAGS} -march=k8"
- ;;
-*)
- ;;
-esac
-
-echo "$as_me:$LINENO: result: $CXXFLAGS" >&5
-echo "${ECHO_T}$CXXFLAGS" >&6
-
-
# Checks for libraries.
# Checks for header files.

View file

@ -1,26 +1,42 @@
Summary: Command line ACPI client
Name: acpitool
Version: 0.3.0
Release: 3%{?dist}
Url: http://freeunix.dyndns.org:8088/site2/acpitool.shtml
Source0: http://freeunix.dyndns.org:8000/ftp_site/pub/unix/acpitool/acpitool-%{version}.tar.gz
Summary: A command line ACPI client for Linux
Group: Applications/Internet
License: GPL
Patch: acpitool-keep_CXXFLAGS.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Version: 0.5.1
Release: 38%{?dist}
# Automatically converted from old format: GPLv2+ - review is highly recommended.
License: GPL-2.0-or-later
URL: https://sourceforge.net/projects/acpitool/
BuildRequires: gcc-c++
BuildRequires: make
Source0: https://sourceforge.net/projects/acpitool/files/acpitool/%{version}/acpitool-%{version}.tar.bz2
Patch0: ac_adapter.patch
Patch1: battery.patch
Patch2: kernel3.patch
Patch3: wakeup.patch
Patch4: var-line.patch
Patch5: typos.patch
Patch6: cleanup.patch
Patch7: cache-size.patch
%description
AcpiTool is a Linux ACPI client. It's a small command line application,
intended to be a replacement for the apm tool. The primary target
audience are laptop users, since these people are most interested in
things like battery status, thermal status and the ability to suspend
(sleep mode). The program simply accesses the /proc/acpi or /sysfs entries
to get/set acpi values. Hence, a computer running a Linux kernel from
the 2.4.x or 2.6.x series with ACPI enabled is needed.
AcpiTool is a Linux ACPI client. It's a small command line application,
intended to be a replacement for the apm tool. Besides "basic" ACPI
information like battery status, AC presence, putting the laptop to
sleep, Acpitool also supports various extensions for Toshiba, Asus and
IBM Thinkpad laptops, allowing you to change the LCD brightness level,
toggle fan on/off, and more.
%prep
%setup
%patch -p1
%setup -q
%patch -P0 -p1 -b .ac_adapter
%patch -P1 -p1 -b .battery
%patch -P2 -p1 -b .kernel3
%patch -P3 -p1 -b .wakeup
%patch -P4 -p1 -b .var-line
%patch -P5 -p1 -b .typos
%patch -P6 -p1 -b .cleanup
%patch -P7 -p1 -b .cache-size
%build
%configure
@ -30,23 +46,174 @@ make %{?_smp_mflags}
rm -fr $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -fr $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc README TODO ChangeLog AUTHORS COPYING
%doc AUTHORS ChangeLog COPYING INSTALL README TODO
%{_bindir}/acpitool
%{_mandir}/man1/acpitool*
%changelog
* Thu Nov 10 2005 Patrice Dumas <dumas@centre-cired.fr> - 0.3.0-3
* Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-38
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-37
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 25 2024 Miroslav Suchý <msuchy@redhat.com> - 0.5.1-35
- convert license to SPDX
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-33
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-32
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-31
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-29
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon Jan 25 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Jul 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-25
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Tue May 28 2019 Al Stone <ahs3@redhat.com> - 0.5.1-21
- Cache size was being reported incorrectly (cpufreq was being used
instead). Pulled in patch submitted with bug report once verified.
Closes BZ#1701278.
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Oct 26 2018 Al Stone <ahs3@redhat.com> - 0.5.1-19
- Remove commented out acpitool-0.5-gcc43.patch; it's no longer needed and
just clutters up the spec file
- Merge in patches from Debian (Arch uses very similar but not exactly
identical nor as extensive patches). Closes BZ#1625002.
- Add a new patch to clean up g++ warning about implicit casts
- Fixed upstream to more recent location on sf.net
* Mon Jul 23 2018 Al Stone <ahs3@redhat.com> - 0.5.1-18
- Add in BuildRequires for C++. Closes BZ1603341.
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 0.5.1-10
- Rebuilt for GCC 5 C++11 ABI change
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-4
- Rebuilt for c++ ABI breakage
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Aug 26 2009 Steven M. Parrish <smparrish@gmail.com> 0.5.1-1
- various minor fixes (fixing memleaks, removing of limit on thermal zones)
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Thu Sep 18 2008 Patrice Dumas <pertusus@free.fr> 0.5-1
- update to 0.5
* Mon Jul 14 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0.4.7-5
- fix license tag
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0.4.7-4
- Autorebuild for GCC 4.3
* Thu Jan 3 2008 Patrice Dumas <pertusus@free.fr> 0.4.7-3
- fixes for gcc 4.3
* Thu May 24 2007 Patrice Dumas <pertusus@free.fr> 0.4.7-2
- update to 0.4.7
* Fri Oct 6 2006 Patrice Dumas <pertusus@free.fr> 0.4.6-2
- set Group to Applications/System (fix #209230)
* Mon Aug 28 2006 Patrice Dumas <pertusus@free.fr> 0.4.6-1
- update to 0.4.6
* Sun May 21 2006 Patrice Dumas <pertusus@free.fr> 0.4.5-1
- update to 0.4.5
* Thu Feb 16 2006 Patrice Dumas <pertusus@free.fr> 0.4.4-1.1
- new version
- remove now unneeded patch
* Thu Nov 10 2005 Patrice Dumas <pertusus@free.fr> 0.3.0-3
- add patch to avoid ignoring CXXFLAGS
* Fri Nov 4 2005 Patrice Dumas <dumas@centre-cired.fr> - 0.3.0-2
* Fri Nov 4 2005 Patrice Dumas <pertusus@free.fr> 0.3.0-2
- update using fedora core conventions, some cleanings
* Tue Aug 24 2004 Robert Ambrose <rna@muttsoft.com>
- Created .spec file.

484
battery.patch Normal file
View file

@ -0,0 +1,484 @@
Author: Evgeni Golov <evgeni@debian.org>, Michael Meskes <meskes@debian.org>
Description: Fix reading of battery information.
--- acpitool-0.5.1/src/acpitool.h 2008-10-16 17:38:12.000000000 +0200
+++ acpitool-0.5.1.fixed/src/acpitool.h 2010-03-28 11:35:12.000000000 +0200
@@ -39,6 +39,9 @@
char Serial[13];
char Bat_Type[13];
char Voltage_Now[13];
+ char Charge_Now[13];
+ char Charge_Full[13];
+ char Charge_Full_Design[13];
};
--- acpitool-0.5.1/src/battery.cpp 2009-08-13 21:42:43.000000000 +0200
+++ acpitool-0.5.1.fixed/src/battery.cpp 2010-03-28 13:46:40.000000000 +0200
@@ -107,6 +107,9 @@
memset(Batt_Info[i]->Serial, '\0', 13);
memset(Batt_Info[i]->Bat_Type, '\0', 13);
memset(Batt_Info[i]->Voltage_Now, '\0', 13);
+ memset(Batt_Info[i]->Charge_Now, '\0', 13);
+ memset(Batt_Info[i]->Charge_Full, '\0', 13);
+ memset(Batt_Info[i]->Charge_Full_Design, '\0', 13);
// initialize all struct members to blanks --> avoid rubbish in output //
@@ -139,7 +142,12 @@
case 1 :
{
Present_Batteries++;
- Remaining_Percentage = float(atoi(Batt_Info[i]->Remaining_Cap)) / float(atoi(Batt_Info[i]->LastFull_Cap)) * 100.0;
+
+ if (strcmp(Batt_Info[i]->Charge_Now,"")!=0 &&
+ strcmp(Batt_Info[i]->Charge_Now,"unknown")!=0)
+ Remaining_Percentage = float(atoi(Batt_Info[i]->Charge_Now)) / float(atoi(Batt_Info[i]->Charge_Full)) * 100.0;
+ else
+ Remaining_Percentage = float(atoi(Batt_Info[i]->Remaining_Cap)) / float(atoi(Batt_Info[i]->LastFull_Cap)) * 100.0;
/* from Alan Pope : some broken Dell batteries report a remaining capacity bigger
than their last full capacity or their design capacity. This led acpitool to report
@@ -153,19 +161,24 @@
else
Precision = 4;
- if( strncmp(Batt_Info[i]->Charging_State,"char",4)==0 )
+ if(strncasecmp(Batt_Info[i]->Charging_State,"char",4)==0)
{
Is_Charging = 1;
}
else
{
- if(strncmp(Batt_Info[i]->Charging_State,"disch",5)==0) Is_Discharging = 1;
+ if(strncasecmp(Batt_Info[i]->Charging_State,"disch",5)==0) Is_Discharging = 1;
}
if(Show_Time) // calculate remaining or charging time only if present battery rate != 0 //
{
- if(Is_Charging)
- Remaining_Time = (float(atoi(Batt_Info[i]->LastFull_Cap)) - float(atoi(Batt_Info[i]->Remaining_Cap))) / float(atoi(Batt_Info[i]->Present_Rate));
+ if(Is_Charging) {
+ if (strcmp(Batt_Info[i]->Charge_Now,"")!=0 &&
+ strcmp(Batt_Info[i]->Charge_Now,"unknown")!=0)
+ Remaining_Time = (float(atoi(Batt_Info[i]->Charge_Full)) - float(atoi(Batt_Info[i]->Charge_Now))) / float(atoi(Batt_Info[i]->Present_Rate));
+ else
+ Remaining_Time = (float(atoi(Batt_Info[i]->LastFull_Cap)) - float(atoi(Batt_Info[i]->Remaining_Cap))) / float(atoi(Batt_Info[i]->Present_Rate));
+ }
else
Remaining_Time = float(atoi(Batt_Info[i]->Remaining_Cap)) / float(atoi(Batt_Info[i]->Present_Rate));
// this represents hours //
@@ -180,9 +193,11 @@
Minutes = Time_In_Seconds / 60;
Time_In_Seconds = Time_In_Seconds - (Minutes * 60);
}
-
+
if(atoi(Batt_Info[i]->Design_Cap) > 0)
Battery_Left_Percent = float(atoi(Batt_Info[i]->LastFull_Cap)) / float(atoi(Batt_Info[i]->Design_Cap)) * 100.0;
+ else if(atoi(Batt_Info[i]->Charge_Full_Design) > 0)
+ Battery_Left_Percent = float(atoi(Batt_Info[i]->Charge_Full)) / float(atoi(Batt_Info[i]->Charge_Full_Design)) * 100.0;
else
Battery_Left_Percent = -1.0;
@@ -207,8 +222,15 @@
<<setfill('0')<<setw(2)<<Time_In_Seconds;
cout<<endl;
- cout<<" Design capacity : "<<Batt_Info[i]->Design_Cap<<endl;
- cout<<" Last full capacity : "<<Batt_Info[i]->LastFull_Cap;
+ if(atoi(Batt_Info[i]->Design_Cap) > 0)
+ cout<<" Design capacity : "<<Batt_Info[i]->Design_Cap<<endl;
+ else if(atoi(Batt_Info[i]->Charge_Full_Design) > 0)
+ cout<<" Design capacity : "<<Batt_Info[i]->Charge_Full_Design<<endl;
+
+ if(atoi(Batt_Info[i]->LastFull_Cap) > 0)
+ cout<<" Last full capacity : "<<Batt_Info[i]->LastFull_Cap;
+ else if(atoi(Batt_Info[i]->Charge_Full) > 0)
+ cout<<" Last full capacity : "<<Batt_Info[i]->Charge_Full;
if(Battery_Left_Percent<100.0)
{
@@ -327,7 +349,7 @@
-int Get_Battery_Info_from_Proc(const int bat_nr, Battery_Info *bat_info, int verbose)
+int Get_Battery_Info_from_Proc(const int bat_nr, Battery_Info *batt_info, int verbose)
{
ifstream file_in;
char filename[4][65], str[100], temp[100];
@@ -378,7 +400,7 @@
{
if(!verbose)
{
- bat_info->Battery_Present = 2; // 2 represents error value //
+ batt_info->Battery_Present = 2; // 2 represents error value //
return 0;
}
else
@@ -422,24 +444,24 @@
file_in.getline(str, 100);
strncpy(temp, str+25, 4);
if(strncmp(temp,"yes",3)==0)
- bat_info->Battery_Present = 1; //yes, we have a battery //
+ batt_info->Battery_Present = 1; //yes, we have a battery //
else
{
- bat_info->Battery_Present = 0;
+ batt_info->Battery_Present = 0;
return 0; //bail out if battery is not present //
}
// then get the design capacity //
file_in.getline(str, 100);
- strncpy(bat_info->Design_Cap, str+25, 9);
+ strncpy(batt_info->Design_Cap, str+25, 9);
// then get the last full capacity //
file_in.getline(str, 100);
- strncpy(bat_info->LastFull_Cap, str+25, 9);
+ strncpy(batt_info->LastFull_Cap, str+25, 9);
- if (strncmp(bat_info->LastFull_Cap,"unknown",7)==0)
+ if (strncmp(batt_info->LastFull_Cap,"unknown",7)==0)
{
- bat_info->Battery_Present = 0;
+ batt_info->Battery_Present = 0;
return 0; //bail out if battery is not present //
}
/* some Dell laptops seem to report a 2nd battery as being present, while it is NOT, but then report the
@@ -449,21 +471,21 @@
// then get the technology //
file_in.getline(str, 100);
- strncpy(bat_info->Technology, str+25, 12);
+ strncpy(batt_info->Technology, str+25, 12);
// then get the model number //
for(int t=0; t<5; t++)
file_in.getline(str, 100); //skip 5 lines //
file_in.getline(str, 100);
- strncpy(bat_info->Model, str+25, 12);
+ strncpy(batt_info->Model, str+25, 12);
// then get the serial number //
file_in.getline(str, 100);
- strncpy(bat_info->Serial, str+25, 12);
+ strncpy(batt_info->Serial, str+25, 12);
// then get the battery type //
file_in.getline(str, 100);
- strncpy(bat_info->Bat_Type, str+25, 12);
+ strncpy(batt_info->Bat_Type, str+25, 12);
file_in.close();
@@ -480,17 +502,17 @@
// then get the charging state //
file_in.getline(str, 100); file_in.getline(str, 100); // skip first 2 lines //
file_in.getline(str, 100);
- strncpy(bat_info->Charging_State, str+25, 12);
- if (strncmp(bat_info->Charging_State,"unknown",7)==0) strncpy(bat_info->Charging_State, "charged",7);
+ strncpy(batt_info->Charging_State, str+25, 12);
+ if (strncmp(batt_info->Charging_State,"unknown",7)==0) strncpy(batt_info->Charging_State, "charged",7);
/* on older kernels, like 2.4.22, the charging state is reported as "unknown", whereas in recent kernels
this was changed to "charged". */
// then get the charging rate //
file_in.getline(str, 100);
- strncpy(bat_info->Present_Rate, str+25, 9);
- if (strncmp(bat_info->Charging_State,"charged",7)==0)
+ strncpy(batt_info->Present_Rate, str+25, 9);
+ if (strncmp(batt_info->Charging_State,"charged",7)==0)
{
- if (strncmp(bat_info->Present_Rate, "unknown",7)==0) strncpy(bat_info->Present_Rate, "0 ",7);
+ if (strncmp(batt_info->Present_Rate, "unknown",7)==0) strncpy(batt_info->Present_Rate, "0 ",7);
}
/* some batteries report the present rate as "unknown", even when they report the battery as being charged.
If the battery is charged, the rate should be 0 */
@@ -498,12 +520,12 @@
// then get the remaining capacity //
file_in.getline(str, 100);
- strncpy(bat_info->Remaining_Cap, str+25, 9);
+ strncpy(batt_info->Remaining_Cap, str+25, 9);
file_in.close();
}
else // battery dir is readable but empty : only . and .. at most //
- bat_info->Battery_Present = 3;
+ batt_info->Battery_Present = 3;
return 0;
}
@@ -513,8 +535,8 @@
int Get_Battery_Info_from_Sys(const int bat_nr, Battery_Info *batt_info, int verbose)
{
ifstream file_in;
- char filename[6][65], str[100], temp[100];
- int bat_count = 0, start = 0, findex = 0;
+ char filename[6][65], str[100], temp[100], attr[100];
+ int bat_count = 0, start = 0, findex = 0, value = 0;
DIR *battery_dir;
char *name, *dirname;
@@ -613,165 +635,104 @@
return -1;
}
- memset(str, '\0', 100);
- for(int t=0; t<5; t++)
- fgets(str, 100, power_fp); /* skip first 5 lines */
-
- /* get battery status (full, charging, ...) */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->Charging_State, temp, 12);
- }
-
-
- /* get battery presence (0 or 1) */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- strncpy(temp, str+21, 1);
- if(strncmp(temp,"1",1)==0)
- batt_info->Battery_Present = 1; /* yes, we have a battery */
- else
- {
- batt_info->Battery_Present = 0;
- printf(" Battery is not present, bailing out. \n");
- return 0; /* bail out if battery is not present */
- }
- }
-
-
- /* get technology */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->Technology, temp, 12);
- }
- else
- strncpy(batt_info->Technology, "unknown", 7);
-
-
-
- //printf(" \n bat_info_tech = %s \n\n ", batt_info->Technology);
-
-
-
- fgets(str, 100, power_fp); /* skip 1 line */
-
-
- /* get voltage_now */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->Voltage_Now, temp, 12);
- }
- else
- strncpy(batt_info->Voltage_Now, "unknown", 7);
-
-
- /* get current_now, which I believe is the charging rate ? */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->Present_Rate, temp, 12);
- }
- else
- strncpy(batt_info->Present_Rate, "unknown", 7);
-
-
- /* get charge_full_design */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->Design_Cap, temp, 12);
- }
- else
- strncpy(batt_info->Design_Cap, "unknown", 7);
-
-
- //printf(" \n bat_info_design_cap = %s \n ", batt_info->Design_Cap);
-
-
- /* get charge_full, which is the last full capacity I guess ? */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->LastFull_Cap, temp, 12);
- }
- else
- strncpy(batt_info->LastFull_Cap, "unknown", 7);
-
-
- //printf(" \n bat_info_lastfull_cap = %s \n\n ", batt_info->LastFull_Cap);
-
-
- /* get charge_now */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->Remaining_Cap, temp, 12);
- }
- else
- strncpy(batt_info->Remaining_Cap, "unknown", 7);
-
- //printf(" \n bat_info_remaining_cap = %s \n\n ", batt_info->Remaining_Cap);
-
-
- /* get model_name */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)>0)
- {
- memset(temp, '\0', 100);
- strncpy(temp, str+24, 12); // use strncpy here because sscanf chokes on blanks in this one ? //
-
- memset(str, '\0', 100);
- sscanf(temp, "%[^\n]", str); // strip trailing \n, fucks up output //
-
- strncpy(batt_info->Model, str, 12);
+ strncpy(batt_info->Technology, "unknown", 7);
+ strncpy(batt_info->Voltage_Now, "unknown", 7);
+ strncpy(batt_info->Charge_Now, "unknown", 7);
+ strncpy(batt_info->Charge_Full, "unknown", 7);
+ strncpy(batt_info->Charge_Full_Design, "unknown", 7);
+ strncpy(batt_info->Present_Rate, "unknown", 7);
+ strncpy(batt_info->Design_Cap, "unknown", 7);
+ strncpy(batt_info->LastFull_Cap, "unknown", 7);
+ strncpy(batt_info->Remaining_Cap, "unknown", 7);
+ strncpy(batt_info->Model, "unknown", 7);
+ strncpy(batt_info->Serial, "unknown", 7);
+
+ // see linux-2.6/drivers/power/power_supply_sysfs.c
+ // there can be different number of lines, so read up to 40 lines
+ for(int t=0; t<40; t++) {
+ memset(str, '\0', 100);
+ memset(attr, '\0', 100);
+ memset(temp, '\0', 100);
+ fgets(str, 100, power_fp);
+ sscanf(str, "%[^=]s %*s %*[^\n]", attr);
+ sscanf(str, "%*[^=] %*c %s %*[^\n]",temp);
+ if (strcmp(attr,"POWER_SUPPLY_STATUS")==0) {
+ strncpy(batt_info->Charging_State, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_TYPE")==0) {
+ strncpy(batt_info->Bat_Type, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_TECHNOLOGY")==0) {
+ strncpy(batt_info->Technology, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_VOLTAGE_NOW")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mV", value);
+ strncpy(batt_info->Voltage_Now, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_CURRENT_NOW")==0 ||
+ strcmp(attr,"POWER_SUPPLY_POWER_NOW")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i", value);
+ strncpy(batt_info->Present_Rate, temp, 9);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_NOW")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mA", value);
+ strncpy(batt_info->Charge_Now, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_FULL_DESIGN")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mA", value);
+ strncpy(batt_info->Charge_Full_Design, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_FULL")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mA", value);
+ strncpy(batt_info->Charge_Full, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_ENERGY_FULL_DESIGN")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mWh", value);
+ strncpy(batt_info->Design_Cap, temp, 9);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_ENERGY_FULL")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mWh", value);
+ strncpy(batt_info->LastFull_Cap, temp, 9);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_ENERGY_NOW")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mWh", value);
+ strncpy(batt_info->Remaining_Cap, temp, 9);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_MODEL_NAME")==0) {
+ strncpy(batt_info->Model, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_SERIAL_NUMBER")==0) {
+ strncpy(batt_info->Serial, temp, 12);
+ }
+ else if (strcmp(attr,"POWER_SUPPLY_PRESENT")==0) {
+ if(strncmp(temp,"1",1)==0) {
+ batt_info->Battery_Present = 1;
+ }
+ else {
+ batt_info->Battery_Present = 0;
+ printf(" Battery is not present, bailing out. \n");
+ return 0;
+ }
+ }
}
+ if (strcmp(batt_info->Charge_Now,"")!=0 &&
+ strcmp(batt_info->Charge_Now,"unknown")!=0)
+ snprintf(temp, sizeof(temp), "%s mA", batt_info->Present_Rate);
else
- strncpy(batt_info->Model, "unknown", 7);
+ snprintf(temp, sizeof(temp), "%s mW", batt_info->Present_Rate);
- fgets(str, 100, power_fp);
+ strncpy(batt_info->Present_Rate, temp, 9);
- /* get serial */
- memset(str, '\0', 100);
- fgets(str, 100, power_fp);
- if (strlen(str)!=0)
- {
- memset(temp, '\0', 100);
- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
- strncpy(batt_info->Serial, temp, 12);
- }
- else
- strncpy(batt_info->Serial, "unknown", 7);
-
fclose(power_fp);
- }
+ }
else // battery dir is readable but empty : only . and .. at most //
batt_info->Battery_Present = 3;
return 0;

15
cache-size.patch Normal file
View file

@ -0,0 +1,15 @@
Actually print the cache size instead of cpufreq a second time.
Reported and fixed by Stephane Wirtel <stephane@wirtel.be>
diff -rNu acpitool-0.5.1/src/cpu.cpp acpitool-0.5.1-modified/src/cpu.cpp
--- acpitool-0.5.1/src/cpu.cpp 2009-08-13 21:26:02.000000000 +0200
+++ acpitool-0.5.1-modified/src/cpu.cpp 2019-04-18 16:01:54.091620544 +0200
@@ -80,6 +80,7 @@
}
fgets(str, 299, cpuinfo_fp);
+ fgets(str, 299, cpuinfo_fp);
memset(temp, '\0', 130);
sscanf(str, "%*[^:] %*s %s",temp);
printf(" Cache size : %s KB\n", temp);

371
cleanup.patch Normal file
View file

@ -0,0 +1,371 @@
Cleanup all of the warnings from implicit char const * casting
ISO C++ used to allow:
char *foo;
foo = "my string";
The standard has since changed, and this patch changes to the new
expectation:
char const *foo; // which makes more sense
foo = "my string";
Signed-off-by: Al Stone <ahs3@redhat.com>
diff -NaurEZbwB acpitool-0.5.1.orig/src/ac_adapter.cpp acpitool-0.5.1/src/ac_adapter.cpp
--- acpitool-0.5.1.orig/src/ac_adapter.cpp 2018-10-26 14:08:08.527714586 -0600
+++ acpitool-0.5.1/src/ac_adapter.cpp 2018-10-26 14:24:33.819571023 -0600
@@ -50,7 +50,8 @@
int Do_AC_Info(int verbose) // wrapper around the other 2 functions //
{
ifstream file_in;
- char *dirname, filename[4][50], str[40];
+ char const *dirname;
+ char filename[4][50], str[40];
int ac_count = 0;
DIR *ac_dir;
struct dirent *ac_dirent;
@@ -87,7 +88,8 @@
int Do_AC_Info_Proc(int verbose)
{
ifstream file_in;
- char *dirname, filename[4][50], str[40];
+ char const *dirname;
+ char filename[4][50], str[40];
int ac_count = 0;
DIR *ac_dir;
struct dirent *ac_dirent;
@@ -152,7 +154,7 @@
char filename[2][65], str[100], temp[100], attr[100];
int ac_count = 0, start = 0, findex = 0;
DIR *ac_dir;
- char *name, *dirname;
+ char const *name, *dirname;
dirname = "/sys/class/power_supply/"; //find all entries in this dir
diff -NaurEZbwB acpitool-0.5.1.orig/src/acpitool.cpp acpitool-0.5.1/src/acpitool.cpp
--- acpitool-0.5.1.orig/src/acpitool.cpp 2018-10-26 14:08:08.527714586 -0600
+++ acpitool-0.5.1/src/acpitool.cpp 2018-10-26 14:23:21.903926202 -0600
@@ -64,7 +64,8 @@
int Has_ACPI(char *c)
{
ifstream file_in, file2_in;
- char *filename, *filename2, str[50];
+ char const *filename, *filename2;
+ char str[50];
filename = "/proc/acpi/info";
filename2 = "/sys/module/acpi/parameters/acpica_version";
@@ -104,6 +105,7 @@
return 1;
}
}
+ return 0;
}
@@ -137,7 +139,8 @@
int Get_Kernel_Version(char *c, int verbose)
{
ifstream file_in;
- char *filename, str[20];
+ char const *filename;
+ char str[20];
filename = "/proc/sys/kernel/osrelease";
@@ -185,7 +188,8 @@
int Set_Kernel_Version()
{
ifstream file_in;
- char *filename, str[10];
+ char const *filename;
+ char str[10];
filename = "/proc/sys/kernel/osrelease";
@@ -218,7 +222,8 @@
int Do_Thermal_Info(const int show_trip, int verbose)
{
ifstream file_in, file_in2;
- char *dirname, str[120];
+ char const *dirname;
+ char str[120];
vector<string> filename;
DIR *thermal_dir;
@@ -341,7 +346,8 @@
int Do_Fan_Info(int verbose)
{
ifstream file_in;
- char *dirname, filename[4][50], str[40];
+ char const *dirname;
+ char filename[4][50], str[40];
int fan_count = 0;
DIR *fan_dir;
struct dirent *fan_dirent;
@@ -416,7 +422,7 @@
int Show_WakeUp_Devices(int verbose)
{
ifstream file_in;
- char *filename;
+ char const *filename;
string str;
filename = "/proc/acpi/wakeup";
@@ -461,7 +467,8 @@
int Toggle_WakeUp_Device(const int Device, int verbose)
{
ofstream file_out;
- char *filename; string str;
+ char const *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";
@@ -527,7 +534,7 @@
int Do_Suspend(int State) //put system in sleep state 3 or 4 (standby) //
{
ofstream file_out;
- char *filename, *str;
+ char const *filename, *str;
Set_Kernel_Version();
diff -NaurEZbwB acpitool-0.5.1.orig/src/asus.cpp acpitool-0.5.1/src/asus.cpp
--- acpitool-0.5.1.orig/src/asus.cpp 2018-10-26 14:08:08.527714586 -0600
+++ acpitool-0.5.1/src/asus.cpp 2018-10-26 14:28:37.753758221 -0600
@@ -45,7 +45,7 @@
int Has_Asus_ACPI()
{
ifstream file_in;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/asus";
@@ -82,7 +82,8 @@
int Do_Asus_LCD_Info()
{
ifstream file_in;
- char *filename, lcdb[40];
+ char const *filename;
+ char lcdb[40];
filename = "/proc/acpi/asus/brn";
@@ -116,7 +117,7 @@
int Set_Asus_LCD_Level(int z)
{
ofstream file_out;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/asus/brn";
@@ -144,7 +145,7 @@
int Do_Asus_Video_Info()
{
ifstream file_in;
- char *filename;
+ char const *filename;
int type;
filename = "/proc/acpi/asus/disp";
@@ -199,7 +200,8 @@
int Do_Asus_Info()
{
ifstream file_in;
- char *filename, info[255];
+ char const *filename;
+ char info[255];
filename = "/proc/acpi/asus/info";
@@ -264,7 +266,7 @@
int Set_Asus_LCD_State(int o)
{
ofstream file_out;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/asus/lcd";
file_out.open(filename);
@@ -289,7 +291,7 @@
int Set_MLed(int state)
{
ofstream file_out;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/asus/mled";
file_out.open(filename);
@@ -314,7 +316,7 @@
int Set_WLed(int state)
{
ofstream file_out;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/asus/wled";
file_out.open(filename);
diff -NaurEZbwB acpitool-0.5.1.orig/src/battery.cpp acpitool-0.5.1/src/battery.cpp
--- acpitool-0.5.1.orig/src/battery.cpp 2018-10-26 14:08:08.527714586 -0600
+++ acpitool-0.5.1/src/battery.cpp 2018-10-26 14:34:12.828762620 -0600
@@ -355,7 +355,8 @@
char filename[4][65], str[100], temp[100];
int bat_count = 0, start = 0, findex = 0;
DIR *battery_dir;
- char *name, *dirname;
+ char *name;
+ char const *dirname;
dirname = "/proc/acpi/battery/"; //find all entries in this dir
// dirname = "/home/david/dropzone/data/devel/acpi/battery/"; // keep this for testing //
@@ -538,7 +539,8 @@
char filename[6][65], str[100], temp[100], attr[100];
int bat_count = 0, start = 0, findex = 0, value = 0;
DIR *battery_dir;
- char *name, *dirname;
+ char *name;
+ char const *dirname;
dirname = "/sys/class/power_supply/"; //find all entries in this dir
@@ -743,7 +745,8 @@
int Count_Batteries_ProcFS()
{
DIR *battery_dir;
- char *name, *dirname;
+ char *name;
+ char const *dirname;
int t = 0;
dirname = "/proc/acpi/battery/";
@@ -789,7 +792,8 @@
{
DIR *battery_dir;
char filename[4][65], str[100];
- char *name, *dirname;
+ char *name;
+ char const *dirname;
int findex = 0, batcount = 0;
/* Since kernel 2.6.24, the acpi interface is gradually being moved from /proc/acpi/... to the sys filesystem. */
diff -NaurEZbwB acpitool-0.5.1.orig/src/cpu.cpp acpitool-0.5.1/src/cpu.cpp
--- acpitool-0.5.1.orig/src/cpu.cpp 2018-10-26 14:08:08.527714586 -0600
+++ acpitool-0.5.1/src/cpu.cpp 2018-10-26 14:29:35.222273504 -0600
@@ -48,7 +48,8 @@
int Show_CPU_Info()
{
ifstream file_in, file2_in;
- char *dirname, filename[25][70], str[300], temp[130];
+ char const *dirname;
+ char filename[25][70], str[300], temp[130];
int cpu_count = 0, findex = 0, thrott = 0;
long int max_cstate = 0, cst_cnt = 0, cst_usage_abs[8],
cst_usage_notC0 = 0;
diff -NaurEZbwB acpitool-0.5.1.orig/src/thinkpad.cpp acpitool-0.5.1/src/thinkpad.cpp
--- acpitool-0.5.1.orig/src/thinkpad.cpp 2018-10-26 14:08:08.526714577 -0600
+++ acpitool-0.5.1/src/thinkpad.cpp 2018-10-26 14:31:29.979302456 -0600
@@ -12,7 +12,7 @@
int Has_Thinkpad_ACPI()
{
ifstream file_in;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/ibm";
@@ -27,7 +27,7 @@
int Eject_Thinkpad_Bay()
{
ofstream bay;
- char *filename;
+ char const *filename;
if (!Has_Thinkpad_ACPI())
{
@@ -54,7 +54,7 @@
int Set_Thinkpad_LCD_Level(int z)
{
ofstream bright;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/ibm/brightness";
@@ -78,7 +78,8 @@
int Do_Thinkpad_Fan_Info()
{
ifstream fan;
- char *filename, *status, *speed;
+ char const *filename;
+ char *status, *speed;
char line[32];
int i;
diff -NaurEZbwB acpitool-0.5.1.orig/src/toshiba.cpp acpitool-0.5.1/src/toshiba.cpp
--- acpitool-0.5.1.orig/src/toshiba.cpp 2018-10-26 14:08:08.526714577 -0600
+++ acpitool-0.5.1/src/toshiba.cpp 2018-10-26 14:26:28.736601409 -0600
@@ -45,7 +45,7 @@
int Has_Toshiba_ACPI()
{
ifstream file_in;
- char *filename;
+ char const *filename;
filename = "/proc/acpi/toshiba";
@@ -82,7 +82,8 @@
int Do_Toshiba_Fan_Info()
{
ifstream file_in;
- char *filename, str[40];
+ char const *filename;
+ char str[40];
filename = "/proc/acpi/toshiba/fan";
@@ -132,7 +133,8 @@
int Do_LCD_Info()
{
ifstream file_in;
- char *filename, str[40];
+ char const *filename;
+ char str[40];
filename = "/proc/acpi/toshiba/lcd";
@@ -166,7 +168,8 @@
int Force_Fan(int s)
{
ofstream file_out;
- char *filename, str[15];
+ char const *filename;
+ char str[15];
filename = "/proc/acpi/toshiba/fan";
@@ -200,7 +203,8 @@
int Set_LCD_Level(int l)
{
ofstream file_out;
- char *filename, str[15];
+ char const *filename;
+ char str[15];
filename = "/proc/acpi/toshiba/lcd";
@@ -230,7 +234,8 @@
int Do_Video_Info()
{
ifstream file_in;
- char *filename, str[40];
+ char const *filename;
+ char str[40];
int lcd, crt;
filename = "/proc/acpi/toshiba/video";

12
kernel3.patch Normal file
View file

@ -0,0 +1,12 @@
--- acpitool-0.5.1/src/acpitool.cpp 2009-08-13 14:37:48.000000000 -0500
+++ acpitool-0.5.1/src/acpitool.cpp 2011-07-28 08:40:37.000000000 -0500
@@ -205,8 +205,7 @@
Kernel_24 = 1;
Kernel_26 = 0;
}
-
- if(strncmp(str,"2.6",3)==0)
+ else
{
Kernel_24 = 0;
Kernel_26 = 1;

View file

@ -1 +1 @@
6f9fb795790e370e8e324fc7d4d4fe3f acpitool-0.3.0.tar.gz
9e4ec55201be0be71ffbc56d38b42b57 acpitool-0.5.1.tar.bz2

29
typos.patch Normal file
View file

@ -0,0 +1,29 @@
--- acpitool/man/acpitool.1 2012-01-13 07:56:18.000000000 -0500
+++ acpitool/man/acpitool.1 2012-08-10 00:07:25.646700871 -0400
@@ -33,7 +33,7 @@
.I /proc/acpi
or
.I /sys/class
-entries and presents the output in a meaningfull, human-readable format.
+entries and presents the output in a meaningful, human-readable format.
.br
It provides a.o. information on battery status, AC adapter presence, thermal reading, etc. This command is
@@ -46,7 +46,7 @@
If your laptop is a
.B Toshiba
-, it allows you to set the LCD brighness level and toggle the fan on/off.
+, it allows you to set the LCD brightness level and toggle the fan on/off.
.br
If you have an
@@ -98,7 +98,7 @@
.B \-l x
Set LCD brightness level to x, where x is in the range 0..7. Works only on Toshiba and IBM Thinkpad laptops.
Requires write access to
-.I /proc/acpi/tochiba/lcd
+.I /proc/acpi/toshiba/lcd
or
.I /proc/acpi/ibm/brightness
.

48
var-line.patch Normal file
View file

@ -0,0 +1,48 @@
From 2f16822b9487a951ac898fd6703a7f8c7cd4ce06 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 15 Nov 2014 11:59:37 +0100
Subject: [PATCH] Do not assume fixed line lengths for /proc/acpi/wakeup file
The lines in that file might be equal or longer than 40 characters, which
means that the getline() call will truncate them, possibly at the wrong
place, and then be unable to proceed, as subsequent calls will get stuck
waiting for input that is not coming.
---
src/acpitool.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/acpitool.cpp b/src/acpitool.cpp
index f3beeca..e85a7c1 100644
--- a/src/acpitool.cpp
+++ b/src/acpitool.cpp
@@ -416,7 +416,8 @@ int Do_Fan_Info(int verbose)
int Show_WakeUp_Devices(int verbose)
{
ifstream file_in;
- char *filename, str[40];
+ char *filename;
+ string str;
filename = "/proc/acpi/wakeup";
@@ -437,14 +438,14 @@ int Show_WakeUp_Devices(int verbose)
}
else
{
- file_in.getline(str, 40); // first line are just headers //
+ getline(file_in, str); // first line are just headers //
cout<<" "<<str<<endl;
cout<<" ---------------------------------------"<<endl;
int t = 1;
while(!file_in.eof())
{
- file_in.getline(str, 40);
- if (strlen(str)!=0) // avoid printing last empty line //
+ getline(file_in, str);
+ if (str.length()!=0) // avoid printing last empty line //
{
cout<<" "<<t<<". "<<str<<endl;
t++;
--
2.1.3

70
wakeup.patch Normal file
View file

@ -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
@@ -459,16 +459,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)
{
@@ -483,14 +481,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