Skip to contentSkip to conversation

apm.c and multiple battery slots

DISCUSSION Thomas Hood 4 participants 5 messages Feb 3, 2002 – Feb 5, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Stevie O

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.

Quoted 3 lines

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

#1 lore raw
Quoted 7 lines · Thomas Hood
Quoted 3 lines · Stevie O

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.

Quoted 7 lines
Quoted 3 lines

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

#2 lore raw
In reply to Thomas Hood
Quoted 7 lines · [email protected] said:
Quoted 3 lines

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

#3 lore raw

APM and APIC -- multiple batteries (was: apm.c and multiple battery slots)

Quoted 6 lines · David Woodhouse

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.

Well, the only other interface I know of is device files, and from what I've seen, that seems to be a place where we autoload drivers when needed...

Besides, pretty much everything else in /proc is for transmitting (normally unchangeable, except for the sysctls) information from kernel to userspace. Why not /proc?

--

Now that you mention it, yes, I agree that an APM-specific interface for batteries would make code reuse harder (needing stuff for both APM and ACPI stuff). So we could have /proc/batteries/ maybe?

How does the ACPI stuff handle this? *Does* the ACPI stuff handle this (i.e. multiple batteries)? If so:
Is it a generic interface?
If so, we should let APM use it too.
If not, could we perhaps change it to one?
If not:
I'm ready for suggestions about my original idea :)

--
Stevie-O

Real programmers use COPY CON PROGRAM.EXE

#4 lore raw

Re: APM and APIC -- multiple batteries (was: apm.c and multiple battery slots)

In reply to Thomas Hood

Hi!

Quoted 2 lines

How does the ACPI stuff handle this? *Does* the ACPI stuff handle this (i.e. multiple batteries)?

Yes.

Quoted 3 lines

If so:
Is it a generic interface?
If so, we should let APM use it too.

Should be generic enough...
Pavel

Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.