Skip to contentSkip to conversation

i2c-acpi-ec.c

DISCUSSION Pedro Venda 17 participants 64 messages Dec 31, 2004 – Jan 18, 2005 46 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 1 line · Mathias Weyland

Hi

hello,

Quoted 4 lines

My girlfriend bought a new notebook and asked me to install linux on it (she's fearing viruses ect.). It's an acer tm 2303lc and I installed a recent kernel on it. I was quite astonished when I got an empty /proc/acpi/battery, so I checked the dsdt but couldn't find any errors.

yes, from what I've found, smartbatteries are much more efficient than standard ones, so that's probably a good thing. I like to think so, since I have one.

Quoted 4 lines

After some time of googling, I read something about smartbatteries. I checked my asl code, and yes, I do have one of those smartbattery-things in front of me. That's quite a problem since my girlfriend will probably kill me when I tell her that battery monitoring is not working.

be prepared :-)

Quoted 4 lines

I've read in the acpi4linux list that you took Bruno's old code and that you
are working on a driver. So I wanted to ask whether you need any help (don't expect too much, I'm writing simulations for computional science and I do only have some minor knowledge of kernel programming (with a 2.0
codebase) and how far you got now.

I started to learn about kernel programming and i2c, smb, acpi etc, but I'm constantly interrupted because of academic work. So I've no time to efficiently develop such beast. Beast because of my no-experience in kernel programming and related subsystems.

About bruno's driver, I really don't remember well what I've done. I remember correctly addressing the smartbattery and getting some very basic information. nothing useful. I was happy for actually finding and talking to a smart battery though :-)

My standpoint right now is about the same as you. I'm offering help but won't author a driver because I'm unable to find enough free time.

regards,
pedro venda.

p.s.: I CC'd this reply to the acpi-devel mailing list. It's the place where you want to offer help. there are a couple of people that already have offered themselves to help.

Signature · 9 lines
Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 33 lines · Pedro Venda
Quoted 1 line · Mathias Weyland

Hi

hello,

Quoted 4 lines

My girlfriend bought a new notebook and asked me to install linux on it (she's fearing viruses ect.). It's an acer tm 2303lc and I installed a recent kernel on it. I was quite astonished when I got an empty /proc/acpi/battery, so I checked the dsdt but couldn't find any errors.

yes, from what I've found, smartbatteries are much more efficient than standard ones, so that's probably a good thing. I like to think so, since I have one.

Quoted 4 lines

After some time of googling, I read something about smartbatteries. I checked my asl code, and yes, I do have one of those smartbattery-things in front of me. That's quite a problem since my girlfriend will probably kill me when I tell her that battery monitoring is not working.

be prepared :-)

Quoted 6 lines

I've read in the acpi4linux list that you took Bruno's old code and that you
are working on a driver. So I wanted to ask whether you need any help (don't expect too much, I'm writing simulations for computional science and I do only have some minor knowledge of kernel programming (with a 2.0 codebase) and how far you got now.

I started to learn about kernel programming and i2c, smb, acpi etc, but I'm constantly interrupted because of academic work. So I've no time to efficiently develop such beast. Beast because of my no-experience in kernel programming and related subsystems.

Quoted 7 lines

About bruno's driver, I really don't remember well what I've done. I remember correctly addressing the smartbattery and getting some very basic information. nothing useful. I was happy for actually finding and talking to a smart battery though :-)

My standpoint right now is about the same as you. I'm offering help but won't author a driver because I'm unable to find enough free time.

I'm polishing i2c-acpi-ec right now. Stay tunned.

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

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

Quoted 2 lines · Bruno Ducrot

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!

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

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

Hello,

Since I own a ACER Travelmate 4001 which has a smartbattery, I tried this driver. Everythings works well until I try to compile smartbattery.c. If I launch the gcc command like explained in the README file, here is what I get:

gcc -W -Wall -O2 -o smartbattery smartbattery.c
smartbattery.c: Dans la fonction « main »:
smartbattery.c:274: attention : implicit declaration of function ioctl' smartbattery.c:274: error: I2C_FUNCS' undeclared (first use in this function) smartbattery.c:274: error: (Each undeclared identifier is reported only once smartbattery.c:274: error: for each function it appears in.)
smartbattery.c:280: error: I2C_FUNC_SMBUS_READ_WORD_DATA' undeclared (first use in this function) smartbattery.c:290: error: I2C_SLAVE_FORCE' undeclared (first use in this function) smartbattery.c:296: attention : implicit declaration of function `i2c_smbus_read_word_data'
zsh: exit 1 gcc -W -Wall -O2 -o smartbattery smartbattery.c
19:42 root@ordi-francois /home/francois/Noyau/smartbatt# ls
acpi-ec-2.6.10.diff i2c-acpi-ec/ README smartbattery.c
19:42 root@ordi-francois /home/francois/Noyau/smartbatt# gcc -W -Wall -O2 -o smartbattery smartbattery.c smartbattery.c: Dans la fonction « main »:
smartbattery.c:274: attention : implicit declaration of function ioctl' smartbattery.c:274: error: I2C_FUNCS' undeclared (first use in this function) smartbattery.c:274: error: (Each undeclared identifier is reported only once smartbattery.c:274: error: for each function it appears in.)
smartbattery.c:280: error: I2C_FUNC_SMBUS_READ_WORD_DATA' undeclared (first use in this function) smartbattery.c:290: error: I2C_SLAVE_FORCE' undeclared (first use in this function) smartbattery.c:296: attention : implicit declaration of function `i2c_smbus_read_word_data'
zsh: exit 1 gcc -W -Wall -O2 -o smartbattery smartbattery.c

Nevertheless, Thanks very much for your help in supporting smartbatteries and off course, happy new year !

Quoted 10 lines · Bruno Ducrot
Quoted 3 lines · Bruno Ducrot

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.

Quoted 11 lines

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!

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

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

Quoted 7 lines · François Valenduc

Hello,

Since I own a ACER Travelmate 4001 which has a smartbattery, I tried this driver. Everythings works well until I try to compile smartbattery.c. If I launch the gcc command like explained in the README file, here is what I get:

Quoted 11 lines

gcc -W -Wall -O2 -o smartbattery smartbattery.c
smartbattery.c: Dans la fonction « main »:
smartbattery.c:274: attention : implicit declaration of function ioctl' smartbattery.c:274: error: I2C_FUNCS' undeclared (first use in this function)
smartbattery.c:274: error: (Each undeclared identifier is reported only once smartbattery.c:274: error: for each function it appears in.) smartbattery.c:280: error: `I2C_FUNC_SMBUS_READ_WORD_DATA' undeclared (first use in this function)
smartbattery.c:290: error: `I2C_SLAVE_FORCE' undeclared (first use in this function)

I missed up some include in /usr/local/include/linux installing latest lm-sensors I guess... Sorry. I don't have time to fix this properly.

Please refetch (will contain now the include I'm using) and do a

$ gcc -W -Wall -I./include -O2 -o smartbattery smartbattery.c

You need only this latest step.

Cheers,

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#11 lore raw

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

In reply to a message not in the archive

On Fri, Dec 31, 2004 at 07:16:28PM +0100, Bruno Ducrot wrote:

Hi

I managed to subscribe to the mailing list; thank you for CC-ing the whole discussion to me.

Quoted 2 lines

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.

Heh.

Quoted 4 lines

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).

Ok, here's what's happening:

corcovado:/usr/src/smartbatt# ./smartbattery
Error: No i2c-bus specified!
Syntax: smartbatt I2CBUS
  Installed I2C busses:
    i2c-1       unknown         ACPI EC SMBus adapter at 0018
Algorithm unavailable
    i2c-0       unknown         SMBus I801 adapter at 1880
Algorithm unavailable
corcovado:/usr/src/smartbatt# ./smartbattery  1
current:       65535 mA
remain:        65535 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   6280.5 C
voltage:       65535 mV

The values are wrong, but I guess you helped me a lot. I'll dive into the code this afternoon and I'll try to nail down the problem. As for now, what I can tell you is that the base address has been detected correctly. From my dsdt.asl:

                    Device (SMBC)
                    {
                        Name (_HID, "ACPI0001")
                        Name (_EC, 0x1820)
                        Device (SBS0)
                        {
                            Name (_HID, "ACPI0002")
                            Name (_SBS, 0x01)
                        }
                    }

Loading the module shows:

i2c_acpi_ec: disagrees about version of symbol struct_module
base: 0x18 alert: 0x20
i2c-acpi-ec.c: ACPI EC SMBus adapter at 0x18

So at least that is working.

But something puzzeled me a bit:

corcovado:/home/lea# i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          XX XX XX XX XX XX XX XX XX XX XX XX XX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
70: XX XX XX XX XX XX XX XX

At least the output differs from what Pedro (IIRC) got in October.

Regards & thank you very much for the effort!

Mathias

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

Re: first shoot for smartbattery

Happy New Year to y'all!

Quoted 8 lines · Mathias Weyland
corcovado:/usr/src/smartbatt# ./smartbattery
Error: No i2c-bus specified!
Syntax: smartbatt I2CBUS
  Installed I2C busses:
    i2c-1       unknown         ACPI EC SMBus adapter at 0018
Algorithm unavailable
    i2c-0       unknown         SMBus I801 adapter at 1880
Algorithm unavailable

I only have one bus i2c-0 (ACPI EC SMBus adapter at 0018) here.

Quoted 7 lines
corcovado:/usr/src/smartbatt# ./smartbattery  1
current:       65535 mA
remain:        65535 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   6280.5 C
voltage:       65535 mV

Same here (with bus 0).
I also get a lot of spinlock errors in my system log.

Quoted 5 lines

Loading the module shows:

i2c_acpi_ec: disagrees about version of symbol struct_module
base: 0x18 alert: 0x20
i2c-acpi-ec.c: ACPI EC SMBus adapter at 0x18

Same here, except for the disagreement.

Quoted 7 lines
corcovado:/home/lea# i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          XX XX XX XX XX XX XX XX XX XX XX XX XX

Same here (also with a lot of spinlock errors).

Thanks for the good work!

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): m2acrth375.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#15 lore raw

Re: Re: first shoot for smartbattery

Quoted 46 lines · Johan Vromans

Happy New Year to y'all!

Quoted 8 lines · Mathias Weyland
corcovado:/usr/src/smartbatt# ./smartbattery
Error: No i2c-bus specified!
Syntax: smartbatt I2CBUS
Installed I2C busses:
i2c-1 unknown ACPI EC SMBus adapter at 0018
Algorithm unavailable
i2c-0 unknown SMBus I801 adapter at 1880
Algorithm unavailable

I only have one bus i2c-0 (ACPI EC SMBus adapter at 0018) here.

Quoted 7 lines
corcovado:/usr/src/smartbatt# ./smartbattery 1
current: 65535 mA
remain: 65535 mA or mWh
time to empty: 65535 minutes
time to full: 65535 minutes
temperature: 6280.5 C
voltage: 65535 mV

Same here (with bus 0).
I also get a lot of spinlock errors in my system log.

Quoted 5 lines

Loading the module shows:

i2c_acpi_ec: disagrees about version of symbol struct_module
base: 0x18 alert: 0x20
i2c-acpi-ec.c: ACPI EC SMBus adapter at 0x18

Same here, except for the disagreement.

Quoted 7 lines
corcovado:/home/lea# i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX XX XX XX XX XX
Quoted 6 lines

Same here (also with a lot of spinlock errors).

Thanks for the good work!

-- Johan

Hello everybody,
I also get the same results when I run the smartbattery or the i2cdetect program. Nevertheless, I don't get error in symbol while loading the i2c-acpi-ec module. I only get the base: 0x18 alert: 0x20 message. Nevertheless thanks a lot for your effort. Unfortunately, I don't have any knowledge in kernel programming so I can't help you to improve the driver.

Sincerely yours,
François Valenduc

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#16 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive
Quoted 23 lines · Johan Vromans

Happy New Year to y'all!

Quoted 8 lines · Mathias Weyland
corcovado:/usr/src/smartbatt# ./smartbattery
Error: No i2c-bus specified!
Syntax: smartbatt I2CBUS
  Installed I2C busses:
    i2c-1       unknown         ACPI EC SMBus adapter at 0018
Algorithm unavailable
    i2c-0       unknown         SMBus I801 adapter at 1880
Algorithm unavailable

I only have one bus i2c-0 (ACPI EC SMBus adapter at 0018) here.

Quoted 7 lines
corcovado:/usr/src/smartbatt# ./smartbattery  1
current:       65535 mA
remain:        65535 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   6280.5 C
voltage:       65535 mV
Quoted 3 lines

Same here (with bus 0).
I also get a lot of spinlock errors in my system log.

Could you post those errors?

Thanks,

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#17 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive
Quoted 4 lines · Johan Vromans

Happy New Year to y'all!

Mathias Weyland <[email protected]> writes:

I think I found was wrong. Please refetch, or (at your option) replace i2c-acpi-ec.ec with
http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
then redo the sh compile.sh
Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...

Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown bag will still be helpfull also...).

