All of lore.kernel.org
 help / color / mirror / Atom feed
From: Reyad Attiyat <reyad.attiyat@gmail.com>
To: Bastien Nocera <hadess@hadess.net>
Cc: linux-iio@vger.kernel.org,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: User-space API for accelerometer(s)?
Date: Wed, 18 Jun 2014 18:31:29 -0500	[thread overview]
Message-ID: <CA+BWVUSqrJhFwKXHL5q=mwcxmasfkpNB6EqEXC6jPfg0ytOVzA@mail.gmail.com> (raw)
In-Reply-To: <1403100542.30918.29.camel@nuvo>

Hello Bastien Nocera,

I'm not the best person to answer your questions but I will try and
help. The best people to talk to would be Jonathan Cameron, the IIO
maintainer, and Srinivas Pandruvada, the author of the hid-sensor-hub
device drivers. I have CC'ed them for you to hopefully get a better
response than what I can offer.

Your device uses the same sensor hub, over usb, as my device does. I
have a Microsoft Surface and it also uses many of the sensors found on
the Lenovo Yoga.

> So, my question regarding the IIO user-space API is:
> is it possible to make the IIO accelerometer send out a kevent when the
> orientation changes in a major way (using triggers?) or does user-space
> need to poll the device instead?

Of course it's possible but this does not occur in the current hid
sensor hub drivers, from my understanding of the code. You should
probably check out the current documentation on the IIO sysfs user
interface:
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio

These outline the possible attributes sysfs offers. As of now the only
ones that are found on the hid sensor hub devices is _raw as of 3.16
and _scale, _offset, _sampling_frequency, _hysteresis. The raw
attribute lets you read the data that is at the top of the iio buffer.
As you can see in the documentation there are many events support by
other drivers that could possible be implemented by the hid-sensor-hub
devices.

IIO devices use a buffer that have a fixed size. It can be enabled
with the sysfs interface. An example of this can be found in the
kernel (drivers/staging/iio/iio_simple_dummy_buffer.c) there is also
additional documentation there as well as dummy drivers.

To use these interfaces in user space, or in the context of GNOME
desktop, I think you would need to poll the iio buffer for new data
and calculate the changes that way. The iio subsystem does support
events but you would need to add these to the hid-sensor-hub devices
and do the calculations for each event. This would allow you to poll
for these iio events instead of polling the buffer.

Hope this helps,
Reyad Attiyat

  reply	other threads:[~2014-06-18 23:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 14:09 User-space API for accelerometer(s)? Bastien Nocera
2014-06-18 23:31 ` Reyad Attiyat [this message]
2014-06-18 23:45   ` Srinivas Pandruvada
2014-06-19 11:20     ` Bastien Nocera
2014-06-21 12:01       ` Jonathan Cameron
2014-06-21 12:37         ` Bastien Nocera
2014-06-21 16:26           ` Srinivas Pandruvada
2014-07-01 12:10         ` Bastien Nocera
2014-07-03 17:51           ` Jonathan Cameron
2014-07-03 17:58             ` Lars-Peter Clausen
2014-07-04  9:35             ` Bastien Nocera
2014-07-09 14:33             ` Bastien Nocera
2014-07-09 14:54               ` Peter Meerwald
2014-07-09 22:16                 ` Bastien Nocera
2014-07-10  1:38                   ` Peter F. Patel-Schneider
2014-07-10 15:04                     ` Srinivas Pandruvada
2014-07-23 12:19                       ` Bastien Nocera
2014-07-23 13:02                         ` Srinivas Pandruvada
2014-07-23 16:51                           ` Bastien Nocera

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='CA+BWVUSqrJhFwKXHL5q=mwcxmasfkpNB6EqEXC6jPfg0ytOVzA@mail.gmail.com' \
    --to=reyad.attiyat@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=hadess@hadess.net \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.