[ltp] Re: [ANN] tp_smapi - a new Linux SMAPI driver

Volker Gropp linux-thinkpad@linux-thinkpad.org
Mon, 5 Dec 2005 00:24:06 +0100


--b8GWCKCLzrXbuNet
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

* On Mon, Dec 05, 2005 at 00:38:05 +0200, Shem Multinymous wrote:

> Hi,
> 
> Peter,  Stefan, Csillag: thanks for the reports! Maybe your laptops
> (R40, T40p and G41) don't support this specific SMAPI function? Can
> you set charge threshold under Winows from IBM's Battery Maximizer?
> 
> Attached is tp_smapi 0.02, which has more informative error reporting.
> Let's see what dmesg says now on your systems.
> 
> Peter, about the DMI check, how is your R40 identified? Can you attach
> the output of
> "dmidecode  | grep -C5 Product"?
> 
>   Shem

Hi,

thanks for your work so far. I was waiting for those battery functions
quiet some time. But I tried it on my 2.6.15-rc3 including suspend2 
X40 23718NG without success.
To get it compile i had to apply the attached patch. But even after
that, i got the following error:

cat /sys/devices/platform/smapi/*_charge_thresh
cat: /sys/devices/platform/smapi/start_charge_thresh: Function not implemented
cat: /sys/devices/platform/smapi/stop_charge_thresh: Function not implemented

dmesg:
tp_smapi: initialized, smapi_port=0xb2.
tp_smapi: driver successfully loaded.
tp_smapi: smapi_request in: BX=2116 CX=100 DI=0 SI=0
tp_smapi: smapi_request out: AX=80 BX=2116 CX=300 DX=b2 DI=0 SI=0 ret=0
tp_smapi: smapi_request in: BX=211a CX=100 DI=0 SI=0
tp_smapi: smapi_request out: AX=8680 BX=211a CX=100 DX=b2 DI=0 SI=0 ret=-38
tp_smapi: SMAPI error: Function is not supported (BX=211a)
tp_smapi: get_thresh(0,0) failed
tp_smapi: smapi_request in: BX=211a CX=100 DI=0 SI=0
tp_smapi: smapi_request out: AX=8680 BX=211a CX=100 DX=b2 DI=0 SI=0 ret=-38
tp_smapi: SMAPI error: Function is not supported (BX=211a)
tp_smapi: get_thresh(0,0) failed
tp_smapi: smapi_request in: BX=2116 CX=100 DI=0 SI=0
tp_smapi: smapi_request out: AX=80 BX=2116 CX=300 DX=b2 DI=0 SI=0 ret=0
tp_smapi: smapi_request in: BX=211a CX=100 DI=0 SI=0
tp_smapi: smapi_request out: AX=8680 BX=211a CX=100 DX=b2 DI=0 SI=0 ret=-38
tp_smapi: SMAPI error: Function is not supported (BX=211a)
tp_smapi: get_thresh(0,0) failed
tp_smapi: smapi_request in: BX=211a CX=100 DI=0 SI=0
tp_smapi: smapi_request out: AX=8680 BX=211a CX=100 DX=b2 DI=0 SI=0 ret=-38
tp_smapi: SMAPI error: Function is not supported (BX=211a)
tp_smapi: get_thresh(0,0) failed

looks like our older thinkpads need other functions. I tried to look at
the PWRMGRIF.DLL but wasnt able to find it, but a
Program Files/ThinkPad/Utilities/PWRMONIT.DLL TPPWREX.DLL  and
TPPWRW32.DLL, might that piece change for new TP? What exactly are we looking 
for, and how to look defined functions up?

Thanks for your help

Volker Gropp

--b8GWCKCLzrXbuNet
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tp_smapi-2.6.15-rc3.diff"

--- tp_smapi-0.02/tp_smapi.c	2005-12-04 23:32:25.000000000 +0100
+++ tp_smapi-0.02-/tp_smapi.c	2005-12-04 23:55:37.557757688 +0100
@@ -48,6 +48,8 @@
 #include <linux/delay.h>
 #include <asm/uaccess.h>
 
+#include <linux/platform_device.h>
+
 #include <acpi/acpi_drivers.h>
 #include <acpi/acnamesp.h>
 
@@ -361,25 +363,25 @@
 
 static int tp_suspend(struct device *dev, pm_message_t state, uint32_t level)
 {
-	if (level == SUSPEND_POWER_DOWN) {
+/* 	if (level == SUSPEND_POWER_DOWN) {*/
 		if (get_thresh(0, THRESH_STOP , &saved_threshs[0])) saved_threshs[0]=-1;
 		if (get_thresh(0, THRESH_START, &saved_threshs[1])) saved_threshs[1]=-1;
 		if (get_thresh(1, THRESH_STOP , &saved_threshs[2])) saved_threshs[2]=-1;
 		if (get_thresh(1, THRESH_START, &saved_threshs[3])) saved_threshs[3]=-1;
 		printk(TP_DEBUG "suspend saved: %d %d %d %d\n", saved_threshs[0], 
 		       saved_threshs[1], saved_threshs[2], saved_threshs[3]);
-	}
+/*	} */
 	return 0;
 }
 
 static int tp_resume(struct device *dev, u32 level)
 {
-	if (level == RESUME_POWER_ON) {
+/*	if (level == RESUME_POWER_ON) { */
 		if (saved_threshs[0]>=0) set_thresh(0, THRESH_STOP , saved_threshs[0]);
 		if (saved_threshs[1]>=0) set_thresh(0, THRESH_START, saved_threshs[1]);
 		if (saved_threshs[2]>=0) set_thresh(1, THRESH_STOP , saved_threshs[2]);
 		if (saved_threshs[3]>=0) set_thresh(1, THRESH_START, saved_threshs[3]);
-	}
+/* 	} */
 	return 0;
 }
 

--b8GWCKCLzrXbuNet--