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

Shem Multinymous linux-thinkpad@linux-thinkpad.org
Mon, 5 Dec 2005 02:13:04 +0200


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

But even after
> cat /sys/devices/platform/smapi/*_charge_thresh
> cat: /sys/devices/platform/smapi/start_charge_thresh: Function not implem=
ented
> cat: /sys/devices/platform/smapi/stop_charge_thresh: Function not impleme=
nted
[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?

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

As for figuring out other functions: if you clicked on the wrong=20
EULA, you might be limited to employing divine inspiration.Otherwise,
In the absense of documentation, I can think of two ways to do that.
One is to glean it from code in the DLL. The other is to trigger the
relevant functionality under Windows and monitor the resulting  SMAPI
calls, either at the level of device driver calls, or by setting a
hardware breakpoint in the middle of the SMAPI request (e.g., on
writes to port 0x4F - look at drivers/char/mwave/smapi.c for an
example of what that code looks like when written by IBM) and logging
the values of the registers going in and out.

For examples of what the SMAPI function interfaces look like, you can
see the old (and irrelevant given ACPI) SMAPI specs for the ThinkPad
770, in the second half of
<http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=3DPFAN-3TUQ=
QD>.
The "thinkpad" module is based on that. But note that somewhere
between that and now they changed from a interface using a function
call to a spooky interface which triggers the SMAPI BIOS by writing to
a couple of IO ports.

  Shem