public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: i2c-acpi-ec.c
       [not found] ` <20041231092156.GA612-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
@ 2004-12-31 14:19   ` Pedro Venda
       [not found]     ` <41D56002.5060008-aHmAgkVUFT6Joy8PIJZ9VA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2004-12-31 14:19 UTC (permalink / raw)
  To: Mathias Weyland; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Mathias Weyland wrote:
> Hi

hello,

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

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

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

Pedro João Lopes Venda
email: pjlv-aHmAgkVUFT6Joy8PIJZ9VA@public.gmane.org
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: i2c-acpi-ec.c
       [not found]     ` <41D56002.5060008-aHmAgkVUFT6Joy8PIJZ9VA@public.gmane.org>
@ 2004-12-31 15:07       ` Bruno Ducrot
       [not found]         ` <20041231150724.GK19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2004-12-31 15:07 UTC (permalink / raw)
  To: Pedro Venda; +Cc: Mathias Weyland, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, Dec 31, 2004 at 02:19:46PM +0000, Pedro Venda wrote:
> Mathias Weyland wrote:
> >Hi
> 
> hello,
> 
> >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.
> 
> >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 :-)
> 
> >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.

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

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]         ` <20041231150724.GK19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2004-12-31 18:16           ` Bruno Ducrot
       [not found]             ` <20041231181628.GL19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2004-12-31 18:16 UTC (permalink / raw)
  To: Pedro Venda, Mathias Weyland; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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!

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]             ` <20041231181628.GL19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2004-12-31 18:48               ` François Valenduc
       [not found]                 ` <41D59F15.2030504-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
  2005-01-01  8:26               ` Mathias Weyland
                                 ` (3 subsequent siblings)
  4 siblings, 1 reply; 64+ messages in thread
From: François Valenduc @ 2004-12-31 18:48 UTC (permalink / raw)
  To: Bruno Ducrot
  Cc: Pedro Venda, Mathias Weyland,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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 !

Bruno Ducrot a écrit :

>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!
>
>  
>



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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]                 ` <41D59F15.2030504-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
@ 2004-12-31 19:09                   ` Bruno Ducrot
  0 siblings, 0 replies; 64+ messages in thread
From: Bruno Ducrot @ 2004-12-31 19:09 UTC (permalink / raw)
  To: François Valenduc
  Cc: Pedro Venda, Mathias Weyland,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, Dec 31, 2004 at 07:48:53PM +0100, François Valenduc wrote:
> 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)

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,

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]             ` <20041231181628.GL19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  2004-12-31 18:48               ` François Valenduc
@ 2005-01-01  8:26               ` Mathias Weyland
       [not found]                 ` <20050101082605.GA24896-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
  2005-01-01 12:35               ` Hendrik Jürgens
                                 ` (2 subsequent siblings)
  4 siblings, 1 reply; 64+ messages in thread
From: Mathias Weyland @ 2005-01-01  8:26 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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.

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


> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                 ` <20050101082605.GA24896-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
@ 2005-01-01 10:08                   ` Johan Vromans
       [not found]                     ` <m2acrth375.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  2005-01-01 17:05                   ` first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c) Pedro Venda
  1 sibling, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-01 10:08 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Happy New Year to y'all!

Mathias Weyland <mweyland-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org> writes:

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

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

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

> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]             ` <20041231181628.GL19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  2004-12-31 18:48               ` François Valenduc
  2005-01-01  8:26               ` Mathias Weyland
@ 2005-01-01 12:35               ` Hendrik Jürgens
  2005-01-01 19:21               ` John Belmonte
  2005-01-09  3:08               ` ultrakorne
  4 siblings, 0 replies; 64+ messages in thread
From: Hendrik Jürgens @ 2005-01-01 12:35 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]                 ` <20050101082605.GA24896-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
  2005-01-01 10:08                   ` first shoot for smartbattery Johan Vromans
@ 2005-01-01 17:05                   ` Pedro Venda
  1 sibling, 0 replies; 64+ messages in thread
From: Pedro Venda @ 2005-01-01 17:05 UTC (permalink / raw)
  To: Mathias Weyland; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Bruno Ducrot

Mathias Weyland wrote:

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

same here.

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

same here.

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

same here. now I get the same as you.

> 
> Regards & thank you very much for the effort!

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


regards,
pedro venda.
-- 

Pedro João Lopes Venda
email: pjlv-aHmAgkVUFT6Joy8PIJZ9VA@public.gmane.org
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]             ` <20041231181628.GL19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
                                 ` (2 preceding siblings ...)
  2005-01-01 12:35               ` Hendrik Jürgens
