[ltp] getting hdaps up and running on the w530

Evgeni Golov linux-thinkpad@linux-thinkpad.org
Mon, 14 Apr 2014 08:09:20 +0200


On Mon, Apr 14, 2014 at 02:48:27PM +0900, Raider Sail wrote:

> I'm interested in getting the HDAPS module up and running on the W530. 
> I need help getting started. Here's what I've learned so far. Please 
> post what you know in response, or point me to better information. 
> Peter Zhang at Lenovo has graciously agreed to forward technical 
> requests to the Lenovo developers. I would like help. Someone more 
> experienced with the code could contact him instead of me, of course.

I asked for hdaps docs in Message-ID: 
<20140221095309.GA1347@dorei.kerker.die-welt.net> and Peter answered 
they are working on drivers. Didn't hear anything more yet.

> I'm on Fedora 20, kernel 3.13.9-200.fc20.x86_64. For the latest (?) 
> hdaps I'm using https://github.com/evgeni/tp_smapi.git.
> Issues I see:
> This kernel has a working thinkpad-acpi module but not thinkpad-ec. 
> The hdaps module from tp_smapi 0.41. depends on thinkpad-ec.The APS 
> hardware may have changed.hdapsd may require updates including /sys 
> interface changes and systemd integration, but also including the 
> protocol used if #2 is significant.

tp-acpi and tp-smapi have nothing (!) in common. tp-acpi allows the use 
of IBM/Lenovo specific ACPI calls on ThinkPads, whereas tp-smapi allows 
the use of the embedded-controller directly.

>From what I know, Lenovo has changed the EC in the *20ies Thinkpads and
then in the *30ies again. From a quick poking around, there is no 
(accessible the old way) EC in the *30ies anymore. So tp-smapi has no
way for working there.

> On (1) I'm not certain what is necessary or best: fix thinkpad-ec or 
> simply refit hdaps to use features added to thinkpad-acpi?

We have a hdaps in-kernel, so the best solution would be getting docs
for the device and integrating support into the existing hdaps module.
Then we can probably let tp-smapi to rest, finally.

> On (2) the W530 accelerometer appears to act the same way, producing 
> X/Y/status output, using the Windows demo C# code that used to be
> available via B. Suter's Stanford page (and loads sensor.dll). See

Interesting. sensor.dll is something Lenovo-ish I guess?

> Before asking I think we should have a strategy in mind for updating the code.
> Notes:

> Loading hdaps.ko from tp-smapi 0.41 requires thinkpad_ec.ko to be 
> loaded since that provides the read/write mechanism. I see the 
> following error when insmod'ing thinkpad_ec.ko 0.41 on :
>     [153711.751399] thinkpad_ec: thinkpad_ec_request_row: arg0 rejected: (0x01:0x00)->0x00    [153711.751403] thinkpad_ec: thinkpad_ec_read_row: failed requesting row: (0x01:0x00)->0xfffffffb    [153711.751405] thinkpad_ec: initial ec test failed

Yepp, no controller, no reads. Easy :)

> The native kernel's hdaps.ko (although not recommended by the current tp-smapi maintainers) doesn't load. Its error:
>     [154183.223065] hdaps: supported laptop not found!    [154183.223069] hdaps: driver init failed (ret=-19)!

It's not recommended because it lacks both features (event interface) 
and hardware support (newer models). I'd love to get both into the 
kernel and deprecate the tp-smapi version.

> There is a tecnique for learning the ports and values read/written 
> using Windows Debugger, as Mark A. Smith did as described in 
> https://web.archive.org/web/20120601001710/http://www.almaden.ibm.com/cs/people/marksmith/tpaps.html
> This seems harder than asking Lenovo engineering for a small amount of technical assistance.

I'd prefer pure docs here ;)

> On (3) I assume the hdapsd available in Fedora 20 is from 
> http://sourceforge.net/projects/hdaps/files/hdapsd/$ sudo hdapsd 
> -Vhdapsd 20090401
> $ sudo hdapsd -d sdaMon Apr 14 14:34:07 2014: Starting hdapsdMon Apr 14 14:34:07 2014: Could not find a suitable interface
> The missing ACPI interface files appear to be: 
> /sys/devices/platform/hdaps/position and or 
> /sys/module/hdaps_ec/initstate but there are several failed open(2) 
> system calls in strace(1) output.

hdapsd should be fine here, as soon we can read the device, hdapsd will 
hapilly park your drive.

> If someone else with more experience wants to work on this with me, 
> that would be good. I can dedicate my W530 to testing.

Have access to enough new-style thinkpads, but refuse to reverse 
engeneer stuff. Docs docs docs please :)

Evgeni, with his hdapsd and tp-smapi maintainer hats on.

Bruce Schneier can read and understand Perl programs.