* smart battery
@ 2005-05-19 6:23 James Klaas
2005-05-19 6:23 ` James Klaas
2005-05-19 6:23 ` Mark D. Studebaker
0 siblings, 2 replies; 5+ messages in thread
From: James Klaas @ 2005-05-19 6:23 UTC (permalink / raw)
To: lm-sensors
I hope this is the right place to post this.
I don't know if anyone has e-mailed you all about the SonicBlue ProGear
tablet computer. This has an ali1535 smbus with an adm1024 thermal
monitoring chip. It also has an unidentified smart battery and something
hanging at 0x69 which is probably a timer (as noted in your documentation).
The code for reading the battery was released and the actual code for
retrieving the data from the battery is GPL. The other code for
displaying and setting the battery is of unknown license. After reading
through the code for the battery and your instructions for creating a chip
driver I don't think I have the capability to write the driver. I would
be happy to post the GPL code if someone else is able to write the driver.
I'm also confused as to whether the smart battery is the chip (to
create a driver for) or if there's a separate chip that drives the smart
battery that needs to be identified. I can see the top half of the
circuit board but I am not comfortable with taking the circuit board out
of the case as it's all packed rather tightly and I don't want to risk
making the unit non-operational. I also have no idea what I should be
looking for.
Thank you for your help.
--
"Don't try to use a 'hard copy' manual. It will take you hours (or possibly
days) to find out that it won't tell you what you want to know. Using the
'Help' menu, it normally take less than 20 minutes to find out that it isn't
going to tell you what you want to know." -- Pete Moody
James Klaas
^ permalink raw reply [flat|nested] 5+ messages in thread
* smart battery
2005-05-19 6:23 smart battery James Klaas
2005-05-19 6:23 ` James Klaas
@ 2005-05-19 6:23 ` Mark D. Studebaker
1 sibling, 0 replies; 5+ messages in thread
From: Mark D. Studebaker @ 2005-05-19 6:23 UTC (permalink / raw)
To: lm-sensors
we don't know much about 'smart batteries' but
the smart battery people were the original authors of the SMBus spec.
There are some smart battery specs on the web too -
it may be that the interface is standard.
We'd love to see the GPL code. If anybody would like to write a driver
then we will have the code to give them.
mds
James Klaas wrote:
>
> I hope this is the right place to post this.
>
> I don't know if anyone has e-mailed you all about the SonicBlue ProGear
> tablet computer. This has an ali1535 smbus with an adm1024 thermal
> monitoring chip. It also has an unidentified smart battery and something
> hanging at 0x69 which is probably a timer (as noted in your documentation).
>
> The code for reading the battery was released and the actual code for
> retrieving the data from the battery is GPL. The other code for
> displaying and setting the battery is of unknown license. After reading
> through the code for the battery and your instructions for creating a chip
> driver I don't think I have the capability to write the driver. I would
> be happy to post the GPL code if someone else is able to write the driver.
>
> I'm also confused as to whether the smart battery is the chip (to
> create a driver for) or if there's a separate chip that drives the smart
> battery that needs to be identified. I can see the top half of the
> circuit board but I am not comfortable with taking the circuit board out
> of the case as it's all packed rather tightly and I don't want to risk
> making the unit non-operational. I also have no idea what I should be
> looking for.
>
> Thank you for your help.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* smart battery
2005-05-19 6:23 smart battery James Klaas
@ 2005-05-19 6:23 ` James Klaas
2005-05-19 6:23 ` Mark D. Studebaker
1 sibling, 0 replies; 5+ messages in thread
From: James Klaas @ 2005-05-19 6:23 UTC (permalink / raw)
To: lm-sensors
I don't know if the code should be inlined or attached. I've attached it,
and I would be happy to resend inlined instead. I would also be very
happy to test any drivers as needed.
On Thu, 5 Sep 2002, Mark D. Studebaker wrote:
> we don't know much about 'smart batteries' but
> the smart battery people were the original authors of the SMBus spec.
> There are some smart battery specs on the web too -
> it may be that the interface is standard.
>
> We'd love to see the GPL code. If anybody would like to write a driver
> then we will have the code to give them.
>
> mds
>
>
>
> James Klaas wrote:
> >
> > I hope this is the right place to post this.
> >
James Klaas
-------------- next part --------------
/* battery.c
Copyright (C) 2000 Linuxcare, Inc.
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., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA. */
# include <sys/ioctl.h>
# include <fcntl.h>
# include <unistd.h>
#include <errno.h>
#include <linux/i2c-dev.h>
#include "battery.h"
#ifndef PATH_SMBUS
# define PATH_SMBUS "/dev/i2c-0"
#endif
#define COMM_TIMEOUT 16
int
battery_status(int fd)
{
int n = COMM_TIMEOUT;
int status;
do
status = i2c_smbus_read_word_data(fd, 0x16);
while ((status = -1) && (n-- > 0));
return status;
}
int
battery_info(int fd, struct battery_info *info)
{
int n;
int val;
n = COMM_TIMEOUT;
/* ManufactureDate */
do {
val = i2c_smbus_read_word_data(fd, 0x1b);
} while ((val = -1) && (n-- > 0));
info->manufacture_date.day=val & 0x1F;
info->manufacture_date.month=(val >> 5) & 0x0F;
info->manufacture_date.year=(val >> 9) & 0x7F;
/* SerialNumber */
n = COMM_TIMEOUT;
do {
val = i2c_smbus_read_word_data(fd, 0x1c);
} while ((val = -1) && (n-- > 0));
info->serial=val;
/* ManufacturerName */
n = COMM_TIMEOUT;
do {
val = i2c_smbus_read_block_data(fd, 0x20, info->manufacturer);
} while ((val = -1) && (n-- > 0));
info->manufacturer[val]=0;
/* DeviceName */
n = COMM_TIMEOUT;
do {
val = i2c_smbus_read_block_data(fd, 0x21, info->device);
} while ((val = -1) && (n-- > 0));
info->device[val]=0;
/* DeviceChemistry */
n = COMM_TIMEOUT;
do {
val = i2c_smbus_read_block_data(fd, 0x22, info->chemistry);
} while ((val = -1) && (n-- > 0));
info->chemistry[val]=0;
return 0;
}
int
battery_mode(int fd)
{
int n = COMM_TIMEOUT;
int mode;
do
mode = i2c_smbus_read_word_data(fd, 0x3);
while ((mode = -1) && (n-- > 0));
return mode;
}
int
battery_set_mode(int fd, int mode)
{
int n = COMM_TIMEOUT;
int result;
do
result = i2c_smbus_write_word_data(fd, 0x3, mode);
while ((result = -1) && (n-- > 0));
return result;
}
int battery_get_current(int fd, int *value)
{
int n = COMM_TIMEOUT;
int current;
do
current = i2c_smbus_read_word_data(fd, 0xa);
while ((current = -1) && (n-- > 0));
if (current = -1)
return -1;
*value = (short) current;
return 0;
}
int battery_get_average_current(int fd, int *value)
{
int n = COMM_TIMEOUT;
int current;
do
current = i2c_smbus_read_word_data(fd, 0xb);
while ((current = -1) && (n-- > 0));
if (current = -1)
return -1;
*value = (short) current;
return 0;
}
int battery_get_voltage(int fd, int *value)
{
int n = COMM_TIMEOUT;
int voltage;
do
voltage = i2c_smbus_read_word_data(fd, 0x9);
while ((voltage = -1) && (n-- > 0));
if (voltage = -1)
return -1;
*value = (short) voltage;
return 0;
}
int
battery_relative_state(int fd)
{
int n = COMM_TIMEOUT;
int state;
do
state = i2c_smbus_read_word_data(fd, 0xd);
while ((state = -1) && (n-- > 0));
return state;
}
int
battery_average_time_to_empty(int fd)
{
int n = COMM_TIMEOUT;
int tte;
do
tte = i2c_smbus_read_word_data(fd, 0x12);
while ((tte = -1) && (n-- > 0));
return tte;
}
int
battery_timeout(int fd,int timeout)
{
return ioctl(fd,I2C_TIMEOUT,timeout);
}
int
battery_close(int fd)
{
return close(fd);
}
int
battery_open(void)
{
int fd,err;
fd = open(PATH_SMBUS, O_RDWR);
if (fd<0) {
return -1;
}
err = ioctl(fd,I2C_SLAVE_FORCE,0x0b);
if (err<0) {
close(fd);
return err;
}
return fd;
}
-------------- next part --------------
/* sbsutils
Copyright (C) 2000 Hypercore Software Design, Ltd.
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., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA. */
#ifndef _BATTERY_H
#define _BATTERY_H 1
#define BATTERY_STRING_MAX 1024
struct battery_info {
char manufacturer[BATTERY_STRING_MAX];
char device[BATTERY_STRING_MAX];
char chemistry[BATTERY_STRING_MAX];
int serial;
struct {
unsigned int day:5; /* Day (1-31) */
unsigned int month:4; /* Month (1-12) */
unsigned int year:7; /* Year (1980 + 0-127) */
} manufacture_date;
};
extern int battery_open(void); /* Returns battery handle */
extern int battery_close(int batt_handle);
extern int battery_info(int batt_handle, struct battery_info *info);
extern int battery_timeout(int batt_handle, int timeout_msecs);
extern int battery_status(int batt_handle);
extern int battery_mode(int batt_handle);
extern int battery_set_mode(int batt_handle, int mode);
extern int battery_get_current(int batt_handle, int *value);
extern int battery_get_average_current(int batt_handle, int *value);
extern int battery_relative_state(int batt_handle);
extern int battery_average_time_to_empty(int batt_handle);
extern int battery_get_voltage(int batt_handl,int *millivolts);
#endif /* not _BATTERY_H */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Smart Battery
@ 2005-07-12 21:27 Danny Brow
[not found] ` <42D435C5.2050001-z3L/acBEKgLJPO3Kjao2dg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Danny Brow @ 2005-07-12 21:27 UTC (permalink / raw)
To: ACPI
Is ACPI going to include support for smart batteries in the near future?
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Smart Battery
[not found] ` <42D435C5.2050001-z3L/acBEKgLJPO3Kjao2dg@public.gmane.org>
@ 2005-07-18 14:07 ` Bruno Ducrot
0 siblings, 0 replies; 5+ messages in thread
From: Bruno Ducrot @ 2005-07-18 14:07 UTC (permalink / raw)
To: Danny Brow; +Cc: ACPI
On Tue, Jul 12, 2005 at 05:27:33PM -0400, Danny Brow wrote:
> Is ACPI going to include support for smart batteries in the near future?
>
I think someone is working on this. If not, I will do the job in 2 or 3
months I think.
--
Bruno Ducrot
-- Which is worse: ignorance or apathy?
-- Don't know. Don't care.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-07-18 14:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-12 21:27 Smart Battery Danny Brow
[not found] ` <42D435C5.2050001-z3L/acBEKgLJPO3Kjao2dg@public.gmane.org>
2005-07-18 14:07 ` Bruno Ducrot
-- strict thread matches above, loose matches on Subject: below --
2005-05-19 6:23 smart battery James Klaas
2005-05-19 6:23 ` James Klaas
2005-05-19 6:23 ` Mark D. Studebaker
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.