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

volker gropp linux-thinkpad@linux-thinkpad.org
Mon, 5 Dec 2005 01:45:50 +0100


* On Mon, Dec 05, 2005 at 02:13:04 +0200, Shem Multinymous wrote:

> On 12/5/05, Volker Gropp <vgropp@pefra.de> wrote:
> > * On Mon, Dec 05, 2005 at 00:38:05 +0200, Shem Multinymous wrote:
> 
> > To get it compile i had to apply the attached patch.
> 
> Does the original version compile if you add
>  #include <linux/device.h>
> ?

No, it doesnt. But maybe thats a suspend2 issue.
full make output against my 2.6.15-rc3 including suspend2 -rc13 patch:
make -C /lib/modules/2.6.15-rc3/build M=/usr/src/tp_smapi-0.02 modules
make[1]: Entering directory `/usr/src/linux-2.6.15-rc3'
  CC [M]  /usr/src/tp_smapi-0.02/tp_smapi.o
/usr/src/tp_smapi-0.02/tp_smapi.c: In function 'tp_suspend':
/usr/src/tp_smapi-0.02/tp_smapi.c:366: error: 'SUSPEND_POWER_DOWN' undeclared (first use in this function)
/usr/src/tp_smapi-0.02/tp_smapi.c:366: error: (Each undeclared identifier is reported only once
/usr/src/tp_smapi-0.02/tp_smapi.c:366: error: for each function it appears in.)
/usr/src/tp_smapi-0.02/tp_smapi.c: In function 'tp_resume':
/usr/src/tp_smapi-0.02/tp_smapi.c:379: error: 'RESUME_POWER_ON' undeclared (first use in this function)
/usr/src/tp_smapi-0.02/tp_smapi.c: At top level:
/usr/src/tp_smapi-0.02/tp_smapi.c:390: error: 'platform_bus_type' undeclared here (not in a function)
/usr/src/tp_smapi-0.02/tp_smapi.c:393: warning: initialization from incompatible pointer type
/usr/src/tp_smapi-0.02/tp_smapi.c:395: warning: initialization from incompatible pointer type
/usr/src/tp_smapi-0.02/tp_smapi.c: In function 'tp_init':
/usr/src/tp_smapi-0.02/tp_smapi.c:452: warning: implicit declaration of function 'platform_device_register_simple'
/usr/src/tp_smapi-0.02/tp_smapi.c:452: warning: assignment makes pointer from integer without a cast
/usr/src/tp_smapi-0.02/tp_smapi.c:458: error: dereferencing pointer to incomplete type
/usr/src/tp_smapi-0.02/tp_smapi.c:466: warning: implicit declaration of function 'platform_device_unregister'
/usr/src/tp_smapi-0.02/tp_smapi.c: In function 'tp_exit':
/usr/src/tp_smapi-0.02/tp_smapi.c:478: error: dereferencing pointer to incomplete type
make[2]: *** [/usr/src/tp_smapi-0.02/tp_smapi.o] Error 1
make[1]: *** [_module_/usr/src/tp_smapi-0.02] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.15-rc3'
make: *** [tp_smapi.ko] Error 2


> But even after
> > 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
> [snip]
> > looks like our older thinkpads need other functions.
> 
> OK, that's a real SMAPI error specific to this function. Can you
> control charge threshold under Windows?

yes i can, thats why i was waiting for a linux solution so badly.

> > 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?
> 
> Try "objdump -x TPPWRW32.DLL". It has many exported functions, and the
> name should give you an idea about the capabilities supported by your
> software version. The implementation is split between TPPWRW32.DLL or
> PWRMGRIF.DLL, which contain the logic and function-specific code, and
> a device driver (TPPWRIF.SYS here) which executes the SMAPI code. We
> have the latter pretty much covered, but the former is a big mystery.

You can find the objdump output at http://www.gropp.org/TPPWRW32.DLL.exports
For me SM_GetInhibitChargeStatus and SM_SetChargeCapacityThreshold looks
interesting.

Thanks for your help so far.

Volker Gropp