Cheers,

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#19 lore raw

Re: Re: first shoot for smartbattery

Quoted 5 lines · Bruno Ducrot

I think I found was wrong. Please refetch, or (at your option) replace i2c-acpi-ec.ec with
http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
then redo the sh compile.sh
Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...

Ok, I don't understand the joke with the brown bag, but.... wooohoo! It looks like something is working!

Wich ac plugged in:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       0 mA
remain:        2027 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   28.7 C
voltage:       16767 mV

And after I plugged it out:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64499 mA
remain:        2026 mA or mWh
time to empty: 117 minutes
time to full:  117 minutes
temperature:   28.7 C
voltage:       16428 mV

You definitley are my hero! Thank you very much. I'll instantly call my girlfriend.

Quoted 3 lines

Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown bag will still be helpfull also...).

Well yes, and when I run smartbattery several times, I don't always get exactley the same values:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64108 mA
remain:        1885 mA or mWh
time to empty: 79 minutes
time to full:  79 minutes
temperature:   30.1 C
voltage:       15950 mV
corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64159 mA
remain:        1885 mA or mWh
time to empty: 82 minutes
time to full:  82 minutes
temperature:   30.1 C
voltage:       15926 mV

And it would be nice if that could be read through a /sys file. I think it's time for me to contribute something: I'll fix the 65535 error and try to make the information available through a /sys interface.

Thank you very very much for all the work you made.

Best Regards

Mathias

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#21 lore raw

Re: Re: first shoot for smartbattery

Hello,
I must have missed something:

When I compile the i2c-acpi-ec module, I get the following errors:
*** Warning: "i2c_del_adapter" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! *** Warning: "i2c_add_adapter" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! *** Warning: "acpi_ec_read" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! *** Warning: "acpi_ec_write" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! I also have a problem when I load the i2c-core module:
i2c_core: disagrees about version of symbol struct_module

What should I do to fix these errors ?
Thanks for your help,
François Valenduc

Quoted 69 lines · Mathias Weyland
Quoted 6 lines · Bruno Ducrot

I think I found was wrong. Please refetch, or (at your option) replace i2c-acpi-ec.ec with
http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c

then redo the sh compile.sh
Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...

Ok, I don't understand the joke with the brown bag, but.... wooohoo! It looks like something is working!

Wich ac plugged in:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       0 mA
remain:        2027 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   28.7 C
voltage:       16767 mV

And after I plugged it out:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64499 mA
remain:        2026 mA or mWh
time to empty: 117 minutes
time to full:  117 minutes
temperature:   28.7 C
voltage:       16428 mV

You definitley are my hero! Thank you very much. I'll instantly call my girlfriend.

Quoted 3 lines

Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown bag will still be helpfull also...).

Well yes, and when I run smartbattery several times, I don't always get exactley the same values:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64108 mA
remain:        1885 mA or mWh
time to empty: 79 minutes
time to full:  79 minutes
temperature:   30.1 C
voltage:       15950 mV
corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64159 mA
remain:        1885 mA or mWh
time to empty: 82 minutes
time to full:  82 minutes
temperature:   30.1 C
voltage:       15926 mV

And it would be nice if that could be read through a /sys file. I think it's time for me to contribute something: I'll fix the 65535 error and try to make the information available through a /sys interface.

Thank you very very much for all the work you made.

Best Regards

Mathias

Quoted 9 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#23 lore raw

Re: Re: first shoot for smartbattery

Hello again,
In fact, after having completely recompiled the modules, it works better however the value for "time to empty" seems more correct. Here are the results with the AC adapter unplugged:
current: 64345 mA
remain: 6327 mA or mWh
time to empty: 221 minutes

   time to full:  221 minutes
   temperature:   27.4 C
   voltage:       16589 mV

And with the AC adapter plugged:
current: 0 mA
remain: 6330 mA or mWh
time to empty: 65535 minutes

   time to full:  65535 minutes
   temperature:   27.4 C
   voltage:       16809 mV

I don't really understand why each time the time to full or to empty are the same. I tried it knowing my battery was fully loaded so I should get 0 minute for time to full.

Quoted 100 lines · François Valenduc

Hello,
I must have missed something:

When I compile the i2c-acpi-ec module, I get the following errors:
*** Warning: "i2c_del_adapter" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! *** Warning: "i2c_add_adapter" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! *** Warning: "acpi_ec_read" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! *** Warning: "acpi_ec_write" [/usr/src/smartbatt/i2c-acpi-ec/i2c-acpi-ec.ko] undefined! I also have a problem when I load the i2c-core module:
i2c_core: disagrees about version of symbol struct_module

What should I do to fix these errors ?
Thanks for your help,
François Valenduc

Quoted 71 lines · Mathias Weyland
Quoted 6 lines · Bruno Ducrot

I think I found was wrong. Please refetch, or (at your option) replace i2c-acpi-ec.ec with
http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c

then redo the sh compile.sh
Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...

Ok, I don't understand the joke with the brown bag, but.... wooohoo! It looks like something is working!

Wich ac plugged in:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       0 mA
remain:        2027 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   28.7 C
voltage:       16767 mV

And after I plugged it out:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64499 mA
remain:        2026 mA or mWh
time to empty: 117 minutes
time to full:  117 minutes
temperature:   28.7 C
voltage:       16428 mV

You definitley are my hero! Thank you very much. I'll instantly call my girlfriend.

Quoted 3 lines

Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown bag will still be helpfull also...).

Well yes, and when I run smartbattery several times, I don't always get exactley the same values:

corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64108 mA
remain:        1885 mA or mWh
time to empty: 79 minutes
time to full:  79 minutes
temperature:   30.1 C
voltage:       15950 mV
corcovado:/usr/src/smartbatt# ./smartbattery 1
current:       64159 mA
remain:        1885 mA or mWh
time to empty: 82 minutes
time to full:  82 minutes
temperature:   30.1 C
voltage:       15926 mV

And it would be nice if that could be read through a /sys file. I think it's time for me to contribute something: I'll fix the 65535 error and try to make the information available through a /sys interface.

Thank you very very much for all the work you made.

Best Regards

Mathias

Quoted 9 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

Quoted 10 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#25 lore raw

Re: Re: first shoot for smartbattery

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

Salut François,

Quoted 10 lines · François Valenduc

...
however the value for "time to empty" seems more correct.

results with the AC adapter unplugged:
current: 64345 mA
remain: 6327 mA or mWh
time to empty: 221 minutes

  time to full:  221 minutes
  temperature:   27.4 C
  voltage:       16589 mV
Quoted 8 lines

And with the AC adapter plugged:
current: 0 mA
remain: 6330 mA or mWh
time to empty: 65535 minutes

  time to full:  65535 minutes
  temperature:   27.4 C
  voltage:       16809 mV

I don't really understand why each time the time to full or to empty are the same. I tried it knowing my battery was fully loaded so I should get 0 minute for time to full.

I did not look into the source... but usually the times are calculated:
You take the capacity (remain-value) and divide it by the current. As the ACPI-1.0 spec only asks for a current-value, if you use a rechargable-battery and if this is in discharging-mode, you see, that they did only, what the specs asked as a minimum. I am not sure, if the current-value would not need to be -1, if it is unknown however. So it is quite clear, that dividing something (especially if this itself is not zero) by zero will give you an +overflow... with MAX_UINT (65535 for 16bit) is the nearest representable value.

Cheers
hartwig felger

Hartwig Felger informatics

- -- 1024D/339FD693 Hartwig Felger <[email protected]> Key fingerprint = FB2F 3EE9 345A D55B 6FF2 0EC1 F5B0 684F 339F D693 For the pulic keys, please visit my page.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFB2XrI9bBoTzOf1pMRAgMjAKDbqUvfvroCvKk63ntxTxxSru9H8wCgrlr8 Ro5LxZQc1D5jkA6RSdOiAKI=
=s2U+
-----END PGP SIGNATURE-----

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.60.0501031751590.5329-KnfdeQs3A3X/[email protected]

#27 lore raw

Re: Re: first shoot for smartbattery

Quoted 10 lines · On Mon, Jan 03, 2005 at 06:02:59PM +0100…

I did not look into the source... but usually the times are calculated:
You take the capacity (remain-value) and divide it by the current. As the ACPI-1.0 spec only asks for a current-value, if you use a rechargable-battery and if this is in discharging-mode, you see, that they did only, what the specs asked as a minimum. I am not sure, if the current-value would not need to be -1, if it is unknown however. So it is quite clear, that dividing something (especially if this itself is not zero) by zero will give you an +overflow... with MAX_UINT (65535 for 16bit) is the nearest representable value.

I'm much more a lazy man than that and much prefer to get those values from the sensor ;)
The current is an int but it should be a short and is negative if discharging. Look at smartbattery data spec at
http://www.sbs-forum.org/specs/index.html

And the 2 times given was the same actually. It's now corrected.

But as said, it's a first shot and smartbattery.c will soon be dead.

Problem is: from the ASL, there is 2 Smart Batteries and a Smart Battery Selector (or a Smart Battery Manager).
I can go for the easy path at least for the smartbattery, since there is already a driver for it in lm-sensors-2.9.0. But actually there may be more than one battery that can be reached at the same address, then I'm for sure that the smartbattery stuff from lm-sensors can not handle multiple batteries.

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#29 lore raw

Re: Re: first shoot for smartbattery

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

Bruno Ducrot wrote:

| On Mon, Jan 03, 2005 at 06:02:59PM +0100, [email protected] wrote:
|
|>I did not look into the source... but usually the times are calculated:
|>You take the capacity (remain-value) and divide it by the current. As the
|>ACPI-1.0 spec only asks for a current-value, if you use a
|>rechargable-battery and if this is in discharging-mode, you see, that they
|>did only, what the specs asked as a minimum.  I am not sure, if the
|>current-value would not need to be -1, if it is unknown however.
|>So it is quite clear, that dividing something (especially if this itself
|>is not zero) by zero will give you an +overflow... with MAX_UINT (65535
|>for 16bit) is the nearest representable value.
|>
|
|
| I'm much more a lazy man than that and much prefer to get those values
| from the sensor ;)
| The current is an int but it should be a short and is negative
| if discharging.  Look at smartbattery data spec at
| http://www.sbs-forum.org/specs/index.html
|
| And the 2 times given was the same actually.  It's now corrected.
|
| But as said, it's a first shot and smartbattery.c will soon be dead.
|
| Problem is: from the ASL, there is 2 Smart Batteries and a Smart Battery
| Selector (or a Smart Battery Manager).
| I can go for the easy path at least for the smartbattery, since there is
| already a driver for it in lm-sensors-2.9.0.

Is that driver working?

| But actually there may be more
| than one battery that can be reached at the same address, then I'm for
| sure that the smartbattery stuff from lm-sensors can not handle multiple
| batteries.
|

Would the result be the creation of /proc/acpi/battery and /proc/acpi/ac_adapter like other batteries?

The way I see it, the i2c-acpi-ec driver allows the creation of the /proc files so that userland programs can use them normally. Am I totally wrong and should quickly look for the brown bag?

regards,
pedro venda.

- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2ffKeRy7HWZxjWERAo20AKCFFcnL7TXzxYGopcccKZS6aWnJAACg+DuW HdI0cqcta0XA+Qaw7ql16JQ=
=oyXJ
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#31 lore raw

Re: Re: first shoot for smartbattery

Quoted 3 lines · Pedro Venda

Would the result be the creation of /proc/acpi/battery and /proc/acpi/ac_adapter
like other batteries?

Something like this. But only to provide compatibility with existing programs. A long term goal would be to design a generic API for battery stuff (APM, ACPI Control Method Battery, smartbatteries subsystem and PMU come to mind).

Quoted 5 lines

The way I see it, the i2c-acpi-ec driver allows the creation of the /proc files
so that userland programs can use them normally. Am I totally wrong and should
quickly look for the brown bag?

I would like to not touch i2c-acpi-ec for this. It should only provide the smbus access. All other components should be done elsewhere IMHO.

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#33 lore raw

Re: Re: first shoot for smartbattery

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

Bruno Ducrot wrote:

| On Tue, Jan 04, 2005 at 01:56:26AM +0000, Pedro Venda wrote:
|
|>Would the result be the creation of /proc/acpi/battery and
|>/proc/acpi/ac_adapter
|>like other batteries?
|
|
| Something like this.  But only to provide compatibility with existing
| programs.  A long term goal would be to design a generic API for battery
| stuff (APM, ACPI Control Method Battery, smartbatteries subsystem and
| PMU come to mind).
|
|
|>The way I see it, the i2c-acpi-ec driver allows the creation of the /proc
|>files
|>so that userland programs can use them normally. Am I totally wrong and
|>should
|>quickly look for the brown bag?
|
|
| I would like to not touch i2c-acpi-ec for this.  It should
| only provide the smbus access.  All other components should be done
| elsewhere IMHO.

Sorry, I didn't understand. Don't we _have_ to use the i2c-acpi-ec to query and write information from/to the smart battery system? If so, there is no other way than to use it in the ACPI driver that writes the /proc information.

What am I getting wrong?

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2rXHeRy7HWZxjWERAsa9AJ41qxJrFKTcbBiJ2ryY8d7Ufu4rywCg8DFN RSCK+FyoMhFghqhMRiX2sog=
=jZF9
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#35 lore raw

Re: Re: first shoot for smartbattery

Quoted 15 lines · Pedro Venda

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

Bruno Ducrot wrote:

|>The way I see it, the i2c-acpi-ec driver allows the creation of the /proc
|>files
|>so that userland programs can use them normally. Am I totally wrong and
|>should
|>quickly look for the brown bag?
|
|
| I would like to not touch i2c-acpi-ec for this.  It should
| only provide the smbus access.  All other components should be done
| elsewhere IMHO.
Quoted 6 lines

Sorry, I didn't understand. Don't we _have_ to use the i2c-acpi-ec to query and
write information from/to the smart battery system? If so, there is no other way
than to use it in the ACPI driver that writes the /proc information.

i2c-acpi-ec only provide the smbus access (KISS unix way). More, there may be other smartbattery systems using different smbus. Smbus under PIIX4 for older laptop, or smbus via bios come to mind, though this should apply only for older laptops. Also, even though there is already support for apple laptops, most of them seems to have smartbatteries (after reading source code under linux), so allowing code factoring.

The short term goal which is to mimic the current ACPI Control Method Battery in order to get compatibility with userspace program should be finished today or tomorrow.

Cheers,

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#37 lore raw

Re: Re: first shoot for smartbattery

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

Bruno Ducrot wrote:

| On Tue, Jan 04, 2005 at 03:27:03PM +0000, Pedro Venda wrote:
|
|>-----BEGIN PGP SIGNED MESSAGE-----
|>Hash: SHA1
|>
|>Bruno Ducrot wrote:
|>|>The way I see it, the i2c-acpi-ec driver allows the creation of the /proc
|>|>files
|>|>so that userland programs can use them normally. Am I totally wrong and
|>|>should
|>|>quickly look for the brown bag?
|>|
|>|
|>| I would like to not touch i2c-acpi-ec for this.  It should
|>| only provide the smbus access.  All other components should be done
|>| elsewhere IMHO.
|>
|>Sorry, I didn't understand. Don't we _have_ to use the i2c-acpi-ec to query
|>and
|>write information from/to the smart battery system? If so, there is no
|>other way
|>than to use it in the ACPI driver that writes the /proc information.
|>
|
|
| i2c-acpi-ec only provide the smbus access (KISS unix way). More,
| there may be other smartbattery systems using different smbus.
| Smbus under PIIX4 for older laptop, or smbus via bios come to
| mind, though this should apply only for older laptops.
| Also, even though there is already support for apple laptops, most
| of them seems to have smartbatteries (after reading source code under
| linux), so allowing code factoring.
|
| The short term goal which is to mimic the current ACPI Control Method
| Battery in order to get compatibility with userspace program should be
| finished today or tomorrow.
|
| Cheers,
|

hi bruno,

I've been around messing with the smartbattery.c and I've come across something I can's sort out by myself:

the battery address 0xb you hardcoded in the program (unless specified in the command line) is listed on the ACPI specification as an "example". I've read the entire chapter 11 and didn't find how one can pinpoint the exact address instead of assuming one... Am i missing something? or did you assume the standard was 0xb? otherwise, how can one determine the correct address for the battery or the charger?

btw: is the smartbattery ACPI Control Method Battery driver emulator ready to take on some testing? not rushing.

regards,
pedro venda.

- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB46TzeRy7HWZxjWERAn6DAKCz8Btq9ccUaq9AMn7oZt/XFgzJOACeJitG +a0tskRiKRXV8w8mK5cAQXE=
=viBv
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#38 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive
Quoted 11 lines · Mathias Weyland
Quoted 5 lines · Bruno Ducrot

I think I found was wrong. Please refetch, or (at your option) replace i2c-acpi-ec.ec with
http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
then redo the sh compile.sh
Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...

Ok, I don't understand the joke with the brown bag, but.... wooohoo! It looks like something is working!

The joke with the brown bag? Well, that's means that I have introduced a so stupid bug that I have to hide my face.

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#39 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive

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

Bruno Ducrot wrote:

| I think I found was wrong.  Please refetch, or (at your option) replace
| i2c-acpi-ec.ec with
| http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
| then redo the sh compile.sh
| Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...

happens to everyone.

| Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in
| order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
| bag will still be helpfull also...).

yes, that still happens. appearently rmmod doesn't deregister drivers.

but now I've got it working.

no battery plugged:

archon smartbatt-2 # ./smartbattery 5

current:       65535 mA
remain:        65535 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   6280.5 C
voltage:       65535 mV

all values are bogus, of course. no problem here.
now AC plugged and battery plugged too:

archon smartbatt-2 # ./smartbattery 5

current:       0 mA
remain:        3733 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   25.4 C
voltage:       16787 mV
archon smartbatt-2 # ./smartbattery 5
current:       189 mA
remain:        3733 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   25.6 C
voltage:       16846 mV

ok. it's draining a small amount of current, which is understandable because it's almost full.

how can one relate the remain/time to empty/time to full values? we need the maximum charge of the battery, right?

now battery plugged but no AC power:

archon smartbatt-2 # ./smartbattery 5

current:       64419 mA
remain:        3737 mA or mWh
time to empty: 200 minutes
time to full:  200 minutes
temperature:   27.4 C
voltage:       16496 mV
archon smartbatt-2 # ./smartbattery 5
current:       64423 mA
remain:        3735 mA or mWh
time to empty: 201 minutes
time to full:  201 minutes
temperature:   27.5 C
voltage:       16477 mV
archon smartbatt-2 # ./smartbattery 5
current:       64421 mA
remain:        3733 mA or mWh
time to empty: 200 minutes
time to full:  200 minutes
temperature:   27.5 C
voltage:       16461 mV

here I don't get it:
current 64419 mA? that's 64.4 A!! my dad's car battery can't do that!! is it being read wrong or am I missing something?
also, time to empty/time to full should be "xor'd" i.e., time to empty+time to full should return total battery power (in seconds) weird yes, but it makes sense when calculating averaga power drains, trust me.

note that I'm not at all putting flaws! I'm just pointing some details that I don't know what could be regular values.

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2XrzeRy7HWZxjWERAuduAJkBABAymV3IPFwO6Xwi3AIQeYdBPQCg+qCs QWVGOfxDEbREzIJiZAJ3RFU=
=WEIQ
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#41 lore raw

Re: Re: first shoot for smartbattery

Quoted 84 lines · Pedro Venda

Bruno Ducrot wrote:

| I think I found was wrong.  Please refetch, or (at your option) replace
| i2c-acpi-ec.ec with
| http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
| then redo the sh compile.sh
| Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...

happens to everyone.

| Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in
| order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
| bag will still be helpfull also...).

yes, that still happens. appearently rmmod doesn't deregister drivers.

but now I've got it working.

no battery plugged:

archon smartbatt-2 # ./smartbattery 5

current:       65535 mA
remain:        65535 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   6280.5 C
voltage:       65535 mV

all values are bogus, of course. no problem here.
now AC plugged and battery plugged too:

archon smartbatt-2 # ./smartbattery 5

current:       0 mA
remain:        3733 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   25.4 C
voltage:       16787 mV
archon smartbatt-2 # ./smartbattery 5
current:       189 mA
remain:        3733 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   25.6 C
voltage:       16846 mV

ok. it's draining a small amount of current, which is understandable because it's almost full.

how can one relate the remain/time to empty/time to full values? we need the maximum charge of the battery, right?

now battery plugged but no AC power:

archon smartbatt-2 # ./smartbattery 5

current:       64419 mA
remain:        3737 mA or mWh
time to empty: 200 minutes
time to full:  200 minutes
temperature:   27.4 C
voltage:       16496 mV
archon smartbatt-2 # ./smartbattery 5
current:       64423 mA
remain:        3735 mA or mWh
time to empty: 201 minutes
time to full:  201 minutes
temperature:   27.5 C
voltage:       16477 mV
archon smartbatt-2 # ./smartbattery 5
current:       64421 mA
remain:        3733 mA or mWh
time to empty: 200 minutes
time to full:  200 minutes
temperature:   27.5 C
voltage:       16461 mV

