Bug#479096: [xbattbar-acpi] No battery detected with kernel 2.6.25
Control: severity -1 grave Control: block 574678 by -1 This bug break libacpi completely, and all users of the library are unable to get battery status because of this. As this make the library almost unusable, I set the severity to grave. In addition to xbattbar-acpi, it break battery-stats too (bug #574678). If the library isn't fixed, it should not be included in the next stable release. -- Vennlig hilsen Petter Reinholdtsen
Bug#479096: [xbattbar-acpi] No battery detected with kernel 2.6.25
Hi, suffering from the same problems, I hacked up a working combination of libacpi + yacpi (which I use) for 2.6.25. Unfortunately the patch needs to change the API as I really needed to get to the global-sysstyle. So when applying these patches, the so-number needs to be bumped. In the README I see that there is another change outstanding neccessitating such an increment, namely exporting the acpi version in the structure. Maybe this can be done together? Also the new version is not backwards compatible, i.e. it simply replaces the file names by the new versions. It should be easy however to add probes for both versions so that we are backward compatible. I was simply not sure how to do that in a suiting elegant way ;) Cheers Detlev diff -ur orig/libacpi-0.2/libacpi.c libacpi-0.2/libacpi.c --- orig/libacpi-0.2/libacpi.c 2008-06-09 18:56:56.0 +0200 +++ libacpi-0.2/libacpi.c 2008-06-08 18:23:33.0 +0200 @@ -17,7 +17,7 @@ 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 int read_acpi_battstate(const int num, const int sysstyle); static void read_acpi_thermalzones(global_t *globals); typedef struct { @@ -195,6 +195,7 @@ snprintf(binfo-alarm_file, MAX_NAME, PROC_ACPI battery/%s/alarm, names[i]); } read_acpi_battinfo(i, globals-sysstyle); + read_acpi_battstate(i, globals-sysstyle); read_acpi_battalarm(i, globals-sysstyle); free(names[i]); } @@ -536,17 +537,17 @@ return NOT_PRESENT; } - snprintf(sysfile, MAX_NAME, %s/charge_full_design, info-info_file); + 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); + 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); + 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); @@ -610,11 +611,29 @@ /* read information for battery num, return 0 on success or negative values on error */ static int -read_acpi_battstate(const int num){ +read_acpi_battstate(const int num, const int sysstyle){ char *buf = NULL; char *tmp = NULL; battery_t *info = batteries[num]; unsigned int i = 0; + char sysfile[MAX_NAME]; + + if(sysstyle) + { + 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((buf = get_acpi_content(info-state_file)) == NULL) return NOT_SUPPORTED; @@ -700,10 +719,10 @@ /* read/refresh information about a given battery num * returns 0 on SUCCESS, negative values on errors */ int -read_acpi_batt(const int num){ +read_acpi_batt(const int num, global_t *globals){ if(num MAX_ITEMS) return ITEM_EXCEED; - read_acpi_battstate(num); - read_acpi_battalarm(num, 0); + read_acpi_battstate(num, globals-sysstyle); + read_acpi_battalarm(num, globals-sysstyle); calc_remain_perc(num); calc_remain_chargetime(num); calc_remain_time(num); diff -ur orig/libacpi-0.2/libacpi.h libacpi-0.2/libacpi.h --- orig/libacpi-0.2/libacpi.h 2008-06-09 18:56:56.0 +0200 +++ libacpi-0.2/libacpi.h 2008-06-08 15:19:58.0 +0200 @@ -237,7 +237,7 @@ * a struct with it * @param num number of battery */ -int read_acpi_batt(const int num); +int read_acpi_batt(const int num, global_t *globals); /** * Looks up if the ac adapter is plugged in or not * and sets the values in a struct diff -ur orig/libacpi-0.2/test-libacpi.c libacpi-0.2/test-libacpi.c --- orig/libacpi-0.2/test-libacpi.c 2008-06-09 18:56:56.0 +0200 +++ libacpi-0.2/test-libacpi.c 2008-06-08 15:21:44.0 +0200 @@ -43,7 +43,7 @@ for(i=0;iglobal-batt_count;i++){ binfo = batteries[i]; /* read current battery values */ - read_acpi_batt(i); + read_acpi_batt(i, global); if(binfo-present) { diff -ur orig/yacpi-3.0/yacpi.c yacpi-3.0/yacpi.c --- orig/yacpi-3.0/yacpi.c 2007-08-09 18:47:47.0 +0200 +++ yacpi-3.0/yacpi.c 2008-06-08 17:52:27.0 +0200 @@ -362,7 +363,7 @@ binfo = batteries[i]; if(!binfo) return; /* read current battery values */ - read_acpi_batt(i); + read_acpi_batt(i, global); if(binfo binfo-present){ if(t) printf(| %s = %d%%, binfo-name, binfo-percentage);
Bug#479096: [xbattbar-acpi] No battery detected with kernel 2.6.25
Hi Detlev, * Detlev Zundel [EMAIL PROTECTED] [2008-06-09 20:50]: suffering from the same problems, I hacked up a working combination of libacpi + yacpi (which I use) for 2.6.25. Unfortunately the patch needs to change the API as I really needed to get to the global-sysstyle. That's why I want a clean solution that checks for proc or sysfs and internally does all the things soo no ABI change is needed. Still on my todo list. Please check out http://hg.modprobe.de/libacpi/ if you write patches. Cheers Nico -- Nico Golde - http://www.ngolde.de - [EMAIL PROTECTED] - GPG: 0x73647CFF For security reasons, all text in this mail is double-rot13 encrypted. pgpXuBYe5K1Fk.pgp Description: PGP signature
Bug#479096: [xbattbar-acpi] No battery detected with kernel 2.6.25
On Fri, 2 May 2008 19:02:58 +0100, Antoine Sirinelli [EMAIL PROTECTED] wrote: I join strace output of xbattbar-acpi running with 2.6.24-1 kernel and a 2.6.25-1 kernel. It seems it has trouble evaluating the informations in /sys/class/power_supply/ instead of /proc/acpi/. The directories /proc/acpi/battery/* and /proc/acpi/ac_adapter/* are deprecated and replaced by /sys/class/power_supply/*. xbattbar-acpi gets informations in /proc/acpi/* through the libacpi and not directly, therefore I reassign this bug to libacpi. -- Francesco Polsinelli [EMAIL PROTECTED] JID: [EMAIL PROTECTED] GnuPG Key ID: 0x261FD1CE Key fingerprint: 7CB5 8AC3 1A0D CB39 310A C283 38FA 73A7 261F D1CE signature.asc Description: PGP signature
Bug#479096: [xbattbar-acpi] No battery detected with kernel 2.6.25
Hi, thanks for reassigning this bug. You are right, libacpi currently reads information from proc and has some hack in it in Debian to read some information from the sysfs. However reimplementing parts and having a clean sysfs + procfs implementation as fallback is still on my todo list, sadly I am too busy with other stuff atm. Patches welcome. Kind regards Nico -- Nico Golde - http://www.ngolde.de - [EMAIL PROTECTED] - GPG: 0x73647CFF For security reasons, all text in this mail is double-rot13 encrypted. pgpvDNYiQi0if.pgp Description: PGP signature
Bug#479096: [xbattbar-acpi] No battery detected with kernel 2.6.25
Package: xbattbar-acpi Version: 0.4.0-1 Severity: serious --- Please enter the report below this line. --- After upgrading the kernel to the new Debian 2.6.25-1 one, xbattbar-acpi is no longer working. Now, the OSD information gives no battery. It is working with the Debian kernel 2.6.24-1. I join strace output of xbattbar-acpi running with 2.6.24-1 kernel and a 2.6.25-1 kernel. It seems it has trouble evaluating the informations in /sys/class/power_supply/ instead of /proc/acpi/. Antoine --- System information. --- Architecture: i386 Kernel: Linux 2.6.25-1-686 Debian Release: lenny/sid 500 unstablemirrors.powersource.cx 500 unstableftp.fr.debian.org 500 kernel-dists-trunk kernel-archive.buildserver.net --- Package information. --- Depends (Version) | Installed =-+-= libacpi0 | 0.2-4 libc6(= 2.6.1-1) | 2.7-10 libx11-6 | 2:1.0.3-7 libxext6 | 2:1.0.4-1 libxinerama1 | 2:1.0.3-1 libxosd2 (= 2.2.13) | 2.2.14-1.5 execve(/usr/bin/xbattbar-acpi, [xbattbar-acpi], [/* 32 vars */]) = 0 brk(0) = 0x806 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory) mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f49000 access(/etc/ld.so.preload, R_OK) = -1 ENOENT (No such file or directory) open(/etc/ld.so.cache, O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=129944, ...}) = 0 mmap2(NULL, 129944, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f29000 close(3)= 0 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory) open(/usr/lib/libXext.so.6, O_RDONLY) = 3 read(3, [EMAIL PROTECTED]..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0644, st_size=53788, ...}) = 0 mmap2(NULL, 56956, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f1b000 mmap2(0xb7f28000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc) = 0xb7f28000 close(3)= 0 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory) open(/usr/lib/libacpi.so.0, O_RDONLY) = 3 read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 \n\0\000..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0644, st_size=14316, ...}) = 0 mmap2(NULL, 79680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f07000 mmap2(0xb7f0b000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3) = 0xb7f0b000 mmap2(0xb7f0c000, 59200, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f0c000 close(3)= 0 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory) open(/usr/lib/libxosd.so.2, O_RDONLY) = 3 read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\33\0\000..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0644, st_size=19996, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f06000 mmap2(NULL, 22968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f0 mmap2(0xb7f05000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4) = 0xb7f05000 close(3)= 0 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory) open(/lib/i686/cmov/libpthread.so.0, O_RDONLY) = 3 read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20H\0\000..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=112354, ...}) = 0 mmap2(NULL, 94688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7ee8000 mmap2(0xb7efc000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13) = 0xb7efc000 mmap2(0xb7efe000, 4576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7efe000 close(3)= 0 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory) open(/usr/lib/libX11.so.6, O_RDONLY) = 3 read(3, [EMAIL PROTECTED]..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0644, st_size=965952, ...}) = 0 mmap2(NULL, 966364, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7dfc000 mmap2(0xb7ee4000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe8) = 0xb7ee4000 close(3)= 0 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory) open(/usr/lib/libXinerama.so.1, O_RDONLY) = 3 read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340\7\0..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0644, st_size=6496, ...}) = 0 mmap2(NULL, 9340, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7df9000 mmap2(0xb7dfb000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xb7dfb000 close(3)= 0 access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory)