lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 4 May 2008 01:31:42 -0400
From:	Andres Salomon <dilinger@...ued.net>
To:	cbouatmailru@...il.com
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, cbou@...l.ru, dwmw2@...radead.org
Subject: Re: [PATCH 1/4] power_supply: Support serial number and ACR in
 olpc_battery

On Sat, 3 May 2008 02:58:49 +0400
Anton Vorontsov <cbouatmailru@...il.com> wrote:

> On Wed, Apr 30, 2008 at 04:30:02PM -0400, Andres Salomon wrote:
> > From: David Woodhouse <dwmw2@...radead.org>
> > 
> > This adds serial number and accumulated current support to the OLPC
> > battery driver.
> 
> How PROP_ACCUM_CURRENT is different from PROP_CHARGE_NOW (uAh)?
> 
> The DS2760 is already using the later to report its ACR register...
> 

Hm, I can change that.  In the meantime, I've stripped out the
ACR stuff.  Can you please use the following patch instead?  The change
doesn't conflict with the other 3 patches.





From: David Woodhouse <dwmw2@...radead.org>

power_supply: Support serial number in olpc_battery

This adds serial number support to the OLPC
battery driver.

Signed-off-by: David Woodhouse <dwmw2@...radead.org>
Signed-off-by: Andres Salomon <dilinger@...ian.org>
---
 drivers/power/olpc_battery.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index ab1e828..7524a63 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -84,6 +84,8 @@ static struct power_supply olpc_ac = {
 	.get_property = olpc_ac_get_prop,
 };
 
+static char bat_serial[17]; /* Ick */
+
 /*********************************************************************
  *		Battery properties
  *********************************************************************/
@@ -94,6 +96,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
 	int ret = 0;
 	int16_t ec_word;
 	uint8_t ec_byte;
+	uint64_t ser_buf;
 
 	ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1);
 	if (ret)
@@ -241,6 +244,14 @@ static int olpc_bat_get_property(struct power_supply *psy,
 		ec_word = be16_to_cpu(ec_word);
 		val->intval = ec_word * 100 / 256;
 		break;
+	case POWER_SUPPLY_PROP_SERIAL_NUMBER:
+		ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
+		if (ret)
+			return ret;
+
+		sprintf(bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf));
+		val->strval = bat_serial;
+		break;
 	default:
 		ret = -EINVAL;
 		break;
@@ -260,6 +271,7 @@ static enum power_supply_property olpc_bat_props[] = {
 	POWER_SUPPLY_PROP_TEMP,
 	POWER_SUPPLY_PROP_TEMP_AMBIENT,
 	POWER_SUPPLY_PROP_MANUFACTURER,
+	POWER_SUPPLY_PROP_SERIAL_NUMBER,
 };
 
 /*********************************************************************
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