here I don't get it:
current 64419 mA? that's 64.4 A!! my dad's car battery can't do that!! is it being read wrong or am I missing something?
also, time to empty/time to full should be "xor'd" i.e., time to empty+time to
full should return total battery power (in seconds) weird yes, but it makes sense when calculating averaga power drains, trust me.

Quoted 4 lines

note that I'm not at all putting flaws! I'm just pointing some details that I
don't know what could be regular values.

I've rewritten that.
http://www.poupinou.org/acpi/smartbatt/smartbatt/smartbattery.c

Cheers,

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#42 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive

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

Pedro Venda wrote:

| Bruno Ducrot wrote:
|
| | I think I found was wrong.  Please refetch, or (at your option) replace
| | i2c-acpi-ec.ec with
| |
| http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
| | then redo the sh compile.sh
| | Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...
|
| happens to everyone.
|
| | Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in
| | order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
| | bag will still be helpfull also...).

ok I made a small patch against your most recent code base:

included:
- - a Makefile for the i2c-acpi-ec module
- - a Makefile for the smartbattery program which also calls the i2c-acpi-ec make process.

in the smartbattery directory, one just "make"s and everything gets built.

I found out that when draining power from the battery with no AC power, the value returned should be added to -65535 to result in the correct value.

this puzzles me, because when the battery is being used, the returned value seems to be subtracted from 65535 but when the AC is plugged, it seems to come out ok...

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2YJReRy7HWZxjWERAvBYAKCBMt5O6ZziU1SfS8gSyzNOmD9PQgCeNTtl KngbkKyfTNqKMxbGXUb3tI0=
=M+yB
-----END PGP SIGNATURE-----

Makefile +19 -0
diff -rNu smartbatt/Makefile smartbatt-2/Makefile
@@ -0,0 +1,19 @@
+CC=gcc
+CFLAGS=-I./include
+DEPS=smartbattery.c
+EFILE=smartbattery
+I2C-ACPI-EC=i2c-acpi-ec/i2c-acpi-ec.ko
+
+default:	$(EFILE) $(I2C-ACPI-EC)
+
+$(EFILE):	$(DEPS)
+	@echo "linking $@ from $<"
+	$(CC) $(CFLAGS) -o $@ $<
+	
+$(I2C-ACPI-EC):	
+	make -C i2c-acpi-ec
+
+.PHONY:	clean
+clean:
+	rm -f smartbattery smartbattery.o
+	make -C i2c-acpi-ec clean
i2c-acpi-ec/Makefile +16 -0
diff -rNu smartbatt/i2c-acpi-ec/Makefile smartbatt-2/i2c-acpi-ec/Makefile
@@ -1 +1,17 @@
+ifneq ($(KERNELRELEASE),)
 obj-m := i2c-acpi-ec.o
+
+else
+KDIR:= /lib/modules/$(shell uname -r)/build
+PWD:= $(shell pwd)
+
+default:
+	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+	
+.PHONY:	clean
+
+clean:
+	rm -f i2c-acpi-ec.ko i2c-acpi-ec.mod.* i2c-acpi-ec.o .i2c-acpi-ec.*
+	rm -rf .tmp_versions
+
+endif

Files smartbatt/smartbattery and smartbatt-2/smartbattery differ

smartbattery.c +2 -2
diff -rNu smartbatt/smartbattery.c smartbatt-2/smartbattery.c
@@ -300,8 +300,8 @@
 	time_to_empty = i2c_smbus_read_word_data(file, 0x11);
 	time_to_full = i2c_smbus_read_word_data(file, 0x11);
 
-	printf("current:       %d mA\n", current & 0xffff);
-	printf("remain:        %d mA or mWh\n", remain & 0xffff);
+	printf("current:       %d mA\n", (current & 0xffff));
+	printf("remain:        %d mAh or mW\n", remain & 0xffff);
 	printf("time to empty: %d minutes\n", time_to_empty & 0xffff);
 	printf("time to full:  %d minutes\n", time_to_full & 0xffff);
 	printf("temperature:   %2.1f C\n", ((temp & 0xffff) - 2730) / 10.);

A message that is not in the archive (sent off-list or not yet received): [email protected]

#44 lore raw

Re: Re: first shoot for smartbattery

Quoted 19 lines · Pedro Venda

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

Pedro Venda wrote:

| Bruno Ducrot wrote:
|
| | I think I found was wrong.  Please refetch, or (at your option) replace
| | i2c-acpi-ec.ec with
| |
| http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
| | then redo the sh compile.sh
| | Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...
|
| happens to everyone.
|
| | Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in
| | order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
| | bag will still be helpfull also...).
Quoted 1 line

ok I made a small patch against your most recent code base:

Thanks.

Quoted 8 lines

included:
- - a Makefile for the i2c-acpi-ec module
- - a Makefile for the smartbattery program which also calls the i2c-acpi-ec make
process.

in the smartbattery directory, one just "make"s and everything gets built.

Ok.

Quoted 8 lines

I found out that when draining power from the battery with no AC power, the value returned should be added to -65535 to result in the correct value.

this puzzles me, because when the battery is being used, the returned value seems to be subtracted from 65535 but when the AC is plugged, it seems to come
out ok...

Look at http://www.sbs-forum.org/specs/sbdat110.pdf
5.1.11. Current()
why this happens.

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#46 lore raw

Re: Re: first shoot for smartbattery

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

Bruno Ducrot wrote:

| On Mon, Jan 03, 2005 at 05:35:13PM +0000, Pedro Venda wrote:
|
|>-----BEGIN PGP SIGNED MESSAGE-----
|>Hash: SHA1
|>
|>Pedro Venda wrote:
|>| Bruno Ducrot wrote:
|>|
|>| | I think I found was wrong.  Please refetch, or (at your option) replace
|>| | i2c-acpi-ec.ec with
|>| |
|>| http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
|>| | then redo the sh compile.sh
|>| | Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...
|>|
|>| happens to everyone.
|>|
|>| | Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in
|>| | order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
|>| | bag will still be helpfull also...).
|>
|>ok I made a small patch against your most recent code base:
|
|
| Thanks.
|
|
|>included:
|>- - a Makefile for the i2c-acpi-ec module
|>- - a Makefile for the smartbattery program which also calls the
|>i2c-acpi-ec make
|>process.
|>
|>in the smartbattery directory, one just "make"s and everything gets built.
|
|
| Ok.

another thing: I changed the current drain from "mA or mWh" to "mAh or mW" in smartbattery.c but I'm having some doubts:

Are these energy or power measures?
for power measures, the units would be mA/h or mW for energy measures, the units would be mA or mW.h

so, maybe I changed it wrong... care to comment?

|>I found out that when draining power from the battery with no AC power, the
|>value returned should be added to -65535 to result in the correct value.
|>
|>this puzzles me, because when the battery is being used, the returned value
|>seems to be subtracted from 65535  but when the AC is plugged, it seems to
|>come
|>out ok...
|
|
| Look at http://www.sbs-forum.org/specs/sbdat110.pdf
| 5.1.11. Current()
| why this happens.

thanks for pointing me at the documentation. actually I would be doing that because I have some printed information at home. But until then, I must work a little more or else I'll never be an engineer.

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2aH1eRy7HWZxjWERAnzYAKCuThG375Tj8Mq44l1deufL4WSNOgCg2+Zy 2pNWdYHZaL+NJ/wLuODRv/I=
=QZTz
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#48 lore raw

Re: first shoot for smartbattery

Pedro Venda <[email protected]> writes:

According to the smartbattery figures, my TravelMate4001WLMI happily sitting in C3 @ 600Mhz will last for just over 4 hours. Nice.

Thanks, guys!

-- Johan

PS: I hacked a kernel module to control the email led on this (and maybe other) TravelMate. Will post soon.

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): m2mzvq5k7u.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#50 lore raw

Re: Re: first shoot for smartbattery

Hi,

that would be pretty cool, if you could post it.

Regards,
Johannes

Quoted 3 lines · Johan Vromans

.....
PS: I hacked a kernel module to control the email led on this (and maybe other) TravelMate. Will post soon.

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): 47e0449d05011304446094c8b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#52 lore raw

Re: first shoot for smartbattery

Quoted 7 lines · Johannes Kuhlmann
Quoted 3 lines · Johan Vromans

.....
PS: I hacked a kernel module to control the email led on this (and maybe other) TravelMate. Will post soon.

Hi,

that would be pretty cool, if you could post it.

It's on http://www.squirrel.nl/people/jvromans/

Articles -> TravelMate 4000 -> General Hacks

Happy hacking (and take care -- no guarantee).

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): m2fz11gl3c.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#54 lore raw

Re: first shoot for smartbattery

Quoted 10 lines · On 16.01.2005, 21:44 +0100 Johan Vromans wrote:
Quoted 5 lines · Johannes Kuhlmann
Quoted 2 lines

PS: I hacked a kernel module to control the email led on this (and maybe other) TravelMate. Will post soon.

Hi,

that would be pretty cool, if you could post it.

It's on http://www.squirrel.nl/people/jvromans/

Articles -> TravelMate 4000 -> General Hacks

I believe this functionality can already be found in the acerhk kernel module (http://www.informatik.hu-berlin.de/~tauber/acerhk/)

br,
Fionn

Signature · 12 lines
Software patents    -  not allowed in Europe | See whats going on:
Archiving Email     -  patented in Europe    | http://freepatents.org/
E-Shopping Baskets  -  patented in Europe    | Become active easily:
Cross-compiling     -  patented in Europe    | http://aktiv.ffii.org/eubsa/en




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#55 lore raw

Re: first shoot for smartbattery

Quoted 2 lines · Fionn Behrens

I believe this functionality can already be found in the acerhk kernel module (http://www.informatik.hu-berlin.de/~tauber/acerhk/)

Yes, I've looked at this one as well.
But it's discontinued, and doesn't seem to work on the TM4000.

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): m2pt04qt1j.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#57 lore raw

Re: Re: first shoot for smartbattery

Ah, very nice, thank you. :) I will try it this evening and tell you how it works.

As you said, the acerhk module doesn't work with the 4000 series.

Regards,
Johannes

Quoted 11 lines · Johan Vromans
Quoted 2 lines · Fionn Behrens

I believe this functionality can already be found in the acerhk kernel module (http://www.informatik.hu-berlin.de/~tauber/acerhk/)

Yes, I've looked at this one as well.
But it's discontinued, and doesn't seem to work on the TM4000.

-- Johan

Quoted 9 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): 47e0449d050117034912fb9ae3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#59 lore raw

Re: Re: first shoot for smartbattery

Maybe this article can help you, it's in spanish...

http://www.linuxzamora.org/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=22&page=1

Quoted 31 lines · Johannes Kuhlmann

Ah, very nice, thank you. :) I will try it this evening and tell you how it works.

As you said, the acerhk module doesn't work with the 4000 series.

Regards,
Johannes

Quoted 11 lines · Johan Vromans
Quoted 2 lines · Fionn Behrens

I believe this functionality can already be found in the acerhk kernel module (http://www.informatik.hu-berlin.de/~tauber/acerhk/)

Yes, I've looked at this one as well.
But it's discontinued, and doesn't seem to work on the TM4000.

-- Johan

Quoted 9 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

Quoted 9 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#60 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive

It works really well. :) How did you know how to speak to the LED? I looked at the sources, because I thought I could maybe also get the WLAN and Bluetooth LEDs working, but I really don't know how to do it. That is probably because I really don't have a clue about hardware programming...

Quoted 3 lines

Maybe this article can help you, it's in spanish...

http://www.linuxzamora.org/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=22&page=1

I don't know too much Spanish, but I believe I could understand most of it. That site doesn't really help because it only talks about getting the extra keys working and not the extra LEDs.

Thanks,
Johannes

Quoted 10 lines · Johan Vromans
Quoted 7 lines · Johannes Kuhlmann
Quoted 3 lines · Johan Vromans

.....
PS: I hacked a kernel module to control the email led on this (and maybe other) TravelMate. Will post soon.

Hi,

that would be pretty cool, if you could post it.

Quoted 7 lines

It's on http://www.squirrel.nl/people/jvromans/

Articles -> TravelMate 4000 -> General Hacks

Happy hacking (and take care -- no guarantee).

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): 47e0449d050117114113973694-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#62 lore raw

Re: first shoot for smartbattery

Quoted 1 line · Johannes Kuhlmann

It works really well. :) How did you know how to speak to the LED?

I've studied some other code (like acerhk[1] and acertm[2]) and carefully cut/pasted pieces of code :-).

-- Johan

[1] http://www.informatik.hu-berlin.de/~tauber/acerhk/
[2] http://www.math.columbia.edu/~jensen/linux/acertm/

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#63 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive
Quoted 8 lines · Pedro Venda

another thing: I changed the current drain from "mA or mWh" to "mAh or mW" in smartbattery.c but I'm having some doubts:

Are these energy or power measures?
for power measures, the units would be mA/h or mW for energy measures, the units would be mA or mW.h

so, maybe I changed it wrong... care to comment?

This puzzled me actually. mA is not the same as mW.h, unless you specify a reference voltage and time (but without specifying those it is meaningless). mA is a current (charge per second), mWh is energy.

mA/h is the unit that corresponds to change in the current. mAh has the unit of charge. It could very well be that the SMBus smartbattery specification has some reference values that allow you to convert mA/h to mW and mA to mW.h. But as it stand it really does not make sense to me.

best,
Jeroen

Signature · 8 lines
Kile - an Integrated LaTeX Environment for KDE
http://kile.sourceforge.net


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#64 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive
Quoted 45 lines · Pedro Venda

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

Bruno Ducrot wrote:

| On Mon, Jan 03, 2005 at 05:35:13PM +0000, Pedro Venda wrote:
|
|>-----BEGIN PGP SIGNED MESSAGE-----
|>Hash: SHA1
|>
|>Pedro Venda wrote:
|>| Bruno Ducrot wrote:
|>|
|>| | I think I found was wrong.  Please refetch, or (at your option) 
replace
|>| | i2c-acpi-ec.ec with
|>| |
|>| 
http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
|>| | then redo the sh compile.sh
|>| | Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...
|>|
|>| happens to everyone.
|>|
|>| | Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot 
in
|>| | order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
|>| | bag will still be helpfull also...).
|>
|>ok I made a small patch against your most recent code base:
|
|
| Thanks.
|
|
|>included:
|>- - a Makefile for the i2c-acpi-ec module
|>- - a Makefile for the smartbattery program which also calls the
|>i2c-acpi-ec make
|>process.
|>
|>in the smartbattery directory, one just "make"s and everything gets built.
|
|
| Ok.
Quoted 3 lines

another thing: I changed the current drain from "mA or mWh" to "mAh or mW" in
smartbattery.c but I'm having some doubts:

It's mAh or mWh, depending of the value of CAPACITY_MODE. This is a r/w bit in BatteryMode() word (the 15th). If this bit is clear (default), then it is mAh and this is current in mAh. If this bit is set, this power, exprimed as 10mWh.

I've fixed this issue. Hopefully it should be ok now.

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#66 lore raw

Re: first shoot for smartbattery

Quoted 50 lines · Bruno Ducrot
Quoted 42 lines · Pedro Venda

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

Bruno Ducrot wrote:

| On Mon, Jan 03, 2005 at 05:35:13PM +0000, Pedro Venda wrote:
|
|>-----BEGIN PGP SIGNED MESSAGE-----
|>Hash: SHA1
|>
|>Pedro Venda wrote:
|>| Bruno Ducrot wrote:
|>|
|>| | I think I found was wrong.  Please refetch, or (at your option) replace
|>| | i2c-acpi-ec.ec with
|>| |
|>| http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
|>| | then redo the sh compile.sh
|>| | Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...
|>|
|>| happens to everyone.
|>|
|>| | Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot in
|>| | order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
|>| | bag will still be helpfull also...).
|>
|>ok I made a small patch against your most recent code base:
|
|
| Thanks.
|
|
|>included:
|>- - a Makefile for the i2c-acpi-ec module
|>- - a Makefile for the smartbattery program which also calls the
|>i2c-acpi-ec make
|>process.
|>
|>in the smartbattery directory, one just "make"s and everything gets built.
|
|
| Ok.
Quoted 4 lines

another thing: I changed the current drain from "mA or mWh" to "mAh or mW" in smartbattery.c but I'm having some doubts:

Quoted 10 lines

It's mAh or mWh, depending of the value of CAPACITY_MODE. This is a r/w bit in BatteryMode() word (the 15th). If this bit is clear (default), then it is mAh and this is current in mAh. If this bit is set, this power, exprimed as 10mWh.

I've fixed this issue. Hopefully it should be ok now.

I am afraid it's not ok yet. In fact I get a very strange result: when the AC adapter is unplugged and knowing my battery is fully loaded, if I run repeatedly the command smartbattery 0, the "time to empty value" is sometime increasing, sometime decreasing. I can understand that it decreases but it's strange that it can also increase ! Last
precision: I did this test with the latest available release (after having replaced the smartbattery.c file by a new version that Brunot Ducrot send me this morning to fix compilation errors).

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#68 lore raw

Re: first shoot for smartbattery

Hi,

I'm trying this out on an Acer Travelmate 4001LCi. With the version of today, I get nice results for the battery, though I experienced the same you did. But as fas as I could see this behaviour only takes place, if I run smartbattery repeatedly with a very short delay. If I only run it from time to time, it seems to be decreasing normally. What I also experienced is, that it takes some time (not too long) when plugging in the AC adapter until smartbattery shows the time to be full (and some other information). Immediately I can see three values, but not all that are normally shown. Sorry, I can't remember which and I'm currently at another machine.

Regards,
Johannes

Quoted 9 lines · François Valenduc

I am afraid it's not ok yet. In fact I get a very strange result: when the AC adapter is unplugged and knowing my battery is fully loaded, if I run repeatedly the command smartbattery 0, the "time to empty value" is sometime increasing, sometime decreasing. I can understand that it decreases but it's strange that it can also increase ! Last
precision: I did this test with the latest available release (after having replaced the smartbattery.c file by a new version that Brunot Ducrot send me this morning to fix compilation errors).

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): 47e0449d05010406454e59b16a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#70 lore raw

Re: first shoot for smartbattery

Hia

Quoted 5 lines

I'm trying this out on an Acer Travelmate 4001LCi. With the version of today, I get nice results for the battery, though I experienced the same you did. But as fas as I could see this behaviour only takes place, if I run smartbattery repeatedly with a very short delay. If I only run it from time to time, it seems to be decreasing normally.

I'd say increases are ok. Imagine period of high cpu load (machine takes 50W and thinks "if it goes like that, I can only last 15 minutes"),
then cpu goes idle (25W, "okay, I can survive 30 minutes with load like this").

At this point, available time *should* go up.

Signature · 8 lines
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#71 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive

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

Bruno Ducrot wrote:

| On Mon, Jan 03, 2005 at 07:50:13PM +0000, Pedro Venda wrote:
|
|>-----BEGIN PGP SIGNED MESSAGE-----
|>Hash: SHA1
|>
|>Bruno Ducrot wrote:
|>| On Mon, Jan 03, 2005 at 05:35:13PM +0000, Pedro Venda wrote:
|>|
|>|>-----BEGIN PGP SIGNED MESSAGE-----
|>|>Hash: SHA1
|>|>
|>|>Pedro Venda wrote:
|>|>| Bruno Ducrot wrote:
|>|>|
|>|>| | I think I found was wrong.  Please refetch, or (at your option)
|>replace
|>|>| | i2c-acpi-ec.ec with
|>|>| |
|>|>|
|>http://www.poupinou.org/acpi/smartbatt/smartbatt/i2c-acpi-ec/i2c-acpi-ec.c
|>|>| | then redo the sh compile.sh
|>|>| | Sorry, it was a stupid bug(tm) requiring that I buy a brown bag...
|>|>|
|>|>| happens to everyone.
|>|>|
|>|>| | Something wrong also with rmmod i2c-acpi-ec :( so you have to reboot
|>in
|>|>| | order to be able to 'insmod i2c-acpi-ec.ko' again (I'm sure the brown
|>|>| | bag will still be helpfull also...).
|>|>
|>|>ok I made a small patch against your most recent code base:
|>|
|>|
|>| Thanks.
|>|
|>|
|>|>included:
|>|>- - a Makefile for the i2c-acpi-ec module
|>|>- - a Makefile for the smartbattery program which also calls the
|>|>i2c-acpi-ec make
|>|>process.
|>|>
|>|>in the smartbattery directory, one just "make"s and everything gets built.
|>|
|>|
|>| Ok.
|>
|>another thing: I changed the current drain from "mA or mWh" to "mAh or mW"
|>in
|>smartbattery.c but I'm having some doubts:
|
|
| It's mAh or mWh, depending of the value of CAPACITY_MODE.  This is a r/w
| bit in BatteryMode() word (the 15th).  If this bit is clear (default),
| then it is mAh and this is current in mAh.  If this bit is set, this
| power, exprimed as 10mWh
|
| I've fixed this issue.  Hopefully it should be ok now.
|
|

thanks. I actually read some of the pdf you pointed me to and implemented a couple of functions on the smartbattery.c. It now gets much more information from the battery. If you find it relevant, I'll clean it up a bit and post a patch for you. I know it will soon be dumped, but it may show useful when debugging other driver informations.

Is it safe to change registers? I'd like to get the CAPACITY_MODE changed to 1 but I'm afraid to ruin something. If I write a word into that register with the same values previously read but OR'd with the CAPACITY_MODE bit at 1, will that be ok?

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2rU5eRy7HWZxjWERAr+8AJ9xfxTRsJ9JRaDmc8qdThNf5MgSGACglygv ugUwXI+hQ7pKjrc3TEoM89o=
=WmZa
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#73 lore raw

Re: first shoot for smartbattery

Quoted 5 lines · Pedro Venda

I actually read some of the pdf you pointed me to and implemented a couple of functions on the smartbattery.c. It now gets much more information from the battery. If you find it relevant, I'll clean it up a bit and post a patch for you. I know it will soon be dumped, but it may show useful when debugging other driver informations.

The attached program produces a nice battery status display using your modified version of battstat. It may be temporary, but at least now I have decent battery info at hand.

-- Johan

A message that is not in the archive (sent off-list or not yet received): m2oefyzplr.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#75 lore raw

Re: Re: first shoot for smartbattery

Quoted 7 lines · Johan Vromans
Quoted 5 lines · Pedro Venda

I actually read some of the pdf you pointed me to and implemented a couple of functions on the smartbattery.c. It now gets much more information from the battery. If you find it relevant, I'll clean it up a bit and post a patch for you. I know it will soon be dumped, but it may show useful when debugging other driver informations.

Quoted 5 lines

The attached program produces a nice battery status display using your modified version of battstat. It may be temporary, but at least now I have decent battery info at hand.

-- Johan

First thank to all (especially to Bruno) for moving "smart battery problem ahead)
The module and smartbattery program has compiled at kernels 2.6.10 (vanilia and with the ac8, bk7, bk11 and bk12 patches)
The effect was

sanskryt@kender:/usr/local/download/acpi/smartbattery$ smartbattery 1
status: charging
current:       1957 mA
time to full:  105 minutes
remain:        3020 mAh
charge state:  74%
temperature:   35.8 C
voltage:       16451 mV
So it look great.
Two problems:
First the /dev/i2c-1 node can be read only by root. I think that the battery 
status has to be readably for ordinary user.
Second: I can't execute battstat program.
after installing Tk::ProgressBar from Cpan and linking smartbattery to 
smartbattery2 in /usr/local/bin there are two mistakes:
"Global symbol "$smbus" requires explicit package name at ./battstat.pl line 
70." I change $smbus for "1"
and then
"Use of uninitialized value in concatenation (.) or string at ./battstat.pl 
line 96.
Use of uninitialized value in numeric lt (<) at ./battstat.pl line 77.
Use of uninitialized value in numeric gt (>) at ./battstat.pl line 87.
Use of uninitialized value in numeric lt (<) at ./battstat.pl line 87."

which I don't know what to do with.
The lines after I make some editing and commenting are
70 - "my $res = smartbattery2 $smbus 2>&1;"
77 - "$tp = $current < 0 ? 'empty' : 'full';
87 - "if ( $current > 0 ) { # charging"
96 - "$mw->title("Battery: $time ($status%)");"
May be You can advise how to solve this before the battery can be read form normal /proc/acpi/battery and /proc/acpi/ac-adapter ;-/

Signature · 7 lines
z.a.kaleta (sanskryt), registered Linux User #279350


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#77 lore raw

Re: Re: first shoot for smartbattery

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

Zdzis³aw A. Kaleta wrote:

| Dnia niedziela 09 stycznia 2005 14:41, Johan Vromans napisa³:
|
|>Pedro Venda <[email protected]> writes:
|>
|>>I actually read some of the pdf you pointed me to and implemented a
|>>couple of functions on the smartbattery.c. It now gets much more
|>>information from the battery. If you find it relevant, I'll clean it
|>>up a bit and post a patch for you. I know it will soon be dumped,
|>>but it may show useful when debugging other driver informations.
|>
|>The attached program produces a nice battery status display using your
|>modified version of battstat. It may be temporary, but at least now I
|>have decent battery info at hand.
|>
|>-- Johan
|
| First thank to all (especially to Bruno) for moving "smart battery problem
| ahead)
| The module and smartbattery program has compiled at kernels 2.6.10 (vanilia
| and with the ac8, bk7, bk11 and bk12 patches)
| The effect was
| sanskryt@kender:/usr/local/download/acpi/smartbattery$ smartbattery 1
| status: charging
| current:       1957 mA
| time to full:  105 minutes
| remain:        3020 mAh
| charge state:  74%
| temperature:   35.8 C
| voltage:       16451 mV
| So it look great.
| Two problems:
| First the /dev/i2c-1 node can be read only by root. I think that the battery
| status has to be readably for ordinary user.

the smartbattery program is just a hack to see things working. people shouldn't be using it in "production".

soon there will be an emulation driver that will allow you to use current battery monitoring tools.

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB46abeRy7HWZxjWERAtC7AKCUtdkb4+8LzCZ97VoyRhqgqJYgpQCfWNpd gxA0h0lobTX1tHOJNX9OZmk=
=TyWZ
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#79 lore raw

Re: Re: first shoot for smartbattery

Quoted 8 lines · Pedro Venda

the smartbattery program is just a hack to see things working. people shouldn't be using it in "production".

soon there will be an emulation driver that will allow you to use current battery monitoring tools.

regards,
pedro venda.

Better such wonderfull hack then the situation when my laptop "died" in the middle of important text before I have a chance to save it.

Signature · 7 lines
z.a.kaleta (sanskryt), registered Linux User #279350


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): 200501111149.55615.sanskryt-h7QdYz1kt/[email protected]

#81 lore raw

Re: Re: first shoot for smartbattery

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

z.a.kaleta wrote:

| Dnia wtorek 11 stycznia 2005 11:12, Pedro Venda napisa³:
|
|>the smartbattery program is just a hack to see things working. people
|>shouldn't be using it in "production".
|>
|>soon there will be an emulation driver that will allow you to use current
|>battery monitoring tools.
|>
|>regards,
|>pedro venda.
|
| Better such wonderfull hack then the situation when my laptop "died" in the
| middle of important text before I have a chance to save it.

true, but you knew there were no battery information, so you did it on your own risk.

if you didn't know... these things must be tested before we can rely on them. linux is developed by a community of interested users and developers, so you can't generally complain to anybody and nobody garantees driver implementation for your specific hardware. you had bad luck. my laptop shut itself down on me once, but because I forgot the AC-power was unplugged :-/

fortunately we learn mostly from mistakes, so it won't happen again.

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB47wGeRy7HWZxjWERAokYAJ43jF4KdPsYK+eVM30V3ZZgktgbZgCfR+IK fPnfi5EDyQeKHZMU9jtaorQ=
=LYlJ
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#83 lore raw

Re: Re: first shoot for smartbattery

Quoted 14 lines · Pedro Venda

z.a.kaleta wrote:

| Dnia wtorek 11 stycznia 2005 11:12, Pedro Venda napisa³:
|>the smartbattery program is just a hack to see things working. people
|>shouldn't be using it in "production".
|>
|>soon there will be an emulation driver that will allow you to use current
|>battery monitoring tools.
|>
|>regards,
|>pedro venda.
|
| Better such wonderfull hack then the situation when my laptop "died" in
| the middle of important text before I have a chance to save it.
Quoted 2 lines

true, but you knew there were no battery information, so you did it on your own risk.

Of course as almost always in Linux and hardware problem.

Quoted 6 lines

if you didn't know... these things must be tested before we can rely on them. linux is developed by a community of interested users and developers, so you can't generally complain to anybody and nobody garantees driver implementation for your specific hardware. you had bad luck. my laptop shut itself down on me once, but because I forgot the AC-power was unplugged :-/

I don't plan co complain ewen if my laptop stop to work at all. I use linux (debian) form more than 4 years now. From two years exlusively linux so I know the risk. Se la vie.

Quoted 5 lines

fortunately we learn mostly from mistakes, so it won't happen again.

regards,
pedro venda.

Again thank for your work.

Signature · 7 lines
z.a.kaleta (sanskryt), registered Linux User #279350


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#84 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive
Quoted 7 lines · Johan Vromans
Quoted 5 lines · Pedro Venda

I actually read some of the pdf you pointed me to and implemented a couple of functions on the smartbattery.c. It now gets much more information from the battery. If you find it relevant, I'll clean it up a bit and post a patch for you. I know it will soon be dumped, but it may show useful when debugging other driver informations.

Quoted 5 lines

The attached program produces a nice battery status display using your modified version of battstat. It may be temporary, but at least now I have decent battery info at hand.

-- Johan

First thank to all (especially to Bruno) for moving "smart battery problem ahead)
The module and smartbattery program has compiled at kernels 2.6.10 (vanilia and with the ac8, bk7, bk11 and bk12 patches)
The effect was

sanskryt@kender:/usr/local/download/acpi/smartbattery$ smartbattery 1
status: charging
current:       1957 mA
time to full:  105 minutes
remain:        3020 mAh
charge state:  74%
temperature:   35.8 C
voltage:       16451 mV
So it look great.
Two problems:
First the /dev/i2c-1 node can be read only by root. I think that the battery 
status has to be readably for ordinary user.
Second: I can't execute battstat program.
after installing Tk::ProgressBar from Cpan and linking smartbattery to 
smartbattery2 in /usr/local/bin there are two mistakes:
"Global symbol "$smbus" requires explicit package name at ./battstat.pl line 
70." I change $smbus for "1"
and then
"Use of uninitialized value in concatenation (.) or string at ./battstat.pl 
line 96.
Use of uninitialized value in numeric lt (<) at ./battstat.pl line 77.
Use of uninitialized value in numeric gt (>) at ./battstat.pl line 87.
Use of uninitialized value in numeric lt (<) at ./battstat.pl line 87."

which I don't know what to do with.
The lines after I make some editing and commenting are
70 - "my $res = smartbattery2 $smbus 2>&1;"
77 - "$tp = $current < 0 ? 'empty' : 'full';
87 - "if ( $current > 0 ) { # charging"
96 - "$mw->title("Battery: $time ($status%)");"
May be You can advise how to solve this before the battery can be read form normal /proc/acpi/battery and /proc/acpi/ac-adapter ;-/

Signature · 7 lines
z.a.kaleta (sanskryt), registered Linux User #279350


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#86 lore raw

Re: first shoot for smartbattery

Quoted 4 lines · Zdzisław A. Kaleta

Dnia niedziela 09 stycznia 2005 14:41, Johan Vromans napisał:
Second: I can't execute battstat program.

70 - "my $res = smartbattery2 $smbus 2>&1;"

My mistake. This line should read:

   my $res = `$prog`;

The other undefined errors that you got result from this mistake.

Sorry for the inconvenience.

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): m28y71fi1s.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#88 lore raw

Re: Re: first shoot for smartbattery

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

Johan Vromans wrote:

| "Zdzis³aw A. Kaleta" <[email protected]> writes:
|
|
|>Dnia niedziela 09 stycznia 2005 14:41, Johan Vromans napisa³:
|>Second: I can't execute battstat program.
|
|
|>70 - "my $res = `smartbattery2 $smbus 2>&1`;"

true. I had the same problem.

thanks for the program and fix. I'll have a different version of smartbattery ~ done soon now. It'll have a more friendly output and more information on demand. Also I'll be implementing an ascii charge bar like:
~ [============| ]
0% 65% 100%

or something simillar. If you want, I can write some code to output information in a desired way for your frontend.

This is being developed for fun only (!!) and not for wide usage. It will not in any way replace any of the current used battery interfaces that use /proc/acpi/battery, because that'd be just a waste of time. I hope bruno will finish the driver soon so we could use all that software and not mine.

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB4qKyeRy7HWZxjWERAuquAJ4sl6j7SJ+C7CY0KLAROFyHWYdYUQCgmFlz 5tyN/IpsjuwYNkYsrnb/F4Q=
=vNKR
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#89 lore raw

Re: Re: first shoot for smartbattery

[Quoting Pedro Venda, on January 10 2005, 15:43, in "Re: [ACPI] Re: first"]

Quoted 2 lines

If you want, I can write some code to output information in a desired way for your frontend.

That won't be necessary. Perl is quite good at parsing program output :-).

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#90 lore raw

Re: Re: first shoot for smartbattery

In reply to a message not in the archive

Sorry to insist but still a mistake and I am not a coder ;-( "Use of uninitialized value in concatenation (.) or string at ./battstat.pl line 95."

Line 95 is "$mw->title("Battery: $time ($status%)");"

and there is no info in the windows
screenshot atached

Signature · 1 line
z.a.kaleta (sanskryt), registered Linux User #279350

A message that is not in the archive (sent off-list or not yet received): [email protected]

#92 lore raw

Re: first shoot for smartbattery

Quoted 7 lines · Zdzisław A. Kaleta

Sorry to insist but still a mistake and I am not a coder ;-( "Use of uninitialized value in concatenation (.) or string at ./battstat.pl line 95."

Line 95 is "$mw->title("Battery: $time ($status%)");"

and there is no info in the windows

1. Would it be possible that you are running the 'original' smartbattery application, and not Pedro's enhanced version? This is the expected output of smartbattery2:

----snip----
status: fully charged discharging initialized
mode: capacity in 10 mW/mWh
design voltage: 14800 mV
design charge capacity: 4400 mAh or mWh
absolute charge: 93%
full charge capacity: 4270 mAh or mWh
relative charge: 96%
current: -1171 mA
voltage: 16360 mV
remain: 4081 mA
average time to empty: 253 minutes
average time to full: 65535 minutes
temperature: 26.5 C
cycle count: 13
----snip----

2. You seem to be using SMbus #1, so did you change the line

    my $prog = "smartbattery2 0";
to
    my $prog = "smartbattery2 1";

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): m27jmlf57y.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#94 lore raw

Re: Re: first shoot for smartbattery

Quoted 11 lines · Johan Vromans
Quoted 7 lines · Zdzisław A. Kaleta

Sorry to insist but still a mistake and I am not a coder ;-( "Use of uninitialized value in concatenation (.) or string at ./battstat.pl line 95."

Line 95 is "$mw->title("Battery: $time ($status%)");"

and there is no info in the windows

1. Would it be possible that you are running the 'original' smartbattery application, and not Pedro's enhanced version? [cut]

Probably You are right. I use smartbattery package from
http://www.poupinou.org/acpi/smartbatt/smartbatt/ from Bruno Duclrot site. When I try to use a patch from Pedro Venda e-mail from 03/01/2005 I has a smartbattery.c.rej with:

sanskryt@kender:/usr/local/src/modules/smartbatt$ cat smartbattery.c.rej
"***************
*** 300,307 ****
        time_to_empty = i2c_smbus_read_word_data(file, 0x11);
        time_to_full = i2c_smbus_read_word_data(file, 0x11);
-       printf("current:       %d mA\n", current & 0xffff);
-       printf("remain:        %d mA or mWh\n", remain & 0xffff);
        printf("time to empty: %d minutes\n", time_to_empty & 0xffff);
        printf("time to full:  %d minutes\n", time_to_full & 0xffff);
        printf("temperature:   %2.1f C\n", ((temp & 0xffff) - 2730) / 10.);
--- 300,307 ----
        time_to_empty = i2c_smbus_read_word_data(file, 0x11);
        time_to_full = i2c_smbus_read_word_data(file, 0x11);
+       printf("current:       %d mA\n", (current & 0xffff));
+       printf("remain:        %d mAh or mW\n", remain & 0xffff);
        printf("time to empty: %d minutes\n", time_to_empty & 0xffff);
        printf("time to full:  %d minutes\n", time_to_full & 0xffff);
        printf("temperature:   %2.1f C\n", ((temp & 0xffff) - 2730) / 10.);"

So it look like that I realy have the not proper smartbattery.c version. Where I can find proper one?

Quoted 6 lines

2. You seem to be using SMbus #1, so did you change the line

    my $prog = "smartbattery2 0";
to
    my $prog = "smartbattery2 1";

Yes I have noticed it and change acordingly

Quoted 2 lines

-- Johan

Signature · 7 lines
z.a.kaleta (sanskryt), registered Linux User #279350


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#96 lore raw

Re: first shoot for smartbattery

Quoted 2 lines · Zdzisław A. Kaleta

So it look like that I realy have the not proper smartbattery.c version. Where I can find proper one?

Maybe Pedro Venda <[email protected]> (the author) is willing to post an updated version?

-- Johan

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): m2sm58mhzg.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/[email protected]

#98 lore raw

Re: Re: first shoot for smartbattery

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

Johan Vromans wrote:

| "Zdzis³aw A. Kaleta" <[email protected]> writes:
|
|
|>So it look like that I realy have the not proper smartbattery.c
|>version. Where I can find proper one?
|
|
| Maybe Pedro Venda <[email protected]> (the author) is
| willing to post an updated version?

well, the working version for your program is still the one you're using. I'm building another and it's nearly done, but when it is, you'll have to rework your script.

sneak preview:

archon smartbatt-head # ./smartbattery 5
charger state: discharging
~ estimated time to empty: 47 minutes
battery state: [==========| ] 28%
archon smartbatt-head #

don't worry, I'll put a command line switch to make it show verbose information.

the smartbattery.c I've previously written (changed) follows attached.

regards,
pedro venda.
- --

Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB46YJeRy7HWZxjWERAmxpAKCkLduuHRrmbI2XHt7uhmMfg/BDyQCdF01k 8q85Ceyuy/YzLn1cSVEoWQ8=
=F8zL
-----END PGP SIGNATURE-----

/*
smartbatt.c - a user-space program for debugging smartbattery support

(C) 2004 Bruno Ducrot, licence same as i2cdump.c since this stuff was shamelessly stolen from:

i2cdump.c - a user-space program to dump I2C registers
Copyright (C) 2002-2003 Frodo Looijaard <[email protected]>, and
Mark D. Studebaker <mdsxyz123-/[email protected]>
Copyright (C) 2004 The lm_sensors group

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <dirent.h>
#include <fcntl.h>
#include <errno.h>

#include <i2c-dev.h>

/*
this just prints out the installed i2c busses in a consistent format, whether on a 2.4 kernel using /proc or a 2.6 kernel using /sys.
If procfmt == 1, print out exactly /proc/bus/i2c format on stdout. This allows this to be used in a program to emulate /proc/bus/i2c on a sysfs system.
*/
void print_i2c_busses(int procfmt)

{
	FILE *fptr;
	char s[100];
	struct dirent *de, *dde;
	DIR *dir, *ddir;
	FILE *f;
	char *border;
	char dev[NAME_MAX], fstype[NAME_MAX], sysfs[NAME_MAX], n[NAME_MAX];
	int foundsysfs = 0;
	int tmp;
	int count=0;


	/* look in /proc/bus/i2c */
	if((fptr = fopen("/proc/bus/i2c", "r"))) {
		while(fgets(s, 100, fptr)) {
			if(count++ == 0 && !procfmt)
				fprintf(stderr,"  Installed I2C busses:\n");
			if(procfmt)
				printf("%s", s);	
			else
				fprintf(stderr, "    %s", s);	
		}
		fclose(fptr);
		goto done;
	}

	/* look in sysfs */
	/* First figure out where sysfs was mounted */
	if ((f = fopen("/proc/mounts", "r")) == NULL) {
		goto done;
	}
	while (fgets(n, NAME_MAX, f)) {
		sscanf(n, "%[^ ] %[^ ] %[^ ] %*s\n", dev, sysfs, fstype);
		if (strcasecmp(fstype, "sysfs") == 0) {
			foundsysfs++;
			break;
		}
	}
	fclose(f);
	if (! foundsysfs) {
		goto done;
	}

	/* Bus numbers in i2c-adapter don't necessarily match those in
	   i2c-dev and what we really care about are the i2c-dev numbers.
	   Unfortunately the names are harder to get in i2c-dev */
	strcat(sysfs, "/class/i2c-dev");
	if(!(dir = opendir(sysfs)))
		goto done;
	/* go through the busses */
	while ((de = readdir(dir)) != NULL) {
		if (!strcmp(de->d_name, "."))
			continue;
		if (!strcmp(de->d_name, ".."))
			continue;

		/* this should work for kernels 2.6.5 or higher and */
		/* is preferred because is unambiguous */
		sprintf(n, "%s/%s/name", sysfs, de->d_name);
		f = fopen(n, "r");
		/* this seems to work for ISA */
		if(f == NULL) {
			sprintf(n, "%s/%s/device/name", sysfs, de->d_name);
			f = fopen(n, "r");
		}
		/* non-ISA is much harder */
		/* and this won't find the correct bus name if a driver
		   has more than one bus */
		if(f == NULL) {
			sprintf(n, "%s/%s/device", sysfs, de->d_name);
			if(!(ddir = opendir(n)))
				continue;       	
			while ((dde = readdir(ddir)) != NULL) {
				if (!strcmp(dde->d_name, "."))
					continue;
				if (!strcmp(dde->d_name, ".."))
					continue;
				if ((!strncmp(dde->d_name, "i2c-", 4))) {
					sprintf(n, "%s/%s/device/%s/name",
					        sysfs, de->d_name, dde->d_name);
					if((f = fopen(n, "r")))
						goto found;
				}
			}
		}

found:

		if (f != NULL) {
			char	x[120];

			fgets(x, 120, f);
			fclose(f);
			if((border = index(x, '\n')) != NULL)
				*border = 0;
			if(count++ == 0 && !procfmt)
				fprintf(stderr,"  Installed I2C busses:\n");
			/* match 2.4 /proc/bus/i2c format as closely as possible */
			if(!strncmp(x, "ISA ", 4)) {
				if(procfmt)
					printf("%s\t%-10s\t%-32s\t%s\n", de->d_name,
					        "dummy", x, "ISA bus algorithm");
				else
					fprintf(stderr, "    %s\t%-10s\t%-32s\t%s\n", de->d_name,
					        "dummy", x, "ISA bus algorithm");
			} else if(!sscanf(de->d_name, "i2c-%d", &tmp)) {
				if(procfmt)
					printf("%s\t%-10s\t%-32s\t%s\n", de->d_name,
					        "dummy", x, "Dummy bus algorithm");
				else
					fprintf(stderr, "    %s\t%-10s\t%-32s\t%s\n", de->d_name,
					        "dummy", x, "Dummy bus algorithm");
			} else {
				if(procfmt)
					printf("%s\t%-10s\t%-32s\t%s\n", de->d_name,
					        "unknown", x, "Algorithm unavailable");
				else
					fprintf(stderr, "    %s\t%-10s\t%-32s\t%s\n", de->d_name,
					        "unknown", x, "Algorithm unavailable");
			}
		}
	}
	closedir(dir);

done:

	if(count == 0 && !procfmt)
		fprintf(stderr,"Error: No I2C busses found!\n"
		               "Be sure you have done 'modprobe i2c-dev'\n"
		               "and also modprobed your i2c bus drivers\n");
}

int open_i2c_dev(const int i2cbus, char *filename)

{
	int file;

	sprintf(filename, "/dev/i2c/%d", i2cbus);
	file = open(filename, O_RDWR);

	if (file < 0 && errno == ENOENT) {
		sprintf(filename, "/dev/i2c-%d", i2cbus);
		file = open(filename, O_RDWR);
	}

	if (file < 0) {
		if (errno == ENOENT) {
			fprintf(stderr, "Error: Could not open file "
			        "`/dev/i2c-%d' or `/dev/i2c/%d': %s\n",
			        i2cbus, i2cbus, strerror(ENOENT));
		} else {
			fprintf(stderr, "Error: Could not open file "
			        "`%s': %s\n", filename, strerror(errno));
			if (errno == EACCES)
				fprintf(stderr, "Run as root?\n");
		}
	}
	
	return file;
}

/*
We don't use this #define but it was put into i2c.h at the same time as i2c_smbus_read_i2c_block_data() was implemented (i2c 2.6.3), so we use it as a version check.
*/
#ifdef I2C_FUNC_SMBUS_READ_I2C_BLOCK_2
#define USE_I2C_BLOCK 1
#else
#define USE_I2C_BLOCK 0
#endif

#ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC
#define HAVE_PEC 1
#endif

void help(void)

{
	fprintf(stderr, "Syntax: smartbatt I2CBUS\n");
	print_i2c_busses(0);
}

int main(int argc, char *argv[])

{
	char *end;
	int i2cbus, address, file;
	int temp, voltage, current;
	int avg_current, avg_time_to_full, avg_time_to_empty;
	int rel_state_charge , full_charge_cap , design_charge_cap , abs_state_charge;
	int remain;
	int cycle_count;
	int design_voltage;
	int battery_status;
	int battery_mode;

	char filename[20];
	long funcs;

	if (argc < 2) {
		fprintf(stderr, "Error: No i2c-bus specified!\n");
		help();
		exit(1);
	}
	i2cbus = strtol(argv[1], &end, 0);
	if (*end) {
		fprintf(stderr, "Error: First argument not a number!\n");
		help();
		exit(1);
	}
	if (i2cbus < 0 || i2cbus > 0xff) {
		fprintf(stderr, "Error: I2CBUS argument out of range!\n");
		help();
		exit(1);
	}

	if (argc >= 3) {
		address = strtol(argv[2], &end, 0);
	} else
		address = 0xb;

	if (address < 0 || address > 0x7f) {
		fprintf(stderr, "Error: Address out of range!\n");
		help();
		exit(1);
	}


	file = open_i2c_dev(i2cbus, filename);
	if (file < 0) {
		exit(1);
	}

	/* check adapter functionality */
	if (ioctl(file, I2C_FUNCS, &funcs) < 0) {
		fprintf(stderr, "Error: Could not get the adapter "
		        "functionality matrix: %s\n", strerror(errno));
		exit(1);
	}

	if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) {
		fprintf(stderr, "Error: Adapter for i2c bus "
			"%d does not have word read "
			"capability\n", i2cbus);
		exit(1);
	}


	/* use FORCE so that we can look at registers even when
	   a driver is also running */
	if (ioctl(file, I2C_SLAVE_FORCE, address) < 0) {
		fprintf(stderr, "Error: Could not set address to %d: %s\n",
		        address, strerror(errno));
		exit(1);
	}

	/* BatteryMode() */
	battery_mode = i2c_smbus_read_word_data(file,0x3);
	/* Temperature() */
	temp = i2c_smbus_read_word_data(file, 0x8);
	/* Voltage() */
	voltage = i2c_smbus_read_word_data(file, 0x9);
	/* Current() */
	current = i2c_smbus_read_word_data(file, 0xa);
	/* AvgCurrent() */
	avg_current = i2c_smbus_read_word_data(file,0xb);
	/* RelativeStateOfCharge() */
	rel_state_charge = i2c_smbus_read_word_data(file,0xd);
	/* AbsoluteStateOfCharge() */
	abs_state_charge = i2c_smbus_read_word_data(file,0xe);
	/* RemainingCapacity() */
	remain = i2c_smbus_read_word_data(file, 0xf);
	/* FullChargeCapacity() */
	full_charge_cap = i2c_smbus_read_word_data(file,0x10);
	/* AverageTimeToEmpty() */
	avg_time_to_empty = i2c_smbus_read_word_data(file, 0x12);
	/* AverageTimeToFull() */
	avg_time_to_full = i2c_smbus_read_word_data(file, 0x13);
	/* BatteryStatus() */
	battery_status = i2c_smbus_read_word_data(file, 0x16);
	/* CycleCount() */
	cycle_count = i2c_smbus_read_word_data(file,0x17);
	/* DesignChargeCapacity() */
	design_charge_cap = i2c_smbus_read_word_data(file,0x18);
	/* DesignVoltage() */
	design_voltage = i2c_smbus_read_word_data(file,0x19);

	/* if current is negative, we need to make the 2' complement
	 * to show the correct decimal value */
	current=current & 0xffff;
	if(current & 0x8000) {
		current=((current^0xffff)+0x0001);
		current*=(-1);
	}
	
	printf("status:\t\t");
	if(battery_status & 0x0010)
		printf("\tfully discharged");
	if(battery_status & 0x0020)
		printf("\tfully charged");
	if(battery_status & 0x0040)
		printf("\tdischarging");
	if(battery_status & 0x0080)
		printf("\tinitialized");
	printf("\n");

	printf("mode:\t\t");
	if(battery_mode & 0x0080)
		printf("\tcondition_flag");
	if(! battery_mode & 0x8000) {
		printf("\tcapacity in mA/mAh");
	} else {
		printf("\tcapacity in 10 mW/mWh");
	}
	printf("\n");

	printf("design voltage:\t\t%d mV\n",design_voltage & 0xffff);
	printf("design charge capacity:\t%d mAh or mWh\n",design_charge_cap & 0xffff);
	printf("absolute charge:\t%d%\n",abs_state_charge & 0xffff);
	printf("full charge capacity:\t%d mAh or mWh\n",full_charge_cap & 0xffff);
	printf("relative charge:\t%d%\n",rel_state_charge & 0xffff);

	
	printf("current:\t\t%d mA\n", current);
	printf("voltage:\t\t%d mV\n", voltage & 0xffff);

	printf("remain:\t\t\t%d mA\n", remain & 0xffff);
	printf("average time to empty:\t%d minutes\n", avg_time_to_empty & 0xffff);
	printf("average time to full:\t%d minutes\n", avg_time_to_full & 0xffff);
	printf("temperature:\t\t%2.1f C\n", ((temp & 0xffff) - 2730) / 10.);
	printf("cycle count:\t\t%d\n",cycle_count & 0xffff);
	
	return 0;
}
#99 lore raw

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

