Re: Kernel wishlist item: Better IIO API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux