Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)

Pedro Venda
2005-01-09T12:04:32Z

[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ultrakorne wrote:
| Bruno Ducrot wrote:
|
|> On Fri, Dec 31, 2004 at 04:07:24PM +0100, Bruno Ducrot wrote:
|>
|>> I'm polishing i2c-acpi-ec right now. Stay tunned.
|>
|>
|>
|> It's not yet really polished as I wanted, but well I don't have
|> time to finish this due to, huh, ..., private stuff this night.
|>
|> its should give people rough idea what will happens.
|>
|> You can find this at http://www.poupinou.org/acpi/smartbatt/
|> Take one of the smartbatt.tar.{gz,bz2} and follow the README after
|> unpacking it, and hopefully a ./smartbatt will give you correct battery
|> informations (who knows).
|>
|> happy new year!
|>
| thx a lot ^^ seems to work fine for me
|
| ultra@doom:~/acpi/smartbatt $ sudo ./smartbattery 1
| status: discharging
| current: 968 mA
| time to empty: 222 minutes
| remain: 3629 mAh
| temperature: 19.9 C
| voltage: 15986 mV
|
| % i think is better than minuts (both is better :D)

the battery can return that too. use this patch.

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB4R3QeRy7HWZxjWERAsB7AKDLrNGL2nKRgOLDs/rDFuGdZDMzHgCgtDqB
lSI47vFmV5OJZ02ho3HpDPk=
=NBkI
-----END PGP SIGNATURE-----

[-- Attachment #2: sbatt-percent.patch --]
[-- Type: text/plain, Size: 1256 bytes --]

Files smartbatt-original/smartbattery and smartbatt/smartbattery differ
diff -urN smartbatt-original/smartbattery.c smartbatt/smartbattery.c
--- smartbatt-original/smartbattery.c 2005-01-04 10:06:51.000000000 +0000
+++ smartbatt/smartbattery.c 2005-01-09 12:01:23.101616089 +0000
@@ -234,6 +234,7 @@
int i2cbus, address, file;
int temp, volt, tmp_current, remain, time_to_full, time_to_empty;
int unit;
+ int rel_state_charge;
short current;
int charging, discharging;
char filename[20];
@@ -301,6 +302,10 @@
temp = i2c_smbus_read_word_data(file, 0x8);
volt = i2c_smbus_read_word_data(file, 0x9);
tmp_current = i2c_smbus_read_word_data(file, 0xa);
+
+ /* RelativeStateOfCharge() */
+ rel_state_charge = i2c_smbus_read_word_data(file,0xd);
+
remain = i2c_smbus_read_word_data(file, 0xf);
time_to_empty = i2c_smbus_read_word_data(file, 0x12);
time_to_full = i2c_smbus_read_word_data(file, 0x13);
@@ -329,6 +334,8 @@
printf("remain: %.1f mWh\n", (remain & 0xffff)/10.);
else
printf("remain: %d mAh\n", (remain & 0xffff));
+
+ printf("charge state: %d\%\n",(rel_state_charge & 0xffff));

printf("temperature: %2.1f C\n", ((temp & 0xffff) - 2730) / 10.);
printf("voltage: %d mV\n", volt & 0xffff);