@ 2005-01-01 19:21               ` John Belmonte
       [not found]                 ` <41D6F826.8090906-wanGne27zNesTnJN9+BGXg@public.gmane.org>
  2005-01-09  3:08               ` ultrakorne
  4 siblings, 1 reply; 64+ messages in thread
From: John Belmonte @ 2005-01-01 19:21 UTC (permalink / raw)
  To: Bruno Ducrot; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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


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!


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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                     ` <m2acrth375.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-01 22:33                       ` François Valenduc
  2005-01-03 13:45                       ` Bruno Ducrot
  2005-01-03 14:39                       ` Bruno Ducrot
  2 siblings, 0 replies; 64+ messages in thread
From: François Valenduc @ 2005-01-01 22:33 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Johan Vromans a écrit :

> Happy New Year to y'all!
>
> Mathias Weyland <mweyland-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org> writes:
>
>> 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.
>
>> 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.
>
>> 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.
>
>> 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
>
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]                 ` <41D6F826.8090906-wanGne27zNesTnJN9+BGXg@public.gmane.org>
@ 2005-01-03 13:13                   ` Bruno Ducrot
  0 siblings, 0 replies; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-03 13:13 UTC (permalink / raw)
  To: John Belmonte; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Sat, Jan 01, 2005 at 02:21:10PM -0500, John Belmonte wrote:
> 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,

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                     ` <m2acrth375.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  2005-01-01 22:33                       ` François Valenduc
@ 2005-01-03 13:45                       ` Bruno Ducrot
  2005-01-03 14:39                       ` Bruno Ducrot
  2 siblings, 0 replies; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-03 13:45 UTC (permalink / raw)
  To: Johan Vromans; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Sat, Jan 01, 2005 at 11:08:14AM +0100, Johan Vromans wrote:
> Happy New Year to y'all!
> 
> Mathias Weyland <mweyland-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org> writes:
> 
> > 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.
> 
> > 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.
> 

Could you post those errors?

Thanks,

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                     ` <m2acrth375.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  2005-01-01 22:33                       ` François Valenduc
  2005-01-03 13:45                       ` Bruno Ducrot
@ 2005-01-03 14:39                       ` Bruno Ducrot
       [not found]                         ` <20050103143902.GQ19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  2 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-03 14:39 UTC (permalink / raw)
  To: Johan Vromans; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Sat, Jan 01, 2005 at 11:08:14AM +0100, Johan Vromans wrote:
> Happy New Year to y'all!
> 
> Mathias Weyland <mweyland-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org> 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,

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                         ` <20050103143902.GQ19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2005-01-03 14:55                           ` Mathias Weyland
       [not found]                             ` <41D95CDC.8050802-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
  2005-01-03 17:03                           ` Pedro Venda
  1 sibling, 1 reply; 64+ messages in thread
From: Mathias Weyland @ 2005-01-03 14:55 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

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.


> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                             ` <41D95CDC.8050802-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
@ 2005-01-03 15:05                               ` François Valenduc
       [not found]                                 ` <41D95F53.5000008-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
  2005-01-03 15:08                               ` Bruno Ducrot
  1 sibling, 1 reply; 64+ messages in thread
From: François Valenduc @ 2005-01-03 15:05 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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
   

Mathias Weyland a écrit :

> 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...
>
>
> 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.
>
>
>> 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
> _______________________________________________
> Acpi-devel mailing list
> Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                             ` <41D95CDC.8050802-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
  2005-01-03 15:05                               ` François Valenduc
@ 2005-01-03 15:08                               ` Bruno Ducrot
  1 sibling, 0 replies; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-03 15:08 UTC (permalink / raw)
  To: Mathias Weyland; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, Jan 03, 2005 at 03:55:24PM +0100, Mathias Weyland 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...
> 
> 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.

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                 ` <41D95F53.5000008-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
@ 2005-01-03 15:41                                   ` François Valenduc
       [not found]                                     ` <41D967B5.7040002-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: François Valenduc @ 2005-01-03 15:41 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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.

François Valenduc a écrit :

> 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
>  
> Mathias Weyland a écrit :
>
>> 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...
>>
>>
>>
>> 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.
>>
>>
>>> 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
>> _______________________________________________
>> Acpi-devel mailing list
>> Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> 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
> _______________________________________________
> Acpi-devel mailing list
> Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                     ` <41D967B5.7040002-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
@ 2005-01-03 17:02                                       ` liste-9nAOAgdJVo4b1SvskN2V4Q
       [not found]                                         ` <Pine.LNX.4.60.0501031751590.5329-KnfdeQs3A3X/9pzu0YdTqQ@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: liste-9nAOAgdJVo4b1SvskN2V4Q @ 2005-01-03 17:02 UTC (permalink / raw)
  To: François Valenduc; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1889 bytes --]

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

Salut François,
On Mon, 3 Jan 2005, François Valenduc wrote:
> ...
> 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
> 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 <hgfelger-9nAOAgdJVo4b1SvskN2V4Q@public.gmane.org>
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-----

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                         ` <20050103143902.GQ19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  2005-01-03 14:55                           ` Mathias Weyland
@ 2005-01-03 17:03                           ` Pedro Venda
       [not found]                             ` <41D97AF3.7000409-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  1 sibling, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-03 17:03 UTC (permalink / raw)
  To: Bruno Ducrot; +Cc: Johan Vromans, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

-----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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                             ` <41D97AF3.7000409-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-03 17:34                               ` Bruno Ducrot
  2005-01-03 17:35                               ` Pedro Venda
  1 sibling, 0 replies; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-03 17:34 UTC (permalink / raw)
  To: Pedro Venda; +Cc: Johan Vromans, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, Jan 03, 2005 at 05:03:47PM +0000, 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...).
> 
> 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.
> 

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

Cheers,

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                             ` <41D97AF3.7000409-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  2005-01-03 17:34                               ` Bruno Ducrot
@ 2005-01-03 17:35                               ` Pedro Venda
       [not found]                                 ` <41D98251.9020002-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  1 sibling, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-03 17:35 UTC (permalink / raw)
  To: Pedro Venda
  Cc: Bruno Ducrot, Johan Vromans,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

-----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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

[-- Attachment #2: smartbatt.patch --]
[-- Type: text/plain, Size: 1905 bytes --]

diff -rNu smartbatt/Makefile smartbatt-2/Makefile
--- smartbatt/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ smartbatt-2/Makefile	2005-01-03 17:25:49.346995193 +0000
@@ -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
diff -rNu smartbatt/i2c-acpi-ec/Makefile smartbatt-2/i2c-acpi-ec/Makefile
--- smartbatt/i2c-acpi-ec/Makefile	2004-12-31 17:11:54.000000000 +0000
+++ smartbatt-2/i2c-acpi-ec/Makefile	2005-01-03 17:23:26.409880044 +0000
@@ -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
diff -rNu smartbatt/smartbattery.c smartbatt-2/smartbattery.c
--- smartbatt/smartbattery.c	2004-12-31 19:03:36.000000000 +0000
+++ smartbatt-2/smartbattery.c	2005-01-03 17:21:35.825490452 +0000
@@ -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.);

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                         ` <Pine.LNX.4.60.0501031751590.5329-KnfdeQs3A3X/9pzu0YdTqQ@public.gmane.org>
@ 2005-01-03 17:54                                           ` Bruno Ducrot
       [not found]                                             ` <20050103175449.GW19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-03 17:54 UTC (permalink / raw)
  To: hgfelger-9nAOAgdJVo4b1SvskN2V4Q
  Cc: François Valenduc,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, Jan 03, 2005 at 06:02:59PM +0100, liste-9nAOAgdJVo4b1SvskN2V4Q@public.gmane.org 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.  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.

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                 ` <41D98251.9020002-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-03 18:02                                   ` Bruno Ducrot
       [not found]                                     ` <20050103180219.GX19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-03 18:02 UTC (permalink / raw)
  To: Pedro Venda; +Cc: Johan Vromans, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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.

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


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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                     ` <20050103180219.GX19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2005-01-03 19:50                                       ` Pedro Venda
       [not found]                                         ` <41D9A1F5.1060508-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-03 19:50 UTC (permalink / raw)
  To: Bruno Ducrot; +Cc: Johan Vromans, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

-----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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                         ` <41D9A1F5.1060508-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-03 20:30                                           ` Johan Vromans
       [not found]                                             ` <m2mzvq5k7u.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  2005-01-04  7:47                                           ` Jeroen Wijnhout
  2005-01-04 10:08                                           ` Bruno Ducrot
  2 siblings, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-03 20:30 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                             ` <20050103175449.GW19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2005-01-04  1:56                                               ` Pedro Venda
       [not found]                                                 ` <41D9F7CA.7030408-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-04  1:56 UTC (permalink / raw)
  To: Bruno Ducrot; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

Bruno Ducrot wrote:
| On Mon, Jan 03, 2005 at 06:02:59PM +0100, liste-9nAOAgdJVo4b1SvskN2V4Q@public.gmane.org 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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                         ` <41D9A1F5.1060508-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  2005-01-03 20:30                                           ` Johan Vromans
@ 2005-01-04  7:47                                           ` Jeroen Wijnhout
  2005-01-04 10:08                                           ` Bruno Ducrot
  2 siblings, 0 replies; 64+ messages in thread
From: Jeroen Wijnhout @ 2005-01-04  7:47 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Monday 03 January 2005 20:50, Pedro Venda wrote:
> 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
-- 
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                         ` <41D9A1F5.1060508-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  2005-01-03 20:30                                           ` Johan Vromans
  2005-01-04  7:47                                           ` Jeroen Wijnhout
@ 2005-01-04 10:08                                           ` Bruno Ducrot
       [not found]                                             ` <20050104100844.GA19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  2 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-04 10:08 UTC (permalink / raw)
  To: Pedro Venda; +Cc: Johan Vromans, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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.


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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                 ` <41D9F7CA.7030408-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-04 10:24                                                   ` Bruno Ducrot
       [not found]                                                     ` <20050104102424.GC19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-04 10:24 UTC (permalink / raw)
  To: Pedro Venda; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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.

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                             ` <20050104100844.GA19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2005-01-04 14:33                                               ` François Valenduc
       [not found]                                                 ` <41DAA92C.4080605-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
  2005-01-04 15:24                                               ` Pedro Venda
  1 sibling, 1 reply; 64+ messages in thread
From: François Valenduc @ 2005-01-04 14:33 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Bruno Ducrot

Bruno Ducrot a écrit :

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                 ` <41DAA92C.4080605-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
@ 2005-01-04 14:45                                                   ` Johannes Kuhlmann
       [not found]                                                     ` <47e0449d05010406454e59b16a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johannes Kuhlmann @ 2005-01-04 14:45 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

On Tue, 04 Jan 2005 15:33:16 +0100, François Valenduc
<fvalenduc-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org> wrote:
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                             ` <20050104100844.GA19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  2005-01-04 14:33                                               ` François Valenduc
@ 2005-01-04 15:24                                               ` Pedro Venda
       [not found]                                                 ` <41DAB539.2020605-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  1 sibling, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-04 15:24 UTC (permalink / raw)
  To: Bruno Ducrot; +Cc: Johan Vromans, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

-----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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                     ` <20050104102424.GC19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2005-01-04 15:27                                                       ` Pedro Venda
       [not found]                                                         ` <41DAB5C7.9040605-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-04 15:27 UTC (permalink / raw)
  To: Bruno Ducrot; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

-----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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                     ` <47e0449d05010406454e59b16a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2005-01-05 18:14                                                       ` Pavel Machek
  0 siblings, 0 replies; 64+ messages in thread
From: Pavel Machek @ 2005-01-05 18:14 UTC (permalink / raw)
  To: Johannes Kuhlmann; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hia

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


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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                         ` <41DAB5C7.9040605-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-06  8:51                                                           ` Bruno Ducrot
       [not found]                                                             ` <20050106085149.GJ19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Bruno Ducrot @ 2005-01-06  8:51 UTC (permalink / raw)
  To: Pedro Venda; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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,

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]             ` <20041231181628.GL19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
                                 ` (3 preceding siblings ...)
  2005-01-01 19:21               ` John Belmonte
@ 2005-01-09  3:08               ` ultrakorne
       [not found]                 ` <41E0A01C.6060607-XtQPfPCVGG7srOwW+9ziJQ@public.gmane.org>
  4 siblings, 1 reply; 64+ messages in thread
From: ultrakorne @ 2005-01-09  3:08 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]                 ` <41E0A01C.6060607-XtQPfPCVGG7srOwW+9ziJQ@public.gmane.org>
@ 2005-01-09 12:04                   ` Pedro Venda
       [not found]                     ` <41E11DD0.2090809-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-09 12:04 UTC (permalink / raw)
  To: ultrakorne; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

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

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

the battery can return that too. use this patch.

regards,
pedro venda.
- --

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

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

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

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                 ` <41DAB539.2020605-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-09 13:41                                                   ` Johan Vromans
       [not found]                                                     ` <m2oefyzplr.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-09 13:41 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> 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


[-- Attachment #2: battstat.pl --]
[-- Type: application/octet-stream, Size: 3068 bytes --]

#!/usr/bin/perl -w

# Quick hack to get a battery status display.
# Uses Pedro Venda's modified version of Bruno Ducrot's version
# of the smart battery reader (not included).
#
# Copyright 2005 Johan Vromans, Squirrel Consultancy.
#
# 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.

use strict;
use Tk;
use Tk::ProgressBar;

################ Configuration ################

my $interval = 10;		# Poll interval
my $prog = "smartbattery2 0";	# command

# Regular output of $prog is:
#
#	status:			discharging	initialized
#	mode:			capacity in 10 mW/mWh
#	design voltage:		14800 mV
#	design charge capacity:	4400 mAh or mWh
#	absolute charge:	90%
#	full charge capacity:	4270 mAh or mWh
#	relative charge:	93%
#	current:		-908 mA
#	voltage:		16271 mV
#	remain:			3966 mA
#	average time to empty:	261 minutes
#	average time to full:	65535 minutes
#	temperature:		24.2 C
#	cycle count:		12

################ End Configuration ################

my $status = 0;

my $mw = MainWindow->new;
$mw->title("Battery: Starting");

my $p = $mw->ProgressBar
  (-troughcolor => 'LightSkyBlue3',
   -borderwidth => 0,
   -length => 120,
   -width => 8,
   -variable => \$status,
   -colors => [0 => 'red', 10 => 'yellow', 20 => 'green'],
   #	 -blocks => 10,		# default
   -anchor => 'w',
   -from => 0,
   -to => 100,
  )->pack(-expand => 1);

# Check every 10 seconds.
$mw->repeat (10000, \&update);

my $state = 0;
update();

MainLoop;

sub update {

    my $res = `smartbattery2 $smbus 2>&1`;
    return unless $res;

    my ($current, $fill, $time, $tp);
    $current = $1 if $res =~ /current:\s+(-?\d+)\s+ma/i;
    $tp = $current < 0 ? 'empty' : 'full';
    $fill = $1    if $res =~ /relative charge:\s+(\d+)%/i;
    $time = $1    if $res =~ /average time to $tp:\s+(\d+)\s+minutes/i;
    if ( $time ) {
	my ($h, $m);
	$h = int($time / 60);
	$m = $time % 60;
	$time = sprintf("%d:%02d", $h, $m);
    }

    if ( $current > 0 ) {	# charging
	$status = 0;
    }
    elsif ( $current < 0 ) {	# discharging
	$status = $fill;
    }
    else {			# fully charged
	$status = 100;
    }
    $mw->title("Battery: $time ($status%)");

    # This is a kludge to get the ProgressBar to display uniform, but
    # different colours depending on the fill status.

    if ( $status >= 30 ) {
	if ( $state < 30 ) {
	    $p->{Configure}{-colors} = [ 0, 'green' ];
	    $p->{Configure}{-troughcolor} = 'darkgreen';
	    Tk::ProgressBar::_layoutRequest($p, 1);
	    $state = 30;
	}
    }
    elsif ( $status >= 10 ) {
	if ( $state < 10 || $state >= 30 ) {
	    $p->{Configure}{-colors} = [ 0, 'yellow' ];
	    $p->{Configure}{-troughcolor} = 'orange';
	    Tk::ProgressBar::_layoutRequest($p, 1);
	    $state = 10;
	}
    }
    elsif ( $state >= 10 ) {
	$p->{Configure}{-colors} = [ 0, 'red' ];
	$p->{Configure}{-troughcolor} = 'darkred';
	Tk::ProgressBar::_layoutRequest($p, 1);
	$state = 0;
    }
}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]                     ` <41E11DD0.2090809-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-09 16:12                       ` Ultrakorne
  2005-01-09 17:08                       ` ultrakorne
  1 sibling, 0 replies; 64+ messages in thread
From: Ultrakorne @ 2005-01-09 16:12 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Pedro Venda wrote:
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c)
       [not found]                     ` <41E11DD0.2090809-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  2005-01-09 16:12                       ` Ultrakorne
@ 2005-01-09 17:08                       ` ultrakorne
  1 sibling, 0 replies; 64+ messages in thread
From: ultrakorne @ 2005-01-09 17:08 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Pedro Venda wrote:
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                     ` <m2oefyzplr.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-10 13:51                                                       ` Zdzisław A. Kaleta
       [not found]                                                         ` <200501101451.36702.sanskryt-FWhLrETftxM@public.gmane.org>
  2005-01-10 14:24                                                       ` Zdzisław A. Kaleta
  1 sibling, 1 reply; 64+ messages in thread
From: Zdzisław A. Kaleta @ 2005-01-10 13:51 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dnia niedziela 09 stycznia 2005 14:41, Johan Vromans napisał:
> Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> 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.
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 ;-/
-- 
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                     ` <m2oefyzplr.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  2005-01-10 13:51                                                       ` Zdzisław A. Kaleta
@ 2005-01-10 14:24                                                       ` Zdzisław A. Kaleta
       [not found]                                                         ` <200501101524.58077.sanskryt-FWhLrETftxM@public.gmane.org>
  1 sibling, 1 reply; 64+ messages in thread
From: Zdzisław A. Kaleta @ 2005-01-10 14:24 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dnia niedziela 09 stycznia 2005 14:41, Johan Vromans napisał:
> Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> 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.
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 ;-/
-- 
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                         ` <200501101524.58077.sanskryt-FWhLrETftxM@public.gmane.org>
@ 2005-01-10 14:57                                                           ` Johan Vromans
       [not found]                                                             ` <m28y71fi1s.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-10 14:57 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

"Zdzisław A. Kaleta" <sanskryt-FWhLrETftxM@public.gmane.org> 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`;"

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                             ` <m28y71fi1s.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-10 15:43                                                               ` Pedro Venda
  2005-01-10 19:44                                                                 ` Johan Vromans
  2005-01-10 16:36                                                               ` Zdzisław A. Kaleta
  1 sibling, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-10 15:43 UTC (permalink / raw)
  To: Johan Vromans; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

Johan Vromans wrote:
| "Zdzis³aw A. Kaleta" <sanskryt-FWhLrETftxM@public.gmane.org> 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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                             ` <m28y71fi1s.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  2005-01-10 15:43                                                               ` Pedro Venda
@ 2005-01-10 16:36                                                               ` Zdzisław A. Kaleta
       [not found]                                                                 ` <200501101736.24293.sanskryt-FWhLrETftxM@public.gmane.org>
  1 sibling, 1 reply; 64+ messages in thread
From: Zdzisław A. Kaleta @ 2005-01-10 16:36 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

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

-- 
z.a.kaleta (sanskryt), registered Linux User #279350

[-- Attachment #2: zrzut ekranu1.png --]
[-- Type: image/png, Size: 3091 bytes --]

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                                 ` <200501101736.24293.sanskryt-FWhLrETftxM@public.gmane.org>
@ 2005-01-10 19:34                                                                   ` Johan Vromans
       [not found]                                                                     ` <m27jmlf57y.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-10 19:34 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

"Zdzisław A. Kaleta" <sanskryt-FWhLrETftxM@public.gmane.org> writes:

> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
  2005-01-10 15:43                                                               ` Pedro Venda
@ 2005-01-10 19:44                                                                 ` Johan Vromans
  0 siblings, 0 replies; 64+ messages in thread
From: Johan Vromans @ 2005-01-10 19:44 UTC (permalink / raw)
  To: Pedro Venda; +Cc: Johan Vromans, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[Quoting Pedro Venda, on January 10 2005, 15:43, in "Re: [ACPI] Re: first"]
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                                     ` <m27jmlf57y.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-10 22:41                                                                       ` Zdzisław A. Kaleta
       [not found]                                                                         ` <200501102341.07731.sanskryt-FWhLrETftxM@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Zdzisław A. Kaleta @ 2005-01-10 22:41 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dnia poniedziałek 10 stycznia 2005 20:34, Johan Vromans napisał:
> "Zdzisław A. Kaleta" <sanskryt-FWhLrETftxM@public.gmane.org> writes:
> > 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?
>
> 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
>
> -- Johan

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                                         ` <200501102341.07731.sanskryt-FWhLrETftxM@public.gmane.org>
@ 2005-01-11  9:29                                                                           ` Johan Vromans
       [not found]                                                                             ` <m2sm58mhzg.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-11  9:29 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

"Zdzisław A. Kaleta" <sanskryt-FWhLrETftxM@public.gmane.org> writes:

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

Maybe Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> (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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                             ` <20050106085149.GJ19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
@ 2005-01-11 10:05                                                               ` Pedro Venda
  0 siblings, 0 replies; 64+ messages in thread
From: Pedro Venda @ 2005-01-11 10:05 UTC (permalink / raw)
  To: Bruno Ducrot; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

-----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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                                             ` <m2sm58mhzg.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-11 10:10                                                                               ` Pedro Venda
  0 siblings, 0 replies; 64+ messages in thread
From: Pedro Venda @ 2005-01-11 10:10 UTC (permalink / raw)
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

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

Johan Vromans wrote:
| "Zdzis³aw A. Kaleta" <sanskryt-FWhLrETftxM@public.gmane.org> writes:
|
|
|>So it look like that I realy have the not proper smartbattery.c
|>version. Where I can find proper one?
|
|
| Maybe Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> (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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

[-- Attachment #2: smartbattery.c --]
[-- Type: text/plain, Size: 10639 bytes --]

/*
    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 <frodol-B0qZmFHriGg@public.gmane.org>, and
                             Mark D. Studebaker <mdsxyz123-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
    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;
}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                         ` <200501101451.36702.sanskryt-FWhLrETftxM@public.gmane.org>
@ 2005-01-11 10:12                                                           ` Pedro Venda
       [not found]                                                             ` <41E3A69B.2020506-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-11 10:12 UTC (permalink / raw)
  To: sanskryt-FWhLrETftxM; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

Zdzis³aw A. Kaleta wrote:
| Dnia niedziela 09 stycznia 2005 14:41, Johan Vromans napisa³:
|
|>Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> 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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                             ` <41E3A69B.2020506-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-11 10:49                                                               ` z.a.kaleta
       [not found]                                                                 ` <200501111149.55615.sanskryt-h7QdYz1kt/Q@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: z.a.kaleta @ 2005-01-11 10:49 UTC (permalink / raw)
  To: Pedro Venda; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                                 ` <200501111149.55615.sanskryt-h7QdYz1kt/Q@public.gmane.org>
@ 2005-01-11 11:44                                                                   ` Pedro Venda
       [not found]                                                                     ` <41E3BC06.30408-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Pedro Venda @ 2005-01-11 11:44 UTC (permalink / raw)
  To: sanskryt-h7QdYz1kt/Q; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

-----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: pjvenda-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org
http://arrakis.dhis.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                                     ` <41E3BC06.30408-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
@ 2005-01-11 12:30                                                                       ` Zdzisław A. Kaleta
  0 siblings, 0 replies; 64+ messages in thread
From: Zdzisław A. Kaleta @ 2005-01-11 12:30 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dnia wtorek 11 stycznia 2005 12:44, Pedro Venda napisał:
> 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.
Of course as almost always in Linux and hardware problem.
>
> 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.
>
> fortunately we learn mostly from mistakes, so it won't happen again.
>
> regards,
> pedro venda.
Again thank for your work.
-- 
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                             ` <m2mzvq5k7u.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-13 12:44                                               ` Johannes Kuhlmann
       [not found]                                                 ` <47e0449d05011304446094c8b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johannes Kuhlmann @ 2005-01-13 12:44 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi,

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

Regards,
Johannes

On Mon, 03 Jan 2005 21:30:29 +0100, Johan Vromans <jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org> wrote:
> .....
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                 ` <47e0449d05011304446094c8b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2005-01-16 20:44                                                   ` Johan Vromans
       [not found]                                                     ` <m2fz11gl3c.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-16 20:44 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Johannes Kuhlmann <jkuhlmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> On Mon, 03 Jan 2005 21:30:29 +0100, Johan Vromans <jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org> wrote:
>> .....
>> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                     ` <m2fz11gl3c.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-17  9:31                                                       ` Fionn Behrens
  2005-01-17  9:55                                                         ` Johan Vromans
  2005-01-17 19:41                                                       ` Johannes Kuhlmann
  1 sibling, 1 reply; 64+ messages in thread
From: Fionn Behrens @ 2005-01-17  9:31 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On 16.01.2005, 21:44 +0100 Johan Vromans wrote:
> Johannes Kuhlmann <jkuhlmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> >> 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
-- 
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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
  2005-01-17  9:31                                                       ` Fionn Behrens
@ 2005-01-17  9:55                                                         ` Johan Vromans
       [not found]                                                           ` <m2pt04qt1j.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johan Vromans @ 2005-01-17  9:55 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Fionn Behrens <fionn-ZPjJJ+sDHmfddJNmlsFzeA@public.gmane.org> writes:

> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                           ` <m2pt04qt1j.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
@ 2005-01-17 11:49                                                             ` Johannes Kuhlmann
       [not found]                                                               ` <47e0449d050117034912fb9ae3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 64+ messages in thread
From: Johannes Kuhlmann @ 2005-01-17 11:49 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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


On Mon, 17 Jan 2005 10:55:04 +0100, Johan Vromans <jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org> wrote:
> Fionn Behrens <fionn-ZPjJJ+sDHmfddJNmlsFzeA@public.gmane.org> writes:
> 
> > 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
> _______________________________________________
> Acpi-devel mailing list
> Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                               ` <47e0449d050117034912fb9ae3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2005-01-17 12:37                                                                 ` Fernando Gómez
  0 siblings, 0 replies; 64+ messages in thread
From: Fernando Gómez @ 2005-01-17 12:37 UTC (permalink / raw)
  To: Johannes Kuhlmann; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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


On Mon, 17 Jan 2005 12:49:15 +0100, Johannes Kuhlmann
<jkuhlmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 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
> 
> 
> On Mon, 17 Jan 2005 10:55:04 +0100, Johan Vromans <jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org> wrote:
> > Fionn Behrens <fionn-ZPjJJ+sDHmfddJNmlsFzeA@public.gmane.org> writes:
> >
> > > 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
> > _______________________________________________
> > Acpi-devel mailing list
> > Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > 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
> _______________________________________________
> Acpi-devel mailing list
> Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: Re: first shoot for smartbattery
       [not found]                                                     ` <m2fz11gl3c.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
  2005-01-17  9:31                                                       ` Fionn Behrens
@ 2005-01-17 19:41                                                       ` Johannes Kuhlmann
       [not found]                                                         ` <47e0449d050117114113973694-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 64+ messages in thread
From: Johannes Kuhlmann @ 2005-01-17 19:41 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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


> 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


On Sun, 16 Jan 2005 21:44:39 +0100, Johan Vromans <jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org> wrote:
> Johannes Kuhlmann <jkuhlmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> 
> > On Mon, 03 Jan 2005 21:30:29 +0100, Johan Vromans <jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org> wrote:
> >> .....
> >> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: first shoot for smartbattery
       [not found]                                                         ` <47e0449d050117114113973694-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2005-01-18  9:49                                                           ` Johan Vromans
  0 siblings, 0 replies; 64+ messages in thread
From: Johan Vromans @ 2005-01-18  9:49 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Johannes Kuhlmann <jkuhlmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2005-01-18  9:49 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20041231092156.GA612@phys.ethz.ch>
     [not found] ` <20041231092156.GA612-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
2004-12-31 14:19   ` i2c-acpi-ec.c Pedro Venda
     [not found]     ` <41D56002.5060008-aHmAgkVUFT6Joy8PIJZ9VA@public.gmane.org>
2004-12-31 15:07       ` i2c-acpi-ec.c Bruno Ducrot
     [not found]         ` <20041231150724.GK19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2004-12-31 18:16           ` first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c) Bruno Ducrot
     [not found]             ` <20041231181628.GL19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2004-12-31 18:48               ` François Valenduc
     [not found]                 ` <41D59F15.2030504-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
2004-12-31 19:09                   ` Bruno Ducrot
2005-01-01  8:26               ` Mathias Weyland
     [not found]                 ` <20050101082605.GA24896-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
2005-01-01 10:08                   ` first shoot for smartbattery Johan Vromans
     [not found]                     ` <m2acrth375.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-01 22:33                       ` François Valenduc
2005-01-03 13:45                       ` Bruno Ducrot
2005-01-03 14:39                       ` Bruno Ducrot
     [not found]                         ` <20050103143902.GQ19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2005-01-03 14:55                           ` Mathias Weyland
     [not found]                             ` <41D95CDC.8050802-vpGm2Noi6jeZvKxeG3EEhw@public.gmane.org>
2005-01-03 15:05                               ` François Valenduc
     [not found]                                 ` <41D95F53.5000008-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
2005-01-03 15:41                                   ` François Valenduc
     [not found]                                     ` <41D967B5.7040002-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
2005-01-03 17:02                                       ` liste-9nAOAgdJVo4b1SvskN2V4Q
     [not found]                                         ` <Pine.LNX.4.60.0501031751590.5329-KnfdeQs3A3X/9pzu0YdTqQ@public.gmane.org>
2005-01-03 17:54                                           ` Bruno Ducrot
     [not found]                                             ` <20050103175449.GW19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2005-01-04  1:56                                               ` Pedro Venda
     [not found]                                                 ` <41D9F7CA.7030408-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-04 10:24                                                   ` Bruno Ducrot
     [not found]                                                     ` <20050104102424.GC19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2005-01-04 15:27                                                       ` Pedro Venda
     [not found]                                                         ` <41DAB5C7.9040605-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-06  8:51                                                           ` Bruno Ducrot
     [not found]                                                             ` <20050106085149.GJ19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2005-01-11 10:05                                                               ` Pedro Venda
2005-01-03 15:08                               ` Bruno Ducrot
2005-01-03 17:03                           ` Pedro Venda
     [not found]                             ` <41D97AF3.7000409-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-03 17:34                               ` Bruno Ducrot
2005-01-03 17:35                               ` Pedro Venda
     [not found]                                 ` <41D98251.9020002-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-03 18:02                                   ` Bruno Ducrot
     [not found]                                     ` <20050103180219.GX19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2005-01-03 19:50                                       ` Pedro Venda
     [not found]                                         ` <41D9A1F5.1060508-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-03 20:30                                           ` Johan Vromans
     [not found]                                             ` <m2mzvq5k7u.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-13 12:44                                               ` Johannes Kuhlmann
     [not found]                                                 ` <47e0449d05011304446094c8b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2005-01-16 20:44                                                   ` Johan Vromans
     [not found]                                                     ` <m2fz11gl3c.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-17  9:31                                                       ` Fionn Behrens
2005-01-17  9:55                                                         ` Johan Vromans
     [not found]                                                           ` <m2pt04qt1j.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-17 11:49                                                             ` Johannes Kuhlmann
     [not found]                                                               ` <47e0449d050117034912fb9ae3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2005-01-17 12:37                                                                 ` Fernando Gómez
2005-01-17 19:41                                                       ` Johannes Kuhlmann
     [not found]                                                         ` <47e0449d050117114113973694-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2005-01-18  9:49                                                           ` Johan Vromans
2005-01-04  7:47                                           ` Jeroen Wijnhout
2005-01-04 10:08                                           ` Bruno Ducrot
     [not found]                                             ` <20050104100844.GA19199-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2005-01-04 14:33                                               ` François Valenduc
     [not found]                                                 ` <41DAA92C.4080605-IWqWACnzNjyZIoH1IeqzKA@public.gmane.org>
2005-01-04 14:45                                                   ` Johannes Kuhlmann
     [not found]                                                     ` <47e0449d05010406454e59b16a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2005-01-05 18:14                                                       ` Pavel Machek
2005-01-04 15:24                                               ` Pedro Venda
     [not found]                                                 ` <41DAB539.2020605-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-09 13:41                                                   ` Johan Vromans
     [not found]                                                     ` <m2oefyzplr.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-10 13:51                                                       ` Zdzisław A. Kaleta
     [not found]                                                         ` <200501101451.36702.sanskryt-FWhLrETftxM@public.gmane.org>
2005-01-11 10:12                                                           ` Pedro Venda
     [not found]                                                             ` <41E3A69B.2020506-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-11 10:49                                                               ` z.a.kaleta
     [not found]                                                                 ` <200501111149.55615.sanskryt-h7QdYz1kt/Q@public.gmane.org>
2005-01-11 11:44                                                                   ` Pedro Venda
     [not found]                                                                     ` <41E3BC06.30408-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-11 12:30                                                                       ` Zdzisław A. Kaleta
2005-01-10 14:24                                                       ` Zdzisław A. Kaleta
     [not found]                                                         ` <200501101524.58077.sanskryt-FWhLrETftxM@public.gmane.org>
2005-01-10 14:57                                                           ` Johan Vromans
     [not found]                                                             ` <m28y71fi1s.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-10 15:43                                                               ` Pedro Venda
2005-01-10 19:44                                                                 ` Johan Vromans
2005-01-10 16:36                                                               ` Zdzisław A. Kaleta
     [not found]                                                                 ` <200501101736.24293.sanskryt-FWhLrETftxM@public.gmane.org>
2005-01-10 19:34                                                                   ` Johan Vromans
     [not found]                                                                     ` <m27jmlf57y.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-10 22:41                                                                       ` Zdzisław A. Kaleta
     [not found]                                                                         ` <200501102341.07731.sanskryt-FWhLrETftxM@public.gmane.org>
2005-01-11  9:29                                                                           ` Johan Vromans
     [not found]                                                                             ` <m2sm58mhzg.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2005-01-11 10:10                                                                               ` Pedro Venda
2005-01-01 17:05                   ` first shoot for smartbattery (was Re: Re: i2c-acpi-ec.c) Pedro Venda
2005-01-01 12:35               ` Hendrik Jürgens
2005-01-01 19:21               ` John Belmonte
     [not found]                 ` <41D6F826.8090906-wanGne27zNesTnJN9+BGXg@public.gmane.org>
2005-01-03 13:13                   ` Bruno Ducrot
2005-01-09  3:08               ` ultrakorne
     [not found]                 ` <41E0A01C.6060607-XtQPfPCVGG7srOwW+9ziJQ@public.gmane.org>
2005-01-09 12:04                   ` Pedro Venda
     [not found]                     ` <41E11DD0.2090809-pQd4kjVL+REh2FBCd0jGRA@public.gmane.org>
2005-01-09 16:12                       ` Ultrakorne
2005-01-09 17:08                       ` ultrakorne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox