Questions: IIO type for absorbance and float values in channels?

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

 



Hi all,

I'm currently working on a linux kernel driver for a new sensor design. It's a
special kind of light sensor that measures the reflection of emitted light.

I'm trying to fit this type of sensor into the IIO subsystem but I hit some
issues.


Question 1:

The sensor measures the absorbance[1] of a material. It's the negative
logarithmic quotient of the received and emitted light. It's a unit-less value.

As far as I can see there is currently no predefined IIO type in the kernel for
this.  I have search the list [2], but nothing matches.

Do I overlook something or what channel type should I use for this sensor
measurement value?


Question 2:

The sensor effectively returns a float value of the measurement. I grepped trough
the existing IIO drivers, but there seems only one driver that deals with float
values.  The sps30 driver[3] gets a float from the device, but converts it to a
integer value before passing it to the IIO subsystem.

I know that it's possible to provide a 'scale' attribute per channel to
userspace[4], which can be a float point number. So effectively the result of a
measurement can be a float-point value after it's computed in userspace.

Are floats really not supported as channel values? What is the recommend
approach to deal with these measurement values?


Question 3:

Is there another kernel subsystem/UAPI that fits this type of sensor
better?  (My guess would be: No, IIO is the correct subsystem.)


Thanks a lot for answering my question.


Kind regards,
Stefan

[1]: https://en.wikipedia.org/wiki/Absorbance
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/iio/types.h#n14
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/chemical/sps30.c#n39
[4]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/dummy/iio_simple_dummy.c#n122



[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