stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [STUMP] [PATCH] Add battery2.lisp - works with multiple batteries, u


From: Rupert Swarbrick
Subject: Re: [STUMP] [PATCH] Add battery2.lisp - works with multiple batteries, uses sysfs.
Date: Mon, 21 Jul 2008 19:11:37 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

John Li <address@hidden> writes:

> On Sun, Jul 20, 2008 at 06:49:18PM +0100, Rupert Swarbrick wrote:

>> I also added a fall-back for the code to use energy_full and energy_now
>> if charge_full and charge_now don't exist on the machine (since they
>> don't here!).
> [...]
>> +    ;; My kernel uses energy_full + energy_now, so if charge_* didn't work, 
>> try
>> +    ;; that.
>> +    (unless (and full charge)
>> +      (setf full (bat-data bat "energy_full"))
>> +      (setf charge (bat-data bat "energy_now")))
>
> Hm, dammit. I was hoping sysfs would be more unified. I think it would
> be cleaner to have *battery-rate*, *battery-full*, and *battery-level*
> so users can set whatever exists on their machine.
>
> Did you happen to try the module with your read-line replacement _and_
> the original file names? I'm curious as to whether or not it crashed
> (it shouldn't have).
>

I'm afraid I dunno much about sysfs layout. The version of the patch
with the old read function was crashing, since it also checks battery
status, which has the same name on both our machines...

It returns nil on a non-existant file though, which seems fine.

About the customization vars, that's fine, but we should also try to
have some sort of semi-stupid defaults. I don't know (as I said before
:)) what governs which names are used in /sys/: in this case, hopefully
it's just the kernel version. But imagine if someone had 2 batteries
with different drivers, one using one scheme and the other using
another... Making a customization mechanism support that would be a
nightmare, I think.

My suggestion (sans implementation) would be to have a default search
through some sensible filenames, but have a var that the user can
customize to non-nil which gives a different name or list of them that
should be tried before the fallback.

Hopefully, that would catch the more obvious possibilities for screwup?

Rupert

Attachment: pgp0JAIhmPmOX.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]