From svenjoac@gmx.de Sun Aug 3 00:36:29 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-7.6 required=4.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_MED,X_DEBBUGS_CC autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 3 Aug 2008 07:36:29 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m737aPGF023636 for ; Sun, 3 Aug 2008 00:36:27 -0700 Received: from mx10.gnu.org ([199.232.76.166]:40687) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1KPY7j-0002c1-D7 for emacs-pretest-bug@gnu.org; Sun, 03 Aug 2008 03:35:27 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1KPY8a-0000Y5-Q4 for emacs-pretest-bug@gnu.org; Sun, 03 Aug 2008 03:36:25 -0400 Received: from mail.gmx.net ([213.165.64.20]:39923) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KPY8a-0000XL-3d for emacs-pretest-bug@gnu.org; Sun, 03 Aug 2008 03:36:20 -0400 Received: (qmail invoked by alias); 03 Aug 2008 07:09:36 -0000 Received: from p54865763.dip.t-dialin.net (EHLO debian) [84.134.87.99] by mail.gmx.net (mp035) with SMTP; 03 Aug 2008 09:09:36 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX19pxblwT9FpcXVUN64tl5N0xbTcoQHsIQIusz03so Trolo68lqxx1Ed From: Sven Joachim To: emacs-pretest-bug@gnu.org Subject: 23.0.60; battery.el needs deprecated ACPI_PROCFS_POWER interface X-Debbugs-CC: Sven Joachim Date: Sun, 03 Aug 2008 09:04:05 +0200 Message-ID: <87zlnuinq2.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.63 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) In recent Linux kernels, the information about battery status has been moved from /proc/acpi/battery to /sys/class/power_supply. It is only available from the former place if the kernel has been built with the ACPI_PROCFS_POWER option, which is deprecated: ,----[ /usr/src/linux-2.6.26.1/drivers/acpi/Kconfig ] | config ACPI_PROCFS_POWER | bool "Deprecated power /proc/acpi directories" | depends on PROC_FS | default y | ---help--- | For backwards compatibility, this option allows | deprecated power /proc/acpi/ directories to exist, even when | they have been replaced by functions in /sys. | The deprecated directories (and their replacements) include: | /proc/acpi/battery/* (/sys/class/power_supply/*) | /proc/acpi/ac_adapter/* (sys/class/power_supply/*) | This option has no effect on /proc/acpi/ directories | and functions, which do not yet exist in /sys | | Say N to delete power /proc/acpi/ directories that have moved to /sys/ | `---- At least Debian ships kernels that are built without ACPI_PROCFS_POWER, so battery.el will not work with them. Sven From cyd@stupidchicken.com Wed Aug 6 18:57:20 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at control) by emacsbugs.donarmstrong.com; 7 Aug 2008 01:57:20 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m771vHHZ031248 for ; Wed, 6 Aug 2008 18:57:18 -0700 Received: by cyd (Postfix, from userid 1000) id 5523357E17C; Wed, 6 Aug 2008 21:57:16 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: Battery bugs Date: Wed, 06 Aug 2008 21:57:15 -0400 Message-ID: <87ej51d1tw.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii merge 643 660 thanks From cyd@stupidchicken.com Thu Aug 7 09:35:39 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.2 required=4.0 tests=AWL,BAYES_00,FOURLA, MURPHY_DRUGS_REL8 autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 16:35:39 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77GZabZ006027 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 09:35:37 -0700 Received: by cyd (Postfix, from userid 1000) id 11B6257E17C; Thu, 7 Aug 2008 12:35:39 -0400 (EDT) From: Chong Yidong To: emacs-devel@gnu.org Cc: Emre Sahin , 643@debbugs.gnu.org Subject: Battery update Date: Thu, 07 Aug 2008 12:35:39 -0400 Message-ID: <87bq04dbqc.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii The Linux kernel developers have deprecated the longstanding /proc/acpi interface, which breaks battery.el on recent kernels (bug#643 and bug#660). Now, the battery information is supposed to come through sysfs. Even though it's the feature freeze, I think it's necessary to ensure that battery.el works at least at a basic level. So, here's a patch that adds primitive sysfs support for battery.el. It doesn't do as much as before, because AFAICT the new sysfs interface provides less information than the old acpi interface (go figure). It's lightly tested. Could someone try this out and see if it does the right thing? *** trunk/lisp/battery.el.~1.46.~ 2008-05-06 03:57:26.000000000 -0400 --- trunk/lisp/battery.el 2008-08-07 12:34:45.000000000 -0400 *************** *** 47,52 **** --- 47,56 ---- ((and (eq system-type 'gnu/linux) (file-directory-p "/proc/acpi/battery")) 'battery-linux-proc-acpi) + ((and (eq system-type 'gnu/linux) + (file-directory-p "/sys/class/power_supply/") + (directory-files "/sys/class/power_supply/" nil "BAT[0-9]$")) + 'battery-linux-sysfs) ((and (eq system-type 'darwin) (condition-case nil (with-temp-buffer *************** *** 70,75 **** --- 74,81 ---- (defcustom battery-echo-area-format (cond ((eq battery-status-function 'battery-linux-proc-acpi) "Power %L, battery %B at %r (%p%% load, remaining time %t)") + ((eq battery-status-function 'battery-linux-sysfs) + "Power %L, battery %B (%p%% load)") ((eq battery-status-function 'battery-pmset) "%L power, battery %B (%p%% load, remaining time %t)") (battery-status-function *************** *** 276,282 **** (defun battery-linux-proc-acpi () "Get ACPI status information from Linux kernel. ! This function works only with the new `/proc/acpi/' format introduced in Linux version 2.4.20 and 2.6.0. The following %-sequences are provided: --- 282,288 ---- (defun battery-linux-proc-acpi () "Get ACPI status information from Linux kernel. ! This function works only with the `/proc/acpi/' format introduced in Linux version 2.4.20 and 2.6.0. The following %-sequences are provided: *************** *** 390,395 **** --- 396,480 ---- "N/A"))))) + ;;; `/sys/class/power_supply/BATN' interface for Linux. + + (defun battery-linux-sysfs () + "Get ACPI status information from Linux kernel. + This function works only with the new `/sys/class/power_supply/BAT' + format introduced in Linux version 2.4.25. + + The following %-sequences are provided: + %c Current capacity (mAh or mWh) + %B Battery status (verbose) + %p Battery load percentage + %L AC line status (verbose)" + (let (charging-state + (charge-full 0) + (charge-now 0) + (energy-full 0) + (energy-now 0)) + ;; SysFS provides information about each battery present in the + ;; system in a separate subdirectory. We are going to merge the + ;; available information together. + (with-temp-buffer + (dolist (dir (ignore-errors + (directory-files + "/sys/class/power_supply/" t "BAT[0-9]$"))) + (erase-buffer) + (ignore-errors (insert-file-contents + (expand-file-name "uevent" dir))) + (when (re-search-forward "POWER_SUPPLY_PRESENT=1$" nil t) + (goto-char (point-min)) + (and (re-search-forward "POWER_SUPPLY_STATUS=\\(.*\\)$" nil t) + ;; On most multi-battery systems, most of the time only + ;; one battery is "charging"/"discharging", the others + ;; are "unknown". + (member charging-state '("Unknown" "Full" nil)) + (setq charging-state (match-string 1))) + (let (full-string now-string) + ;; Energy or charge + (cond ((and (re-search-forward + "POWER_SUPPLY_CHARGE_FULL=\\([0-9]*\\)$" nil t) + (setq full-string (match-string 1)) + (re-search-forward + "POWER_SUPPLY_CHARGE_NOW=\\([0-9]*\\)$" nil t) + (setq now-string (match-string 1))) + (setq charge-full (+ charge-full + (string-to-number full-string)) + charge-now (+ charge-now + (string-to-number now-string)))) + ((and (re-search-forward + "POWER_SUPPLY_ENERGY_FULL=\\([0-9]*\\)$" nil t) + (setq full-string (match-string 1)) + (re-search-forward + "POWER_SUPPLY_ENERGY_NOW=\\([0-9]*\\)$" nil t) + (setq now-string (match-string 1))) + (setq energy-full (+ energy-full + (string-to-number full-string)) + energy-now (+ energy-now + (string-to-number now-string))))))))) + (list (cons ?c (cond ((or (> charge-full 0) (> charge-now 0)) + (number-to-string charge-now)) + ((or (> energy-full 0) (> energy-now 0)) + (number-to-string energy-now)) + (t "N/A"))) + (cons ?B (or charging-state "N/A")) + (cons ?p (cond ((> charge-full 0) + (format "%.1f" + (/ (* 100 charge-now) (float charge-full)))) + ((> energy-full 0) + (format "%.1f" + (/ (* 100 energy-now) (float energy-full)))) + (t "N/A"))) + (cons ?L (if (file-readable-p "/sys/class/power_supply/AC/online") + (if (battery-search-for-one-match-in-files + "/sys/class/power_supply/AC/online" "1" 0) + "AC" + "BAT") + "N/A"))))) + + + ;;; `pmset' interface for Darwin (OS X). (defun battery-pmset () From cyd@stupidchicken.com Thu Aug 7 10:34:23 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-1.8 required=4.0 tests=AWL,BAYES_05, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at control) by emacsbugs.donarmstrong.com; 7 Aug 2008 17:34:23 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77HYK0X023277 for ; Thu, 7 Aug 2008 10:34:21 -0700 Received: by cyd (Postfix, from userid 1000) id 2B20B57E17C; Thu, 7 Aug 2008 13:34:22 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: Bug maintenance Date: Thu, 07 Aug 2008 13:34:21 -0400 Message-ID: <87zlno20gy.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii close 328 tags 455 unreproducible moreinfo tags 535 wontfix close 667 tags 663 patch severity 663 wishlist close 649 close 650 close 654 close 658 close 661 merge 643 660 close 662 thanks From svenjoac@gmx.de Thu Aug 7 11:13:42 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.2 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 18:13:42 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m77IDcod003324 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 11:13:39 -0700 Received: (qmail invoked by alias); 07 Aug 2008 18:13:32 -0000 Received: from p54866F35.dip.t-dialin.net (EHLO debian) [84.134.111.53] by mail.gmx.net (mp019) with SMTP; 07 Aug 2008 20:13:32 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX19sLB1vm+Rs8GT1ho+m3CKVnReyoh5RKPXPcpC6Dt NHc9d2di3G1NgE From: Sven Joachim To: Chong Yidong Cc: emacs-devel@gnu.org, 643@debbugs.gnu.org, Emre Sahin Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> Date: Thu, 07 Aug 2008 20:09:48 +0200 In-Reply-To: <87bq04dbqc.fsf@stupidchicken.com> (Chong Yidong's message of "Thu, 07 Aug 2008 12:35:39 -0400") Message-ID: <87ej50g0ib.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.64 On 2008-08-07 18:35 +0200, Chong Yidong wrote: > The Linux kernel developers have deprecated the longstanding /proc/acpi > interface, which breaks battery.el on recent kernels (bug#643 and > bug#660). Now, the battery information is supposed to come through > sysfs. > > Even though it's the feature freeze, I think it's necessary to ensure > that battery.el works at least at a basic level. So, here's a patch > that adds primitive sysfs support for battery.el. It doesn't do as much > as before, because AFAICT the new sysfs interface provides less > information than the old acpi interface (go figure). > > It's lightly tested. Could someone try this out and see if it does the > right thing? The results are funny on my laptop (battery full, online): Power N/A, battery Full at (-34.7% load, remaining time) Sven From lennart.borgman@gmail.com Thu Aug 7 11:19:14 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-7.2 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 18:19:14 +0000 Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77IJAFW004812 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 11:19:12 -0700 Received: from c83-254-151-176.bredband.comhem.se ([83.254.151.176]:64153 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1KRA4r-0007Ua-5f; Thu, 07 Aug 2008 20:19:09 +0200 Message-ID: <489B3C91.7010605@gmail.com> Date: Thu, 07 Aug 2008 20:18:57 +0200 From: "Lennart Borgman (gmail)" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Chong Yidong , 643@debbugs.gnu.org CC: emacs-devel@gnu.org, Emre Sahin Subject: Re: bug#643: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> In-Reply-To: <87bq04dbqc.fsf@stupidchicken.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 080807-0, 2008-08-07), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.151.176 X-Scan-Result: No virus found in message 1KRA4r-0007Ua-5f. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1KRA4r-0007Ua-5f f3bef03eea4f7bc268e835aef7a00458 Chong Yidong wrote: > Even though it's the feature freeze, I think it's necessary to ensure > that battery.el works at least at a basic level. Just out of curiosity: Why is it necessary that battery.el works? Is not this information something that the OS normally gives the user without Emacs? From cyd@stupidchicken.com Thu Aug 7 11:19:34 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 18:19:34 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77IJVfn004879 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 11:19:32 -0700 Received: by cyd (Postfix, from userid 1000) id E3A1157E17C; Thu, 7 Aug 2008 14:19:34 -0400 (EDT) From: Chong Yidong To: Sven Joachim Cc: emacs-devel@gnu.org, 643@debbugs.gnu.org, Emre Sahin Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> Date: Thu, 07 Aug 2008 14:19:34 -0400 In-Reply-To: <87ej50g0ib.fsf@gmx.de> (Sven Joachim's message of "Thu, 07 Aug 2008 20:09:48 +0200") Message-ID: <87bq048z7t.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sven Joachim writes: > The results are funny on my laptop (battery full, online): > > Power N/A, battery Full at (-34.7% load, remaining time) What does M-: (battery-linux-sysfs) return? From david@harpegolden.net Thu Aug 7 11:54:58 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.2 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, SPF_HELO_PASS autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 18:54:58 +0000 Received: from harpegolden.net (harpegolden.net [65.99.215.13]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77IstIS015272 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 11:54:57 -0700 Received: from golden1.harpegolden.net (86-43-172-194.b-ras2.prp.dublin.eircom.net [86.43.172.194]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTP id 847D58179; Thu, 7 Aug 2008 18:54:53 +0000 (UTC) Message-ID: <489B44D6.4020706@harpegolden.net> Date: Thu, 07 Aug 2008 19:54:14 +0100 From: David De La Harpe Golden User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: "Lennart Borgman (gmail)" CC: Chong Yidong , 643@debbugs.gnu.org, Emre Sahin , emacs-devel@gnu.org Subject: Re: bug#643: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <489B3C91.7010605@gmail.com> In-Reply-To: <489B3C91.7010605@gmail.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Lennart Borgman (gmail) wrote: > Chong Yidong wrote: >> Even though it's the feature freeze, I think it's necessary to ensure >> that battery.el works at least at a basic level. > > Just out of curiosity: Why is it necessary that battery.el works? Is not > this information something that the OS normally gives the user without > Emacs? > not if you're running emacs fullscreen I guess, can't see a tray icon then... From svenjoac@gmx.de Thu Aug 7 12:15:44 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.2 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 19:15:44 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m77JFexc023163 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 12:15:42 -0700 Received: (qmail invoked by alias); 07 Aug 2008 19:15:35 -0000 Received: from p54866457.dip.t-dialin.net (EHLO debian) [84.134.100.87] by mail.gmx.net (mp004) with SMTP; 07 Aug 2008 21:15:35 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX18EGYhe4kAElUvGA+oMQ9fOsfvkT8BH29WmcOicvX lqTl9TEbHPYE6y From: Sven Joachim To: Chong Yidong Cc: 643@debbugs.gnu.org, Emre Sahin , emacs-devel@gnu.org Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> Date: Thu, 07 Aug 2008 21:11:56 +0200 In-Reply-To: <87bq048z7t.fsf@stupidchicken.com> (Chong Yidong's message of "Thu, 07 Aug 2008 14:19:34 -0400") Message-ID: <878wv8fxmr.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 On 2008-08-07 20:19 +0200, Chong Yidong wrote: > Sven Joachim writes: > >> The results are funny on my laptop (battery full, online): >> >> Power N/A, battery Full at (-34.7% load, remaining time) > > What does > > M-: (battery-linux-sysfs) > > return? ((99 . "3985000") (66 . "Full") (112 . "-34.7") (76 . "N/A")) Sven From cyd@stupidchicken.com Thu Aug 7 12:28:38 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 19:28:39 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77JSaV1026354 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 12:28:37 -0700 Received: by cyd (Postfix, from userid 1000) id D890557E17C; Thu, 7 Aug 2008 15:28:39 -0400 (EDT) From: Chong Yidong To: Sven Joachim Cc: 643@debbugs.gnu.org, Emre Sahin , emacs-devel@gnu.org Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> Date: Thu, 07 Aug 2008 15:28:39 -0400 In-Reply-To: <878wv8fxmr.fsf@gmx.de> (Sven Joachim's message of "Thu, 07 Aug 2008 21:11:56 +0200") Message-ID: <87abfo4obc.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sven Joachim writes: > On 2008-08-07 20:19 +0200, Chong Yidong wrote: > >> Sven Joachim writes: >> >>> The results are funny on my laptop (battery full, online): >>> >>> Power N/A, battery Full at (-34.7% load, remaining time) >> >> What does >> >> M-: (battery-linux-sysfs) >> >> return? > > ((99 . "3985000") (66 . "Full") (112 . "-34.7") (76 . "N/A")) What about (from the shell) cat /sys/class/power_supply/BAT0/uevent ? From svenjoac@gmx.de Thu Aug 7 12:49:35 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.4 required=4.0 tests=AWL,BAYES_00,FOURLA, UPPERCASE_50_75 autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 19:49:35 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m77JnVXq032292 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 12:49:32 -0700 Received: (qmail invoked by alias); 07 Aug 2008 19:49:25 -0000 Received: from p5486615B.dip.t-dialin.net (EHLO debian) [84.134.97.91] by mail.gmx.net (mp033) with SMTP; 07 Aug 2008 21:49:25 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX18Srq0GKKQSegoguz/CXqhPKKipm0va16er6w/DBW Ab+OpZgNHaHSYb From: Sven Joachim To: Chong Yidong Cc: 643@debbugs.gnu.org, Emre Sahin , emacs-devel@gnu.org Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> <87abfo4obc.fsf@stupidchicken.com> Date: Thu, 07 Aug 2008 21:45:46 +0200 In-Reply-To: <87abfo4obc.fsf@stupidchicken.com> (Chong Yidong's message of "Thu, 07 Aug 2008 15:28:39 -0400") Message-ID: <873algfw2d.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.57 On 2008-08-07 21:28 +0200, Chong Yidong wrote: > What about (from the shell) > > cat /sys/class/power_supply/BAT0/uevent > > ? No such file or directory, but here's /sys/class/power_supply/BAT1/uevent: PHYSDEVPATH=/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:2c/PNP0C0A:00 PHYSDEVBUS=acpi PHYSDEVDRIVER=battery POWER_SUPPLY_NAME=BAT1 POWER_SUPPLY_TYPE=Battery POWER_SUPPLY_STATUS=Full POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_TECHNOLOGY=Li-ion POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000 POWER_SUPPLY_VOLTAGE_NOW=12444000 POWER_SUPPLY_CURRENT_NOW=0 POWER_SUPPLY_CHARGE_FULL_DESIGN=4000000 POWER_SUPPLY_CHARGE_FULL=3985000 POWER_SUPPLY_CHARGE_NOW=3985000 POWER_SUPPLY_MODEL_NAME=GC86503SY90 POWER_SUPPLY_MANUFACTURER=SONY POWER_SUPPLY_SERIAL_NUMBER= Sven From cyd@stupidchicken.com Thu Aug 7 13:33:00 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.2 required=4.0 tests=AWL,BAYES_00,FOURLA, MURPHY_DRUGS_REL8 autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 20:33:00 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77KWuRk013770 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 13:32:58 -0700 Received: by cyd (Postfix, from userid 1000) id 8E2E357E17D; Thu, 7 Aug 2008 16:33:00 -0400 (EDT) From: Chong Yidong To: Sven Joachim Cc: 643@debbugs.gnu.org, Emre Sahin , emacs-devel@gnu.org Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> <87abfo4obc.fsf@stupidchicken.com> <873algfw2d.fsf@gmx.de> Date: Thu, 07 Aug 2008 16:32:59 -0400 In-Reply-To: <873algfw2d.fsf@gmx.de> (Sven Joachim's message of "Thu, 07 Aug 2008 21:45:46 +0200") Message-ID: <87bq04r2f8.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sven Joachim writes: >> What about (from the shell) >> >> cat /sys/class/power_supply/BAT0/uevent > > POWER_SUPPLY_VOLTAGE_NOW=12444000 > POWER_SUPPLY_CURRENT_NOW=0 > POWER_SUPPLY_CHARGE_FULL_DESIGN=4000000 > POWER_SUPPLY_CHARGE_FULL=3985000 > POWER_SUPPLY_CHARGE_NOW=3985000 > POWER_SUPPLY_MODEL_NAME=GC86503SY90 > POWER_SUPPLY_MANUFACTURER=SONY > POWER_SUPPLY_SERIAL_NUMBER= Maybe it's a Lisp integer overflow (I'm guessing you're on a 32-bit machine). Does the following patch give better results? *** trunk/lisp/battery.el.~1.46.~ 2008-05-06 03:57:26.000000000 -0400 --- trunk/lisp/battery.el 2008-08-07 16:31:34.000000000 -0400 *************** *** 47,52 **** --- 47,56 ---- ((and (eq system-type 'gnu/linux) (file-directory-p "/proc/acpi/battery")) 'battery-linux-proc-acpi) + ((and (eq system-type 'gnu/linux) + (file-directory-p "/sys/class/power_supply/") + (directory-files "/sys/class/power_supply/" nil "BAT[0-9]$")) + 'battery-linux-sysfs) ((and (eq system-type 'darwin) (condition-case nil (with-temp-buffer *************** *** 70,75 **** --- 74,81 ---- (defcustom battery-echo-area-format (cond ((eq battery-status-function 'battery-linux-proc-acpi) "Power %L, battery %B at %r (%p%% load, remaining time %t)") + ((eq battery-status-function 'battery-linux-sysfs) + "Power %L, battery %B (%p%% load)") ((eq battery-status-function 'battery-pmset) "%L power, battery %B (%p%% load, remaining time %t)") (battery-status-function *************** *** 276,282 **** (defun battery-linux-proc-acpi () "Get ACPI status information from Linux kernel. ! This function works only with the new `/proc/acpi/' format introduced in Linux version 2.4.20 and 2.6.0. The following %-sequences are provided: --- 282,288 ---- (defun battery-linux-proc-acpi () "Get ACPI status information from Linux kernel. ! This function works only with the `/proc/acpi/' format introduced in Linux version 2.4.20 and 2.6.0. The following %-sequences are provided: *************** *** 390,395 **** --- 396,480 ---- "N/A"))))) + ;;; `/sys/class/power_supply/BATN' interface for Linux. + + (defun battery-linux-sysfs () + "Get ACPI status information from Linux kernel. + This function works only with the new `/sys/class/power_supply/BAT' + format introduced in Linux version 2.4.25. + + The following %-sequences are provided: + %c Current capacity (mAh or mWh) + %B Battery status (verbose) + %p Battery load percentage + %L AC line status (verbose)" + (let (charging-state + (charge-full 0.0) + (charge-now 0.0) + (energy-full 0.0) + (energy-now 0.0)) + ;; SysFS provides information about each battery present in the + ;; system in a separate subdirectory. We are going to merge the + ;; available information together. + (with-temp-buffer + (dolist (dir (ignore-errors + (directory-files + "/sys/class/power_supply/" t "BAT[0-9]$"))) + (erase-buffer) + (ignore-errors (insert-file-contents + (expand-file-name "uevent" dir))) + (when (re-search-forward "POWER_SUPPLY_PRESENT=1$" nil t) + (goto-char (point-min)) + (and (re-search-forward "POWER_SUPPLY_STATUS=\\(.*\\)$" nil t) + ;; On most multi-battery systems, most of the time only + ;; one battery is "charging"/"discharging", the others + ;; are "unknown". + (member charging-state '("Unknown" "Full" nil)) + (setq charging-state (match-string 1))) + (let (full-string now-string) + ;; Sysfs may list either charge (mAh) or energy (mWh) + (cond ((and (re-search-forward + "POWER_SUPPLY_CHARGE_FULL=\\([0-9]*\\)$" nil t) + (setq full-string (match-string 1)) + (re-search-forward + "POWER_SUPPLY_CHARGE_NOW=\\([0-9]*\\)$" nil t) + (setq now-string (match-string 1))) + (setq charge-full (+ charge-full + (string-to-number full-string)) + charge-now (+ charge-now + (string-to-number now-string)))) + ((and (re-search-forward + "POWER_SUPPLY_ENERGY_FULL=\\([0-9]*\\)$" nil t) + (setq full-string (match-string 1)) + (re-search-forward + "POWER_SUPPLY_ENERGY_NOW=\\([0-9]*\\)$" nil t) + (setq now-string (match-string 1))) + (setq energy-full (+ energy-full + (string-to-number full-string)) + energy-now (+ energy-now + (string-to-number now-string))))))))) + (list (cons ?c (cond ((or (> charge-full 0) (> charge-now 0)) + (number-to-string charge-now)) + ((or (> energy-full 0) (> energy-now 0)) + (number-to-string energy-now)) + (t "N/A"))) + (cons ?B (or charging-state "N/A")) + (cons ?p (cond ((> charge-full 0) + (format "%.1f" + (/ (* 100 charge-now) charge-full))) + ((> energy-full 0) + (format "%.1f" + (/ (* 100 energy-now) energy-full))) + (t "N/A"))) + (cons ?L (if (file-readable-p "/sys/class/power_supply/AC/online") + (if (battery-search-for-one-match-in-files + "/sys/class/power_supply/AC/online" "1" 0) + "AC" + "BAT") + "N/A"))))) + + + ;;; `pmset' interface for Darwin (OS X). (defun battery-pmset () From i.emre.sahin@gmail.com Thu Aug 7 14:54:37 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.0 required=4.0 tests=BAYES_00,GMAIL,HAS_BUG_NUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 21:54:37 +0000 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77LsX5R006004 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 14:54:34 -0700 Received: by nf-out-0910.google.com with SMTP id 30so277983nfu.31 for <643@emacsbugs.donarmstrong.com>; Thu, 07 Aug 2008 14:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:cc:subject:in-reply-to :user-agent:references:date:message-id:mime-version:content-type :from; bh=PzzLOsmUh8lBNbsNUppS9VmDmC429vtNhbghRt65VnI=; b=uFfg5MiwZE/gNPE/xKjrd55BCP5kwkpaTFWJ73pgfixY/T4zb9SUFeE9Q5gHxncm2Z 2r0ZXJyTHIgsQZO7nkLJmWxr+6RVPipkZn2rSNl3nswM7QC0G4X6jtHPy3mKoUVZX1XF 4krWsX5P59A8EQWwGBiLPGqxZJpD50raF5UVg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:cc:subject:in-reply-to:user-agent:references:date:message-id :mime-version:content-type:from; b=bzjrF3l8frYHhiqP9k/NT1XO/DwsSpfN26zkQPgfa8hi8jc9cD4hCxW3CkhYCCTECH ql+TEoeHxTe+f0y3GYEFMvDrdcgXtiyyKKdsEMvOU1VkHpCAC5cSxFpBjaRJqmzW6FGb n+yKBQ+vuSpbUZ5QRJ4sMW5D60g4OEod6Xa54= Received: by 10.210.49.19 with SMTP id w19mr4173193ebw.167.1218146072190; Thu, 07 Aug 2008 14:54:32 -0700 (PDT) Received: from leonardo.iesahin.net.emresahin.net ( [81.214.248.165]) by mx.google.com with ESMTPS id 31sm1606492nfu.9.2008.08.07.14.54.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 07 Aug 2008 14:54:30 -0700 (PDT) To: David De La Harpe Golden Cc: "Lennart Borgman \(gmail\)" , Chong Yidong , 643@debbugs.gnu.org, emacs-devel@gnu.org Subject: Re: bug#643: Battery update In-Reply-To: <489B44D6.4020706@harpegolden.net> (David De La Harpe Golden's message of "Thu\, 07 Aug 2008 19\:54\:14 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) References: <87bq04dbqc.fsf@stupidchicken.com> <489B3C91.7010605@gmail.com> <489B44D6.4020706@harpegolden.net> Date: Fri, 08 Aug 2008 00:54:20 +0300 Message-ID: <87iqucebjn.fsf@leonardo.iesahin.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii From: Emre Sahin David De La Harpe Golden writes: > Lennart Borgman (gmail) wrote: >> Chong Yidong wrote: >>> Even though it's the feature freeze, I think it's necessary to ensure >>> that battery.el works at least at a basic level. >> >> Just out of curiosity: Why is it necessary that battery.el works? Is not >> this information something that the OS normally gives the user without >> Emacs? >> > > not if you're running emacs fullscreen I guess, can't see a tray icon > then... > I'm using ratpoison WM and using Emacs in full screen. (I suggest you to try ratpoison, stumpwm or xmonad like "tiling wm"s and find "taste of emacs" in their screen estate management. By the way, stumpwm has its configuration in Common Lisp, and xmonad in Haskell, if that makes a difference for you.) There are no icons or bars or anything around. There is nothing except Emacs' mode line to show battery information, hence battery.el. :) Best Regards, Emre -- I. Emre Sahin @ Ankara, Turkey Software Developer & Consultant @ http://ydyazilim.com Ph.D. Candidate @ http://cs.bilkent.edu.tr Blogger, Writer, Poet @ http://emresahin.net Maybe hears the phone @ +90 532 261 8985 Maybe gtalk (or jabber) @ i.emre.sahin@gmail.com From i.emre.sahin@gmail.com Thu Aug 7 15:25:23 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.4 required=4.0 tests=AWL,BAYES_00,FOURLA,GMAIL, MURPHY_DRUGS_REL8 autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 7 Aug 2008 22:25:23 +0000 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77MOPbW015567 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 15:24:44 -0700 Received: by fg-out-1718.google.com with SMTP id l27so579638fgb.43 for <643@emacsbugs.donarmstrong.com>; Thu, 07 Aug 2008 15:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:cc:subject:in-reply-to :user-agent:references:from:date:message-id:mime-version :content-type:sender; bh=id67pJgo1mFKb1+08DhSbUGzDsC1hg2hEENt6bxQnAU=; b=VWxzx7tiGE9/WFsF+yF2l5LFLH/E41aQSzC0V3QvjrxstVkTmJa8z8bVIQnvaZXfut 27j+9Kcg/SQZ5GSIL0kbeCAd8KzuEdT3fKLhibCoqoEtuTgR8M0R4HlBAff9PD+PtfWt 6sgeyzyeNwV73b9mQV6FqExrnnGV3xPt3Z3DE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:cc:subject:in-reply-to:user-agent:references:from:date :message-id:mime-version:content-type:sender; b=WTnwV3vhS7LNDGWIyrB/A1agp0TaR6bHko3DooUGrViyAifcu54lDQiJ7VQGrF8xM6 V4oHB/XPWxgwEsBEFuvYWVq1nh4Z1xqBriPZwag80dpv/8yMgIB8IXaNNWnkBxiSl+yE WQW7LyTVn/fk8H3olEVGufO19pQSnyfLB9nBk= Received: by 10.86.79.19 with SMTP id c19mr1791475fgb.67.1218147864115; Thu, 07 Aug 2008 15:24:24 -0700 (PDT) Received: from leonardo.iesahin.net.emresahin.net ( [81.214.248.165]) by mx.google.com with ESMTPS id d4sm336557fga.8.2008.08.07.15.24.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 07 Aug 2008 15:24:23 -0700 (PDT) To: Chong Yidong Cc: Sven Joachim , 643@debbugs.gnu.org, Emre Sahin , emacs-devel@gnu.org Subject: Re: Battery update In-Reply-To: <87bq04r2f8.fsf@stupidchicken.com> (Chong Yidong's message of "Thu\, 07 Aug 2008 16\:32\:59 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> <87abfo4obc.fsf@stupidchicken.com> <873algfw2d.fsf@gmx.de> <87bq04r2f8.fsf@stupidchicken.com> From: Emre Sahin Date: Fri, 08 Aug 2008 01:24:11 +0300 Message-ID: <87d4kko450.fsf@leonardo.iesahin.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Emre Sahin Chong Yidong writes: > Sven Joachim writes: > >>> What about (from the shell) >>> >>> cat /sys/class/power_supply/BAT0/uevent >> >> POWER_SUPPLY_VOLTAGE_NOW=12444000 >> POWER_SUPPLY_CURRENT_NOW=0 >> POWER_SUPPLY_CHARGE_FULL_DESIGN=4000000 >> POWER_SUPPLY_CHARGE_FULL=3985000 >> POWER_SUPPLY_CHARGE_NOW=3985000 >> POWER_SUPPLY_MODEL_NAME=GC86503SY90 >> POWER_SUPPLY_MANUFACTURER=SONY >> POWER_SUPPLY_SERIAL_NUMBER= > > Maybe it's a Lisp integer overflow (I'm guessing you're on a 32-bit > machine). Does the following patch give better results? Maybe I did something wrong with diff & patch; this is my first adventure with them in practice. (Yes, really!) Message is something like: Loading /home/iesahin/site-lisp/battery.el (source)...done setq: Wrong type argument: listp, "/sys/class/power_supply/AC/online" Emre -- I. Emre Sahin @ Ankara, Turkey Software Developer & Consultant @ http://ydyazilim.com Ph.D. Candidate @ http://cs.bilkent.edu.tr Blogger, Writer, Poet @ http://emresahin.net Maybe hears the phone @ +90 532 261 8985 Maybe gtalk (or jabber) @ i.emre.sahin@gmail.com From cyd@stupidchicken.com Thu Aug 7 17:10:19 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 8 Aug 2008 00:10:20 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m780AHXP016440 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 17:10:18 -0700 Received: by cyd (Postfix, from userid 1000) id 09F9B57E17D; Thu, 7 Aug 2008 20:10:20 -0400 (EDT) From: Chong Yidong To: Emre Sahin Cc: Sven Joachim , 643@debbugs.gnu.org, emacs-devel@gnu.org Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> <87abfo4obc.fsf@stupidchicken.com> <873algfw2d.fsf@gmx.de> <87bq04r2f8.fsf@stupidchicken.com> <87d4kko450.fsf@leonardo.iesahin.net> Date: Thu, 07 Aug 2008 20:10:20 -0400 In-Reply-To: <87d4kko450.fsf@leonardo.iesahin.net> (Emre Sahin's message of "Fri, 08 Aug 2008 01:24:11 +0300") Message-ID: <87tzdwmknn.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Emre Sahin writes: > Maybe I did something wrong with diff & patch; this is my first > adventure with them in practice. (Yes, really!) > > Message is something like: > > Loading /home/iesahin/site-lisp/battery.el (source)...done > setq: Wrong type argument: listp, "/sys/class/power_supply/AC/online" No, it was a typo in the patch. Could you replace the line (if (battery-search-for-one-match-in-files "/sys/class/power_supply/AC/online" "1" 0) "AC" on line 471 of the battery.el, with (if (battery-search-for-one-match-in-files (list "/sys/class/power_supply/AC/online") "1" 0) "AC" and try again? From svenjoac@gmx.de Thu Aug 7 22:54:23 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.2 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 8 Aug 2008 05:54:23 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m785sJ2U022630 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 22:54:20 -0700 Received: (qmail invoked by alias); 08 Aug 2008 05:54:13 -0000 Received: from p548670E2.dip.t-dialin.net (EHLO debian) [84.134.112.226] by mail.gmx.net (mp007) with SMTP; 08 Aug 2008 07:54:13 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX19PqWFl6NxPGegLHHVJfIQRPKHsILK90uzL2fulbA Z4aUHtYGz+f59J From: Sven Joachim To: Chong Yidong Cc: 643@debbugs.gnu.org, Emre Sahin , emacs-devel@gnu.org Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> <87abfo4obc.fsf@stupidchicken.com> <873algfw2d.fsf@gmx.de> <87bq04r2f8.fsf@stupidchicken.com> Date: Fri, 08 Aug 2008 07:50:23 +0200 In-Reply-To: <87bq04r2f8.fsf@stupidchicken.com> (Chong Yidong's message of "Thu, 07 Aug 2008 16:32:59 -0400") Message-ID: <87k5esoy1s.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.72 On 2008-08-07 22:32 +0200, Chong Yidong wrote: > Maybe it's a Lisp integer overflow (I'm guessing you're on a 32-bit > machine). Does the following patch give better results? Yes, that looks better. Sven From svenjoac@gmx.de Thu Aug 7 23:00:31 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.1 required=4.0 tests=AWL,BAYES_00,FOURLA autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 8 Aug 2008 06:00:31 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m7860Rob024779 for <643@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 23:00:29 -0700 Received: (qmail invoked by alias); 08 Aug 2008 06:00:22 -0000 Received: from p548670E2.dip.t-dialin.net (EHLO debian) [84.134.112.226] by mail.gmx.net (mp012) with SMTP; 08 Aug 2008 08:00:22 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX1+MLtNSzd2MTpp0Qfc7JRHza1wf0ntu3ZADKhK3ql BPITbWdaKO6uKJ From: Sven Joachim To: Chong Yidong Cc: Emre Sahin , 643@debbugs.gnu.org, emacs-devel@gnu.org Subject: Re: Battery update References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> <87abfo4obc.fsf@stupidchicken.com> <873algfw2d.fsf@gmx.de> <87bq04r2f8.fsf@stupidchicken.com> <87d4kko450.fsf@leonardo.iesahin.net> <87tzdwmknn.fsf@stupidchicken.com> Date: Fri, 08 Aug 2008 07:56:43 +0200 In-Reply-To: <87tzdwmknn.fsf@stupidchicken.com> (Chong Yidong's message of "Thu, 07 Aug 2008 20:10:20 -0400") Message-ID: <87d4kkoxr8.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 On 2008-08-08 02:10 +0200, Chong Yidong wrote: > (if (battery-search-for-one-match-in-files > (list "/sys/class/power_supply/AC/online") "1" 0) > "AC" FWIW, I don't have a /sys/class/power_supply/AC directory, but there is /sys/class/power_supply/ACAD. Seems the directory has moved somewhere between kernel 2.6.22 and 2.6.25, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=478937. Sven From i.emre.sahin@gmail.com Fri Aug 8 06:27:04 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,BAYES_00,FOURLA,GMAIL, MURPHY_DRUGS_REL8 autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 8 Aug 2008 13:27:04 +0000 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m78DQxl9031654 for <643@emacsbugs.donarmstrong.com>; Fri, 8 Aug 2008 06:27:01 -0700 Received: by nf-out-0910.google.com with SMTP id 30so357950nfu.31 for <643@emacsbugs.donarmstrong.com>; Fri, 08 Aug 2008 06:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:cc:subject:in-reply-to :user-agent:references:date:message-id:mime-version:content-type :from; bh=sGb6dytSCpgpgTmrqfdt0zlwveRHHO39bCK7ccY1KRY=; b=q8pLwtRm9WaBt9pkn7YoBbNggvxL2g9XuJXSpUKNzAYg4DYtlA9TuqxfKk+fBIYy3w lnZa4ZfFSk0LoLyfHrObL711vZzGPb+r0dLBxaAFPHLdyKhQ+0cGWu6mkl4LwFZGY5ms UuHnYeAZwE0NNu2krLABwbAetxLiF5dsy90jI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:cc:subject:in-reply-to:user-agent:references:date:message-id :mime-version:content-type:from; b=x8Qh68y879vGic5tJx3VNJSTdFTyPs0Y0HHpnxcXSCcvVEiKEAWhzCV9KB4g8EoCCA fLYEd18aMkEz5RxlWbNn0i47pR1HcW/JdeU20MK87DYT6AkJDJN+R5+7dJajihD6UAvw s1YB0LKu5jSShVgwdbK777AfZqHAtezDbGkw4= Received: by 10.210.66.1 with SMTP id o1mr5478955eba.135.1218202018825; Fri, 08 Aug 2008 06:26:58 -0700 (PDT) Received: from leonardo.iesahin.net.emresahin.net ( [81.214.249.90]) by mx.google.com with ESMTPS id i8sm1728604nfh.20.2008.08.08.06.26.56 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 08 Aug 2008 06:26:57 -0700 (PDT) To: Chong Yidong Cc: Emre Sahin , Sven Joachim , 643@debbugs.gnu.org, emacs-devel@gnu.org Subject: Re: Battery update In-Reply-To: <87tzdwmknn.fsf@stupidchicken.com> (Chong Yidong's message of "Thu\, 07 Aug 2008 20\:10\:20 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) References: <87bq04dbqc.fsf@stupidchicken.com> <87ej50g0ib.fsf@gmx.de> <87bq048z7t.fsf@stupidchicken.com> <878wv8fxmr.fsf@gmx.de> <87abfo4obc.fsf@stupidchicken.com> <873algfw2d.fsf@gmx.de> <87bq04r2f8.fsf@stupidchicken.com> <87d4kko450.fsf@leonardo.iesahin.net> <87tzdwmknn.fsf@stupidchicken.com> Date: Fri, 08 Aug 2008 16:26:49 +0300 Message-ID: <8763qbocx2.fsf@leonardo.iesahin.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii From: Emre Sahin Chong Yidong writes: > Emre Sahin writes: > >> Maybe I did something wrong with diff & patch; this is my first >> adventure with them in practice. (Yes, really!) >> >> Message is something like: >> >> Loading /home/iesahin/site-lisp/battery.el (source)...done >> setq: Wrong type argument: listp, "/sys/class/power_supply/AC/online" > > No, it was a typo in the patch. Could you replace the line > > (if (battery-search-for-one-match-in-files > "/sys/class/power_supply/AC/online" "1" 0) > "AC" > > on line 471 of the battery.el, with > > (if (battery-search-for-one-match-in-files > (list "/sys/class/power_supply/AC/online") "1" 0) > "AC" > > and try again? This looks OK. It fills %p in battery-mode-line-format and gives an equal value with "acpi -b". Thank you. I may try to retrieve other (available) information from sysfs interface by looking your code. I don't know if Sven has anything to add about interface though. I think the interface change is thought for multi-battery systems. If battery.el should support them, battery.el interface should also change I think, which is, IMHO, not necessary at the moment. Regards, Emre -- I. Emre Sahin @ Ankara, Turkey Software Developer & Consultant @ http://ydyazilim.com Ph.D. Candidate @ http://cs.bilkent.edu.tr Blogger, Writer, Poet @ http://emresahin.net Maybe hears the phone @ +90 532 261 8985 Maybe gtalk (or jabber) @ i.emre.sahin@gmail.com From cyd@stupidchicken.com Fri Aug 8 10:49:50 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643-done) by emacsbugs.donarmstrong.com; 8 Aug 2008 17:49:50 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m78Hnl0M014278 for <643-done@emacsbugs.donarmstrong.com>; Fri, 8 Aug 2008 10:49:49 -0700 Received: by cyd (Postfix, from userid 1000) id 9E52757E1C5; Fri, 8 Aug 2008 13:49:56 -0400 (EDT) From: Chong Yidong To: 643-done@debbugs.gnu.org Subject: Re: 23.0.60; battery.el needs deprecated ACPI_PROCFS_POWER interface Date: Fri, 08 Aug 2008 13:49:56 -0400 Message-ID: <87projiegr.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I've checked in the patch. From monnier@IRO.UMontreal.CA Fri Aug 8 10:56:12 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 8 Aug 2008 17:56:12 +0000 Received: from pruche.dit.umontreal.ca (pruche.dit.umontreal.ca [132.204.246.22]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m78Hu6cr016980 for <643@emacsbugs.donarmstrong.com>; Fri, 8 Aug 2008 10:56:09 -0700 Received: from ceviche.home (vpn-132-204-232-57.acd.umontreal.ca [132.204.232.57]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id m78HuSej015593; Fri, 8 Aug 2008 13:56:30 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 63975B41C5; Fri, 8 Aug 2008 13:56:01 -0400 (EDT) From: Stefan Monnier To: Chong Yidong Cc: emacs-devel@gnu.org, 643@debbugs.gnu.org, Emre Sahin Subject: Re: Battery update Message-ID: References: <87bq04dbqc.fsf@stupidchicken.com> Date: Fri, 08 Aug 2008 13:56:01 -0400 In-Reply-To: <87bq04dbqc.fsf@stupidchicken.com> (Chong Yidong's message of "Thu, 07 Aug 2008 12:35:39 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3078=0 > Even though it's the feature freeze, I think it's necessary to ensure > that battery.el works at least at a basic level. So, here's a patch Agreed. > ! This function works only with the new `/proc/acpi/' format introduced > ! This function works only with the `/proc/acpi/' format introduced [...] > + This function works only with the new `/sys/class/power_supply/BAT' Given the fix to the docstring for proc-acpi, I think we should try and avoid making the same mistake. I.e. drop the "new". Stefan From raman@comcast.net Sun Aug 10 17:10:16 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.0 required=4.0 tests=BAYES_00,GMAIL,HAS_BUG_NUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 643) by emacsbugs.donarmstrong.com; 11 Aug 2008 00:10:16 +0000 Received: from QMTA10.emeryville.ca.mail.comcast.net (qmta10.emeryville.ca.mail.comcast.net [76.96.30.17]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7B0ACuK008527 for <643@emacsbugs.donarmstrong.com>; Sun, 10 Aug 2008 17:10:13 -0700 Received: from OMTA13.emeryville.ca.mail.comcast.net ([76.96.30.52]) by QMTA10.emeryville.ca.mail.comcast.net with comcast id 0ckS1a00717UAYkAAoA7q7; Mon, 11 Aug 2008 00:10:07 +0000 Received: from localhost ([71.202.191.236]) by OMTA13.emeryville.ca.mail.comcast.net with comcast id 0oA61a00D56Ur8v8ZoA7Pu; Mon, 11 Aug 2008 00:10:07 +0000 X-Authority-Analysis: v=1.0 c=1 a=2z1OXlWFAAAA:8 a=sqLpZ4MGQkd3SM1K3EQA:9 a=-RChfC8AA3aOUfF8oUysWHV-EW4A:4 a=MSl-tDqOz04A:10 a=9OHTkwyHC8cA:10 Received: by localhost (Postfix, from userid 1000) id 4A85812A4101; Sun, 10 Aug 2008 17:10:06 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18591.33629.668029.124320@gargle.gargle.HOWL> Date: Sun, 10 Aug 2008 17:10:05 -0700 To: lennart.borgman@gmail.com Cc: cyd@stupidchicken.com, 643@debbugs.gnu.org, mail@emresahin.net, emacs-devel@gnu.org Subject: Re: bug#643: Battery update In-Reply-To: <489B3C91.7010605@gmail.com> References: <87bq04dbqc.fsf@stupidchicken.com> <489B3C91.7010605@gmail.com> X-Mailer: VM alpha-479 under Emacs 23.0.60.1 (i686-pc-linux-gnu) Reply-To: raman@users.sf.net From: "T. V. Raman" x-attribution: tvr Define "OS". The OS is gnu/linux, not gnome or KDE -- those are user environments. Emacs is also a user environment. >>>>> "Lennart" == Lennart Borgman (gmail) writes: Lennart> Chong Yidong wrote: >> Even though it's the feature freeze, I think it's >> necessary to ensure that battery.el works at least at a >> basic level. Lennart> Lennart> Just out of curiosity: Why is it necessary that Lennart> battery.el works? Is not this information something Lennart> that the OS normally gives the user without Emacs? Lennart> Lennart> -- Best Regards, --raman Email: raman@users.sf.net WWW: http://emacspeak.sf.net/raman/ AIM: emacspeak GTalk: tv.raman.tv@gmail.com PGP: http://emacspeak.sf.net/raman/raman-almaden.asc Google: tv+raman IRC: irc://irc.freenode.net/#emacs From unknown Thu Aug 14 17:27:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Mon, 08 Sep 2008 14:24:03 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator