Hi!
This fixes units, and makes format tag: value. Please apply.
Pavel
--- clean/drivers/acpi/cmbatt.c Wed Jan 31 16:14:26 2001
+++ linux/drivers/acpi/cmbatt.c Thu Feb 1 10:55:31 2001
@@ -246,38 +254,32 @@
goto end;
}
- if (info->last_full_capacity == ACPI_BATT_UNKNOWN)
- p += sprintf(p, "Unknown last full capacity\n");
- else
- p += sprintf(p, "Last Full Capacity %x %s /hr\n",
+ if (info->last_full_capacity != ACPI_BATT_UNKNOWN)
+ p += sprintf(p, "Last Full Capacity: %d %sh\n",
info->last_full_capacity, batt_list[batt_num].power_unit);
- if (info->design_capacity == ACPI_BATT_UNKNOWN)
- p += sprintf(p, "Unknown Design Capacity\n");
- else
- p += sprintf(p, "Design Capacity %x %s /hr\n",
+ if (info->design_capacity != ACPI_BATT_UNKNOWN)
+ p += sprintf(p, "Design Capacity: %d %sh\n",
info->design_capacity, batt_list[batt_num].power_unit);
if (info->battery_technology)
- p += sprintf(p, "Secondary Battery Technology\n");
+ p += sprintf(p, "Battery Technology: Secondary\n");
else
- p += sprintf(p, "Primary Battery Technology\n");
+ p += sprintf(p, "Battery Technology: Primary\n");
- if (info->design_voltage == ACPI_BATT_UNKNOWN)
- p += sprintf(p, "Unknown Design Voltage\n");
- else
- p += sprintf(p, "Design Voltage %x mV\n",
+ if (info->design_voltage != ACPI_BATT_UNKNOWN)
+ p += sprintf(p, "Design Voltage: %d mV\n",
info->design_voltage);
- p += sprintf(p, "Design Capacity Warning %d\n",
- info->design_capacity_warning);
- p += sprintf(p, "Design Capacity Low %d\n",
- info->design_capacity_low);
- p += sprintf(p, "Battery Capacity Granularity 1 %d\n",
+ p += sprintf(p, "Design Capacity Warning: %d %sh\n",
+ info->design_capacity_warning, batt_list[batt_num].power_unit);
+ p += sprintf(p, "Design Capacity Low: %d %sh\n",
+ info->design_capacity_low, batt_list[batt_num].power_unit);
+ p += sprintf(p, "Battery Capacity Granularity 1: %d\n",
info->battery_capacity_granularity_1);
- p += sprintf(p, "Battery Capacity Granularity 2 %d\n",
+ p += sprintf(p, "Battery Capacity Granularity 2: %d\n",
info->battery_capacity_granularity_2);
- p += sprintf(p, "model number %s\nserial number %s\nbattery type %s\nOEM info %s\n",
+ p += sprintf(p, "Model number; %s\nSerial number: %s\nBattery type: %s\nOEM info: %s\n",
info->model_number,info->serial_number,
info->battery_type,info->oem_info);
end:
@@ -308,40 +310,29 @@
goto end;
}
- printk("getting batt status\n");
-
if (acpi_get_battery_status(batt_list[batt_num].handle, &status) != AE_OK) {
printk(KERN_ERR "Cmbatt: acpi_get_battery_status failed\n");
goto end;
}
- p += sprintf(p, "Remaining Capacity: %x\n", status.remaining_capacity);
+ p += sprintf(p, "Battery discharging: %s\n",
+ (status.state & 0x1)?"yes":"no");
+ p += sprintf(p, "Battery charging: %s\n",
+ (status.state & 0x2)?"yes":"no");
+ p += sprintf(p, "Battery critically low: %s\n",
+ (status.state & 0x4)?"yes":"no");
+
+ if (status.present_rate != ACPI_BATT_UNKNOWN)
+ p += sprintf(p, "Battery rate: %d %s\n",
+ status.present_rate, batt_list[batt_num].power_unit);
- if (status.state & 0x1)
- p += sprintf(p, "Battery discharging\n");
- if (status.state & 0x2)
- p += sprintf(p, "Battery charging\n");
- if (status.state & 0x4)
- p += sprintf(p, "Battery critically low\n");
-
- if (status.present_rate == ACPI_BATT_UNKNOWN)
- p += sprintf(p, "Battery rate unknown\n");
- else
- p += sprintf(p, "Battery rate %x\n",
- status.present_rate);
-
- if (status.remaining_capacity == ACPI_BATT_UNKNOWN)
- p += sprintf(p, "Battery capacity unknown\n");
- else
- p += sprintf(p, "Battery capacity %x %s\n",
+ if (status.remaining_capacity != ACPI_BATT_UNKNOWN)
+ p += sprintf(p, "Battery capacity: %d %sh\n",
status.remaining_capacity, batt_list[batt_num].power_unit);
- if (status.present_voltage == ACPI_BATT_UNKNOWN)
- p += sprintf(p, "Battery voltage unknown\n");
- else
- p += sprintf(p, "Battery voltage %x volts\n",
+ if (status.present_voltage != ACPI_BATT_UNKNOWN)
+ p += sprintf(p, "Battery voltage: %d mV\n",
status.present_voltage);
-
end:
len = (p - page);
--
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]
> This fixes units, and makes format tag: value. Please apply.
The units seem to vary. I suggest using fundamental SI units.
That would be meters, kilograms, seconds, and maybe a very
few others -- my memory fails me on this.
Power meter applets will be eternally buggy if you force them
to deal with units that change. In fact there is no reason to
print the units if you always use the fundamental units.
Albert D. Cahalan writes:
> The units seem to vary. I suggest using fundamental SI units.
> That would be meters, kilograms, seconds, and maybe a very
> few others -- my memory fails me on this.
iirc, SI comes from France, and therefore it should be "metres"
[flames to /dev/null please] ;)
--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
>The units seem to vary. I suggest using fundamental SI units.
>That would be meters, kilograms, seconds, and maybe a very
>few others -- my memory fails me on this.
There are lots of SI units, one for each physical dimension that can be
measured. Some of the ones that might apply here are:
- Volts
- Coulombs
- Watts
- Amperes
- Seconds
- Joules
Some non-SI units that may be acceptable in this context due to common usage:
- Watt-hours (should strictly be joules for this measurement)
--------------------------------------------------------------
from: Jonathan "Chromatix" Morton
mail: [email protected] (not for attachments)
big-mail: [email protected]
uni-mail: [email protected]
The key to knowledge is not to rely on people to teach you it.
Get VNC Server for Macintosh from http://www.chromatix.uklinux.net/vnc/
-----BEGIN GEEK CODE BLOCK-----
Version 3.12
GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS
PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r- y+
-----END GEEK CODE BLOCK-----
>> The units seem to vary. I suggest using fundamental SI units.
>> That would be meters, kilograms, seconds, and maybe a very
>> few others -- my memory fails me on this.
>
> There are lots of SI units, one for each physical dimension
> that can be measured. Some of the ones that might apply here are:
>
> - Volts
> - Coulombs
> - Watts
> - Amperes
> - Seconds
> - Joules
No, these are not all fundamental.
1 Joule == 1 newton * 1 meter
The newton isn't fundamental either. It is defined in terms
of meters, seconds, and kilograms.
So if I've not mucked something up, 1 J == 1 m*kg*m/s/s.
Units get ugly when arbitrary powers of 10 get thrown in,
and worse with random odd constants. Amperes have a 2.0e-7
in the definition.
On Sat, 3 Feb 2001, Russell King wrote:
> Albert D. Cahalan writes:
> > The units seem to vary. I suggest using fundamental SI units.
> > That would be meters, kilograms, seconds, and maybe a very
> > few others -- my memory fails me on this.
>
> iirc, SI comes from France, and therefore it should be "metres"
Yes. Quite why a distance matters to the battery is another question,
though...
For the end-user, the ability to see readings in other units would be
useful - how many people on this list work in litres/metres/kilometres,
and how many in gallons/feet/miles? Probably enough in both groups that
neither could count as universal...
James.
James Sutherland wrote:
>
> On Sat, 3 Feb 2001, Russell King wrote:
>
> > Albert D. Cahalan writes:
> > > The units seem to vary. I suggest using fundamental SI units.
> > > That would be meters, kilograms, seconds, and maybe a very
> > > few others -- my memory fails me on this.
> >
> > iirc, SI comes from France, and therefore it should be "metres"
>
> Yes. Quite why a distance matters to the battery is another question,
> though...
Quite. We all know its only the kilograms that matter in a notebook!
Regards,
Steve
On Sun, 4 Feb 2001, James Sutherland wrote:
> For the end-user, the ability to see readings in other units would be
> useful - how many people on this list work in litres/metres/kilometres,
> and how many in gallons/feet/miles? Probably enough in both groups that
> neither could count as universal...
Yeah. We can have this as part of the locale settings, changable by
echoing the desired locale string to /proc/sys/kernel/lc_all.
--
dwmw2
David Woodhouse wrote:
> On Sun, 4 Feb 2001, James Sutherland wrote:
>
> > For the end-user, the ability to see readings in other units would be
> > useful - how many people on this list work in litres/metres/kilometres,
> > and how many in gallons/feet/miles? Probably enough in both groups that
> > neither could count as universal...
>
> Yeah. We can have this as part of the locale settings, changable by
> echoing the desired locale string to /proc/sys/kernel/lc_all.
>
> -
Just an idea, . . but isn't this something better done in userland?
(ben@Deacon)-(06:49am Sun Feb 4)-(ben)
$ date +%s
981298161
(ben@Deacon)-(06:49am Sun Feb 4)-(ben)
$ date +%c
Sun Feb 4 06:49:24 2001
-b
On Sun, 4 Feb 2001, Ben Ford wrote:
> David Woodhouse wrote:
>
> > On Sun, 4 Feb 2001, James Sutherland wrote:
> >
> > > For the end-user, the ability to see readings in other units would be
> > > useful - how many people on this list work in litres/metres/kilometres,
> > > and how many in gallons/feet/miles? Probably enough in both groups that
> > > neither could count as universal...
> >
> > Yeah. We can have this as part of the locale settings, changable by
> > echoing the desired locale string to /proc/sys/kernel/lc_all.
> >
> > -
>
> Just an idea, . . but isn't this something better done in userland?
>
> (ben@Deacon)-(06:49am Sun Feb 4)-(ben)
> $ date +%s
> 981298161
> (ben@Deacon)-(06:49am Sun Feb 4)-(ben)
> $ date +%c
> Sun Feb 4 06:49:24 2001
That's what I'd do, anyway - /dev/pieceofstring would return the length of
said piece of string in some units, explicityly stated. (e.g. "5m" or
"15ft").
"uname -s" ("how long's a piece of string on this system") would then
convert the length into feet, metres or fathoms, depending on what the
user prefers.
James.
James Sutherland wrote:
>
> On Sun, 4 Feb 2001, Ben Ford wrote:
>
> > David Woodhouse wrote:
> >
> > > On Sun, 4 Feb 2001, James Sutherland wrote:
> > >
> > > > For the end-user, the ability to see readings in other units would be
> > > > useful - how many people on this list work in litres/metres/kilometres,
> > > > and how many in gallons/feet/miles? Probably enough in both groups that
> > > > neither could count as universal...
> > >
> > > Yeah. We can have this as part of the locale settings, changable by
> > > echoing the desired locale string to /proc/sys/kernel/lc_all.
> > >
> > > -
> >
> > Just an idea, . . but isn't this something better done in userland?
> >
> > (ben@Deacon)-(06:49am Sun Feb 4)-(ben)
> > $ date +%s
> > 981298161
> > (ben@Deacon)-(06:49am Sun Feb 4)-(ben)
> > $ date +%c
> > Sun Feb 4 06:49:24 2001
>
> That's what I'd do, anyway - /dev/pieceofstring would return the length of
> said piece of string in some units, explicityly stated. (e.g. "5m" or
> "15ft").
>
> "uname -s" ("how long's a piece of string on this system") would then
> convert the length into feet, metres or fathoms, depending on what the
> user prefers.
>
> James.
Don't get carried away. In the present context we are only talking about
time and electrical measurements. Whilst most of the human race can't
read the English labels in /proc, they all use the same measurements for
electrical units and time (unless the time exceeds 24 hours, where dates
get a bit screwed up). In this case even the US in in line with the rest
of humanity............. or would you like to be able to express battery
capacity in BTUs?
Regards,
Steve
On Sun, 4 Feb 2001, James Sutherland wrote:
> On Sun, 4 Feb 2001, Ben Ford wrote:
> > David Woodhouse wrote:
> > > Yeah. We can have this as part of the locale settings, changeable by
> > > echoing the desired locale string to /proc/sys/kernel/lc_all.
> >
> > Just an idea, . . but isn't this something better done in userland?
>
> That's what I'd do, anyway
STOP!
I'll repeat myself, in the en_US locale this time...
<SARCASM>
Yeah. We can have this as part of the locale settings, changeable by
echoing the desired locale string to /proc/sys/kernel/lc_all.
</SARCASM>
<SUBTEXT TYPE=HIDDEN>Go away and troll elsewhere</SUBTEXT>
--
dwmw2
On Mon, 5 Feb 2001, Steve Underwood wrote:
> James Sutherland wrote:
> > On Sun, 4 Feb 2001, Ben Ford wrote:
> > > David Woodhouse wrote:
> > > > On Sun, 4 Feb 2001, James Sutherland wrote:
> > > >
> > > > > For the end-user, the ability to see readings in other units would be
> > > > > useful - how many people on this list work in litres/metres/kilometres,
> > > > > and how many in gallons/feet/miles? Probably enough in both groups that
> > > > > neither could count as universal...
> > > >
> > > > Yeah. We can have this as part of the locale settings, changable by
> > > > echoing the desired locale string to /proc/sys/kernel/lc_all.
> > >
> > > Just an idea, . . but isn't this something better done in userland?
> > >
> > > (ben@Deacon)-(06:49am Sun Feb 4)-(ben)
> > > $ date +%s
> > > 981298161
> > > (ben@Deacon)-(06:49am Sun Feb 4)-(ben)
> > > $ date +%c
> > > Sun Feb 4 06:49:24 2001
> >
> > That's what I'd do, anyway - /dev/pieceofstring would return the length of
> > said piece of string in some units, explicityly stated. (e.g. "5m" or
> > "15ft").
> >
> > "uname -s" ("how long's a piece of string on this system") would then
> > convert the length into feet, metres or fathoms, depending on what the
> > user prefers.
>
> Don't get carried away. In the present context we are only talking about
> time and electrical measurements. Whilst most of the human race can't
> read the English labels in /proc, they all use the same measurements for
> electrical units and time (unless the time exceeds 24 hours, where dates
> get a bit screwed up). In this case even the US in in line with the rest
> of humanity............. or would you like to be able to express battery
> capacity in BTUs?
Personally, I'd prefer a percentage and/or estimated time remaining
anyway... However, from the kernel's PoV, the rule is just "KISS". Print
in something consistent, let userspace do any conversions you
want. Probably seconds for time (simplest - scripts can compare "if
est_batterylife_remaining < 300 do something", UI things can convert to
H:M:S or whatever), watts for power.
What is measured, BTW - battery voltage, presumably, and drain
current?
James.
> > Yeah. We can have this as part of the locale settings, changable by
> > echoing the desired locale string to /proc/sys/kernel/lc_all.
>
> Just an idea, . . but isn't this something better done in userland?
Please remember this is an international list. For the benefit of certain
users please mark all sarcasm with the word NOT or a simply face
David Woodhouse wrote:
> On Sun, 4 Feb 2001, James Sutherland wrote:
> > On Sun, 4 Feb 2001, Ben Ford wrote:
> > > David Woodhouse wrote:
> On Sun, 4 Feb 2001, James Sutherland wrote:
>
> > For the end-user, the ability to see readings in other units would be
> > useful - how many people on this list work in litres/metres/kilometres,
> > and how many in gallons/feet/miles? Probably enough in both groups that
> > neither could count as universal...
>
>
> > > > Yeah. We can have this as part of the locale settings, changeable by
> > > > echoing the desired locale string to /proc/sys/kernel/lc_all.
> > >
> > > Just an idea, . . but isn't this something better done in userland?
> >
> > That's what I'd do, anyway
>
> STOP!
>
> I'll repeat myself, in the en_US locale this time...
>
> <SARCASM>
> Yeah. We can have this as part of the locale settings, changeable by
> echoing the desired locale string to /proc/sys/kernel/lc_all.
> </SARCASM>
> <SUBTEXT TYPE=HIDDEN>Go away and troll elsewhere</SUBTEXT>
>
> --
> dwmw2
You have an odd definition of troll. Tell me, who is trolling, the guy who
posts something trying to help or the guy who posts sarcastic responses to
things? You appear to have a major case of little-dick syndrome.
-b
Hi!
> > This fixes units, and makes format tag: value. Please apply.
>
> The units seem to vary. I suggest using fundamental SI units.
> That would be meters, kilograms, seconds, and maybe a very
> few others -- my memory fails me on this.
No!
volt = m^2 g sec^-3 A^-1
I do not want to learn that my battery has voltage of
10.8 m^2 g sec^-3 A^-1
!
Pavel
--
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]
Hi!
> > This fixes units, and makes format tag: value. Please apply.
>
> The units seem to vary. I suggest using fundamental SI units.
> That would be meters, kilograms, seconds, and maybe a very
> few others -- my memory fails me on this.
>
> Power meter applets will be eternally buggy if you force them
> to deal with units that change. In fact there is no reason to
> print the units if you always use the fundamental units.
Problem is that _hardware_ wants to talk us two different units.
Sometimes it wants to tell us watts.
Sometimes hw wants to tell us volts and ampers.
I believe kernel should not do any translation. [It is _not_ trivial
-- if battery voltage changes with time.]
Pavel
--
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]