In reply to a message not in the archive
Quoted 8 lines · Mathias Weyland
Quoted 4 lines

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).

Ok, here's what's happening:

Quoted 15 lines
corcovado:/usr/src/smartbatt# ./smartbattery
Error: No i2c-bus specified!
Syntax: smartbatt I2CBUS
  Installed I2C busses:
    i2c-1       unknown         ACPI EC SMBus adapter at 0018
Algorithm unavailable
    i2c-0       unknown         SMBus I801 adapter at 1880
Algorithm unavailable
corcovado:/usr/src/smartbatt# ./smartbattery  1
current:       65535 mA
remain:        65535 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   6280.5 C
voltage:       65535 mV

same here.

Quoted 18 lines

The values are wrong, but I guess you helped me a lot. I'll dive into the code this afternoon and I'll try to nail down the problem. As for now, what I can tell you is that the base address has been detected correctly. From my dsdt.asl:

                    Device (SMBC)
                    {
                        Name (_HID, "ACPI0001")
                        Name (_EC, 0x1820)
                        Device (SBS0)
                        {
                            Name (_HID, "ACPI0002")
                            Name (_SBS, 0x01)
                        }
                    }
Quoted 5 lines

Loading the module shows:

i2c_acpi_ec: disagrees about version of symbol struct_module
base: 0x18 alert: 0x20
i2c-acpi-ec.c: ACPI EC SMBus adapter at 0x18

same here.

Quoted 20 lines

So at least that is working.

But something puzzeled me a bit:

corcovado:/home/lea# i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          XX XX XX XX XX XX XX XX XX XX XX XX XX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
70: XX XX XX XX XX XX XX XX
Quoted 1 line

At least the output differs from what Pedro (IIRC) got in October.

same here. now I get the same as you.

Quoted 2 lines

Regards & thank you very much for the effort!

indeed! thanks for the very helpful work with the driver.

regards,
pedro venda.

Signature · 9 lines
Pedro João Lopes Venda
email: [email protected]
http://arrakis.dhis.org


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#100 lore raw

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

In reply to a message not in the archive

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

Hi.
have tried the driver on my Travelmate 4002 which has also the smartbattery.

Here what's happening.

root@trilian smartbatt # ./smartbattery
Error: No i2c-bus specified!
Syntax: smartbatt I2CBUS
~ Installed I2C busses:
~ i2c-4 unknown ACPI EC SMBus adapter at 0018
Algorithm unavailable
~ i2c-3 unknown crt2
Algorithm unavailable
~ i2c-2 unknown vga
Algorithm unavailable
~ i2c-1 unknown dvi
Algorithm unavailable
~ i2c-0 unknown monid
Algorithm unavailable

root@trilian smartbatt # ./smartbattery 4

current:       65535 mA
remain:        65535 mA or mWh
time to empty: 65535 minutes
time to full:  65535 minutes
temperature:   6280.5 C
voltage:       65535 mV

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFB1pkGgL2kQgmW9pgRAgs8AKDEDlT1vtVHiC+XSGv8Fu5bwHG2GwCfSIbv AotXyJR5Rn2NGXf8yGr+Prc=
=K+fO
-----END PGP SIGNATURE-----

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#101 lore raw

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

In reply to a message not in the archive

Do you think your driver can be used to reset battery pack state?

I replaced the cells in my Toshiba battery pack, but the "last full capacity" is still stuck at the value from the old cells, and the "remaining capacity" seems to get clamped to this low value. I heard that it might be possible to reset this using i2c.

Regards,
-John

Quoted 8 lines · Bruno Ducrot
Quoted 1 line · Bruno Ducrot

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.

Quoted 8 lines

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!

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#103 lore raw

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

Quoted 7 lines · John Belmonte

Do you think your driver can be used to reset battery pack state?

I replaced the cells in my Toshiba battery pack, but the "last full capacity" is still stuck at the value from the old cells, and the "remaining capacity" seems to get clamped to this low value. I heard that it might be possible to reset this using i2c.

This driver implement the ACPI smbus host controller interface via the embedded controller as defined in ACPI 2.0c, 13.9. If you don't have that, it won't work. AFAIK, there is no such smbus HC in any toshiba with a toshiba bios. But there is an 'hidden' one in the toshiba satellite 3000-100, but for other models, I can't say for sure.

It might be possible that there is a smbus bios in your model. For checking if this is the case, could you please try the detection code at
http://www.poupinou.org/acpi/smartbatt/smbusbios.tar.gz

Of course, it will be fine if you send me the acpidmp.out.bz2 for your model...

Cheers,

Signature · 10 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
#104 lore raw

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

In reply to a message not in the archive
Quoted 8 lines · Bruno Ducrot
Quoted 1 line · Bruno Ducrot

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.

Quoted 9 lines

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 SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#106 lore raw

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

-----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: [email protected]
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-----

Files smartbatt-original/smartbattery and smartbatt/smartbattery differ

smartbattery.c +7 -0
diff -urN smartbatt-original/smartbattery.c smartbatt/smartbattery.c
@@ -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);

A message that is not in the archive (sent off-list or not yet received): [email protected]

#108 lore raw

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

Quoted 2 lines · Pedro Venda

the battery can return that too. use this patch.

oh thx :)

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

#109 lore raw

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

In reply to a message not in the archive
Quoted 4 lines · Pedro Venda

the battery can return that too. use this patch.

regards,
pedro venda.

i get 99% also when it's full, never 100%

ultra@doom:~/acpi/smartbatt $ sudo ./smartbattery 1

remain:        4108 mAh
charge state:  99%
temperature:   23.2 C
voltage:       16789 mV

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt