* Re: apm.c and multiple battery slots
@ 2002-02-02 13:30 Thomas Hood
2002-02-02 21:23 ` Stevie O
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Hood @ 2002-02-02 13:30 UTC (permalink / raw)
To: linux-kernel; +Cc: Stevie O, Stephen Rothwell
> I went to apm.c to look into patching it to support
> multiple batteries.
> I found this function:
> static int apm_get_battery_status(which, status, bat,
> life, nbat <- battery #)
> but it's #if 0'd out, and isn't referred to anywhere in the code.
> I looked at the changelog in the file to try to determine when
> it stopped being used, and why, but I found no useful information,
> and I can't even ask the person who did it, since they didn't
> tell me they did...
I am not the author, so the following is speculation.
My guess is that apm_get_battery_status() was written to
support multiple batteries (supported by APM 1.2 only) but
that the authors never got around to providing a user
interface to this functionality; so it remains ifdeffed out.
(Hence the function never "stopped" being used.)
The current official maintainer of the driver is Stephen Rothwell.
Stephen: How do you think the info about the second battery
might be furnished to the user?
--
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: apm.c and multiple battery slots
2002-02-02 13:30 apm.c and multiple battery slots Thomas Hood
@ 2002-02-02 21:23 ` Stevie O
0 siblings, 0 replies; 6+ messages in thread
From: Stevie O @ 2002-02-02 21:23 UTC (permalink / raw)
To: linux-kernel
At 08:30 AM 2/2/2002 -0500, you wrote:
>I am not the author, so the following is speculation.
>My guess is that apm_get_battery_status() was written to
>support multiple batteries (supported by APM 1.2 only) but
>that the authors never got around to providing a user
>interface to this functionality; so it remains ifdeffed out.
>(Hence the function never "stopped" being used.)
>
>The current official maintainer of the driver is Stephen Rothwell.
>
>Stephen: How do you think the info about the second battery
>might be furnished to the user?
I already thought about that a bit... what if we changed /proc/apm again,
adding one line for each possible battery slot?
The current format is:
<driver version> <BIOS version> <APM flags> <AC status> <battery status>
<battery flag> <battery left (%)> <remaining time> <remaining time units
(min/sec)>
I suggest we change the first line to reflect an overall battery status
(i.e. average of all slots in system). Then we could add one line for each
battery slot, indicating
<battery status> <battery flag> <battery left % > <remaining time in seconds>
I suggest we always show the new stuff in seconds because I like easily
parsed things, and even shell scripts can divide by 60 if they want to ;)
If there's no battery in this slot, we can show the usual of -1's, or just
put "? ? ? ?".
So on my system, I would see this if I did
$ cat /proc/apm
1.16 1.2 0x03 0x01 0x03 0x09 94% 283 min
0x04 0x80 -1 -1
0x03 0x09 94 16980
Whoever manages apmd also probably has some suggestions...
(btw, "Stephen" is a really great name ;)
--
Stevie-O
Real programmers use COPY CON VMLINUZ then run LoadLin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: apm.c and multiple battery slots
2002-02-03 2:58 Thomas Hood
2002-02-03 6:53 ` Stevie O
@ 2002-02-03 12:01 ` David Woodhouse
1 sibling, 0 replies; 6+ messages in thread
From: David Woodhouse @ 2002-02-03 12:01 UTC (permalink / raw)
To: Thomas Hood; +Cc: linux-kernel, Stephen Rothwell
jdthood@mail.com said:
> > Then we could add one line for each battery slot,
> > indicating <battery status> <battery flag> <battery left % >
> > <remaining time in seconds>
> How about putting each of these lines in a separate proc file? This
> would avoid changing the format of /proc/apm, which would break
> things.
Please don't add an APM-specific interface for batteries. Look at the other
code which talks to batteries - the ACPI code, SMBus and numerous other
drivers for embedded systems - and design an interface to userspace which
can be used by all of them.
Preferably not in /proc.
--
dwmw2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: apm.c and multiple battery slots
2002-02-03 2:58 Thomas Hood
@ 2002-02-03 6:53 ` Stevie O
2002-02-03 12:01 ` David Woodhouse
1 sibling, 0 replies; 6+ messages in thread
From: Stevie O @ 2002-02-03 6:53 UTC (permalink / raw)
To: Thomas Hood, linux-kernel; +Cc: Stephen Rothwell
At 09:58 PM 2/2/2002 -0500, Thomas Hood wrote:
>Stevie O <stevie@qrpff.net> wrote:
> > I suggest we change the first line to reflect an
> > overall battery status (i.e. average of all slots
> > in system).
>
>Sounds like a good idea.
>
> > Then we could add one line for each battery slot,
> > indicating <battery status> <battery flag> <battery left % >
> > <remaining time in seconds>
>
>How about putting each of these lines in a separate proc
>file? This would avoid changing the format of /proc/apm,
>which would break things.
Or we could do something similar to what the IDE subsystem does, and have
/proc/apmbat/0 <- battery [slot] 0
/proc/apmbat/1 <- battery [slot] 1
...
/proc/apmbat/ <- battery [slot] N
I'd actually prefer to call it /proc/apm/ but obviously that won't work :)
--
Stevie-O
Real programmers use COPY CON PROGRAM.EXE
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: apm.c and multiple battery slots
@ 2002-02-03 2:58 Thomas Hood
2002-02-03 6:53 ` Stevie O
2002-02-03 12:01 ` David Woodhouse
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Hood @ 2002-02-03 2:58 UTC (permalink / raw)
To: linux-kernel; +Cc: Stephen Rothwell
Stevie O <stevie@qrpff.net> wrote:
> I suggest we change the first line to reflect an
> overall battery status (i.e. average of all slots
> in system).
Sounds like a good idea.
> Then we could add one line for each battery slot,
> indicating <battery status> <battery flag> <battery left % >
> <remaining time in seconds>
How about putting each of these lines in a separate proc
file? This would avoid changing the format of /proc/apm,
which would break things.
--
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* apm.c and multiple battery slots
@ 2002-02-02 4:58 Stevie O
0 siblings, 0 replies; 6+ messages in thread
From: Stevie O @ 2002-02-02 4:58 UTC (permalink / raw)
To: linux-kernel
I have an Inspiron 8100 and 2.4.13-ac5, with apmd-final. (I'm holding off
upgrading until I stop seeing so much stuff about VM problems on lkml). It
has two battery slots, left and right.
If I put the battery in the left slot and run 'apm' I get
AC on-line, battery charging: 84% (4:12)
If I take out the battery and run apm I get
AC on-line, no system battery
If I put it into the right slot I get
AC on-line
and /proc/apm says I have -1% battery free and -1 minutes remaining ;)
--
The battery was designed to go into the right slot, not the left (left is
where the floppy drive goes).
--
I went to apm.c to look into patching it to support multiple batteries.
I found this function:
static int apm_get_battery_status(which, status, bat, life, nbat <- battery #)
but it's #if 0'd out, and isn't referred to anywhere in the code. I looked
at the changelog in the file to try to determine when it stopped being
used, and why, but I found no useful information, and I can't even ask the
person who did it, since they didn't tell me they did...
--
Stevie-O
Real programmers use COPY CON PROGRAM.EXE
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-02-03 12:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-02 13:30 apm.c and multiple battery slots Thomas Hood
2002-02-02 21:23 ` Stevie O
-- strict thread matches above, loose matches on Subject: below --
2002-02-03 2:58 Thomas Hood
2002-02-03 6:53 ` Stevie O
2002-02-03 12:01 ` David Woodhouse
2002-02-02 4:58 Stevie O
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®