Skip to contentSkip to conversation

Accelerometer and orientation sensor on Lenovo Ideapad S10-3t

DISCUSSION Alberto Mardegan 5 participants 8 messages May 26, 2011 – Jun 8, 2011 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

Hi all,
I'd like to add support for the accelerometer sensor which is found in
the Lenovo Ideapad S10-3t.

I would use this code as a starting point (kudos to Javier):
http://gitorious.org/iaps/lsrot/blobs/master/lsrot.c
The code uses the WMI interfaces to get notified of coarse orientation changes.
But how should these changes be reported to userspace? Should they go through the input subsystem (I didn't find any suitable key codes to report these events), or via the /sys filesystem? In the latter case, is there a convention on naming and reporting data from devices of this kind?

Secondly, I'd like to add support for reading the accelerometer values, as it's done here (again, kudos to Javier):
http://gitorious.org/iaps/iaps/blobs/master/iaps.c
I know that no one is happy of directly accessing the raw I/O ports, but all my attempts of reading these values through the ACPI interfaces or the EC fields have failed: the fields are always set to 0. So, what I plan to do is to check the DMI information, and if the machine is a S10-3t I would you the code linked above to read and report the accelerometer values. Would that be acceptable?

And finally: should the changes above be made to the existing ideapad-laptop.c file, or should they go to a separate file/module?

TIA,
Alberto

Signature · 1 line
http://blog.mardy.it <- geek in un lingua international!
#1 lore raw
Quoted 8 lines · Alberto Mardegan

I would use this code as a starting point (kudos to Javier):
http://gitorious.org/iaps/lsrot/blobs/master/lsrot.c
The code uses the WMI interfaces to get notified of coarse orientation changes.
But how should these changes be reported to userspace? Should they go through the input subsystem (I didn't find any suitable key codes to report these events), or via the /sys filesystem? In the latter case, is there a convention on naming and reporting data from devices of this kind?

If we're not interested in providing continual fine-grained data then the easiest approach may be to present as an input device and then just send updated values whenever you receive the coarse udpate signal. But you probably want to bring this up on LKML so we can make sure everyone's exposing this in the same way.

Quoted 6 lines

Secondly, I'd like to add support for reading the accelerometer values, as it's done here (again, kudos to Javier):
http://gitorious.org/iaps/iaps/blobs/master/iaps.c
I know that no one is happy of directly accessing the raw I/O ports, but all my attempts of reading these values through the ACPI interfaces or the EC fields have failed: the fields are always set to 0.

Does the accelerometer appear as an ACPI device?

Quoted 2 lines

And finally: should the changes above be made to the existing ideapad-laptop.c file, or should they go to a separate file/module?

ideapad-laptop seems appropriate, unless the accelerometer is its own ACPI device that appears in other hardware as well.

Signature · 1 line
Matthew Garrett | [email protected]
#2 lore raw
Quoted 5 lines · Matthew Garrett

If we're not interested in providing continual fine-grained data then the easiest approach may be to present as an input device and then just send updated values whenever you receive the coarse udpate signal. But you probably want to bring this up on LKML so we can make sure everyone's exposing this in the same way.

OK, I will.

Quoted 5 lines
Quoted 3 lines

I know that no one is happy of directly accessing the raw I/O ports, but all my attempts of reading these values through the ACPI interfaces or the EC fields have failed: the fields are always set to 0.

Does the accelerometer appear as an ACPI device?

No, I think it doesn't. There are some fields in the EC device which might be related to it, but I tried to read them without luck. Here's the DSDT, anyway:
http://www.mardy.it/archivos/DSDT.dsl

Ciao,
Alberto

Signature · 1 line
http://blog.mardy.it <- geek in un lingua international!
#5 lore raw
In reply to Alberto Mardegan
Quoted 9 lines · Alberto Mardegan

Secondly, I'd like to add support for reading the accelerometer values, as it's done here (again, kudos to Javier):
http://gitorious.org/iaps/iaps/blobs/master/iaps.c
I know that no one is happy of directly accessing the raw I/O ports, but all my attempts of reading these values through the ACPI interfaces or the EC fields have failed: the fields are always set to 0. So, what I plan to do is to check the DMI information, and if the machine is a S10-3t I would you the code linked above to read and report the accelerometer values. Would that be acceptable?

I'm wondering if the accelerometer driver is also compatible with the ThinkPad SL laptops. It is said that their firmwares are quite similar to the IdeaPad ones. As they have quasi nothing in common with the normal ThinkPad series there's no support for them in thinkpad-acpi/hdaps/tp_smapi.

I compiled the iaps module and loaded it successfully on my ThinkPad SL. There is also data passed by the driver to the input subsystem, when I move the laptop. Is there a way to validate this data?

Signature · 2 lines
Regards,
Richard Schütz
#6 lore raw
Quoted 11 lines · Richard Schütz
Quoted 9 lines · Alberto Mardegan

Secondly, I'd like to add support for reading the accelerometer values, as it's done here (again, kudos to Javier):
http://gitorious.org/iaps/iaps/blobs/master/iaps.c
I know that no one is happy of directly accessing the raw I/O ports, but all my attempts of reading these values through the ACPI interfaces or the EC fields have failed: the fields are always set to 0. So, what I plan to do is to check the DMI information, and if the machine is a S10-3t I would you the code linked above to read and report the accelerometer values. Would that be acceptable?

Quoted 1 line

I'm wondering if the accelerometer driver is also compatible with the ThinkPad SL laptops. It is said that their firmwares are quite similar to the IdeaPad ones. As they have quasi nothing in common with the normal ThinkPad series there's no support for them in thinkpad-acpi/hdaps/tp_smapi.

So far what I know is SL400 has similar firmware with asus-laptops, and other SL are using thinkpad-acpi.

I have a SL400 and tried to examine the DSDT but found nothing about accelerometer sensor.

Quoted 3 lines

I compiled the iaps module and loaded it successfully on my ThinkPad SL. There is also data passed by the driver to the input subsystem, when I move the laptop. Is there a way to validate this data?

Which SL you have? If we can find out a standard interface, that will be good.

#7 lore raw
Quoted 12 lines · Ike Panhc
Quoted 11 lines · Richard Schütz
Quoted 9 lines · Alberto Mardegan

Secondly, I'd like to add support for reading the accelerometer values, as it's done here (again, kudos to Javier):
http://gitorious.org/iaps/iaps/blobs/master/iaps.c
I know that no one is happy of directly accessing the raw I/O ports, but all my attempts of reading these values through the ACPI interfaces or the EC fields have failed: the fields are always set to 0. So, what I plan to do is to check the DMI information, and if the machine is a S10-3t I would you the code linked above to read and report the accelerometer values. Would that be acceptable?

Quoted 3 lines
Quoted 1 line

I'm wondering if the accelerometer driver is also compatible with the ThinkPad SL laptops. It is said that their firmwares are quite similar to the IdeaPad ones. As they have quasi nothing in common with the normal ThinkPad series there's no support for them in thinkpad-acpi/hdaps/tp_smapi.

So far what I know is SL400 has similar firmware with asus-laptops, and other SL are using thinkpad-acpi.

The EC of the ThinkPad SL laptops is from ASUSTeK as far as I know. At least it looks like that in the DSDT. So asus-laptop handles some hotkeys. No ThinkPad SL can be handled by thinkpad-acpi, because they are totally different.

Features like bluetooth rfkill and accessing the blue LED in the Lenovo Care button are still not supported ([1] can do that, but never was accepted for the kernel).

Quoted 1 line

I have a SL400 and tried to examine the DSDT but found nothing about accelerometer sensor.

There should be an accelerometer in your SL400. Try the driver mentioned in this thread.

Quoted 5 lines
Quoted 3 lines

I compiled the iaps module and loaded it successfully on my ThinkPad SL. There is also data passed by the driver to the input subsystem, when I move the laptop. Is there a way to validate this data?

Which SL you have? If we can find out a standard interface, that will be good.

I have a SL500. It looks like the mailing list disliked my attached DSDT. What are the limitations on this? It is available under [2] now.

[1] https://github.com/tetromino/lenovo-sl-laptop
[2] http://richard.qasl.de/DSDT.dsl

Signature · 2 lines
Regards,
Richard Schütz
#3 lore raw
In reply to Matthew Garrett
Quoted 11 lines · Matthew Garrett
Quoted 8 lines · Alberto Mardegan

I would use this code as a starting point (kudos to Javier):
http://gitorious.org/iaps/lsrot/blobs/master/lsrot.c
The code uses the WMI interfaces to get notified of coarse orientation changes.
But how should these changes be reported to userspace? Should they go through the input subsystem (I didn't find any suitable key codes to report these events), or via the /sys filesystem? In the latter case, is there a convention on naming and reporting data from devices of this kind?

Quoted 6 lines

If we're not interested in providing continual fine-grained data then the easiest approach may be to present as an input device and then just send updated values whenever you receive the coarse udpate signal. But you probably want to bring this up on LKML so we can make sure everyone's exposing this in the same way.

We already had this discussion here:
http://www.spinics.net/lists/platform-driver-x86/msg01850.html
and the conclusion was that if you need to poll the device to get the fined grain data, and you have a separate event(was ACPI hotkey, not WMI) for coarse orientation changes, you should send a KOBJ_CHANGE uevent for that.

IMHO, deciding if we need or not "continual fine-grained data" is policy and up to userspace.

--
Anisse

#4 lore raw
Quoted 6 lines · Anisse Astier

We already had this discussion here:
http://www.spinics.net/lists/platform-driver-x86/msg01850.html
and the conclusion was that if you need to poll the device to get the fined grain data, and you have a separate event(was ACPI hotkey, not WMI) for coarse orientation changes, you should send a KOBJ_CHANGE uevent for that.

Thanks Anisse for pointing that thread out.

Ciao,
Alberto

Signature · 1 line
http://blog.mardy.it <-- geek in un lingua international!