From: Bastien Nocera <hadess@hadess.net>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org,
Lennart Poettering <lennart@poettering.net>,
Cosimo Cecchi <cosimoc@gnome.org>
Subject: Re: Kernel wishlist item: Better IIO API
Date: Thu, 13 Nov 2014 21:05:05 +0100 [thread overview]
Message-ID: <1415909105.30887.3.camel@hadess.net> (raw)
In-Reply-To: <54513238.6050903@metafoo.de>
On Wed, 2014-10-29 at 19:30 +0100, Lars-Peter Clausen wrote:
<snip>
> The sysfs ABI is not meant to be self documenting and it is not
> undocumented. The documentation for the different attributes can be found in
> Documentation/ABI/testing/sysfs-bus-iio[1].
<snip>
> I can understand your frustration. A API that is not usable in a generic way
> is not really useful. So we should try to fix that, but we are bound by the
> framework itself and can't just throw everything away.
I'll go back to this e-mail, and start again with very concrete examples
of my problems. I'm looking for shorter term gains here, while you can
look at my questions as inspiration for what needs fixing longer term :)
My goal is to move iio-sensor-proxy[1] into systemd's codebase, probably
in logind. I know of two different "types" of sensors that I'd like to
support, and 2 very different types of drivers.
The driver used in the Lenovo Yoga Pros (hid-sensor-accel-3d), which I
used to write the iio-sensor-proxy, requires the following procedure to
be used:
- find the accelerometer iio device (with the "accel_3d" name)
- find the associated trigger
- enable the sensors by writing to some files in scan_elements/
- enable the ring buffer by writing to buffer/enable
- enable the trigger found above by writing to trigger/current_trigger
- parse the files in scan_elements/ to find the channel array
- find the scale of each axis
- on some variants, tweak the hysteresis [2] to trigger changes
- and then read from the ring buffer on a regular basis, parse those
buffers, scale them, and we finally have the 3 dimensions we needed
The driver used in the Onda tablet I have is far less featureful.
- find the accelerometer iio device (this time called "i2c-SMO8500:00")
- build the channel array (?? I haven't found how)
- read the scale of each axis
- read directly from the sysfs files for each axis (?? surely not) on a
regular basis, scale the values, and we have the 3 dimensions
Is this at all correct? Is there documentation (the sysfs-bus-iio
doesn't tell me how to use this "API") that's available somewhere else,
or is there a more turn-key user-space library available?
Cheers
(I've been told that the Yoga should probably use the quaternion sensor
instead, it's planned, and so is writing user-space front-ends for the
compass in some devices).
[1]: https://github.com/hadess/iio-sensor-proxy
[2]: https://github.com/hadess/iio-sensor-proxy/issues/1#issuecomment-54536393
next prev parent reply other threads:[~2014-11-13 20:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 14:30 Kernel wishlist item: Better IIO API Bastien Nocera
2014-10-29 17:21 ` Lars-Peter Clausen
2014-10-29 17:33 ` Bastien Nocera
2014-10-29 17:39 ` Lars-Peter Clausen
2014-10-29 17:47 ` Bastien Nocera
2014-10-29 18:30 ` Lars-Peter Clausen
2014-11-03 23:01 ` Bastien Nocera
2014-11-04 7:52 ` Jonathan Cameron
2014-11-04 8:18 ` Daniel Baluta
2014-11-04 8:27 ` Bastien Nocera
2014-11-04 8:37 ` Daniel Baluta
2014-11-04 8:45 ` Bastien Nocera
2014-11-04 8:56 ` Daniel Baluta
2014-11-06 14:55 ` Bastien Nocera
2014-11-13 20:05 ` Bastien Nocera [this message]
2014-11-16 22:12 ` Jonathan Cameron
2014-11-16 22:42 ` Bastien Nocera
2014-11-17 13:34 ` Jonathan Cameron
2015-03-21 16:08 ` Elad Alfassa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415909105.30887.3.camel@hadess.net \
--to=hadess@hadess.net \
--cc=cosimoc@gnome.org \
--cc=lars@metafoo.de \
--cc=lennart@poettering.net \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox