OSDN Git Service

iio_sensors: Add Light sensor sysfs interface and transformation
authorArchana Patni <archana.patni@linux.intel.com>
Fri, 30 May 2014 15:34:43 +0000 (11:34 -0400)
committersuyyala <sridhar.uyyala@intel.com>
Sat, 7 Jun 2014 16:37:28 +0000 (09:37 -0700)
The IIO/HID sensor hub driver publishes the light sensor data using the
IIO_INTENSITY defined in iio industrial-core. This patch adds this
sensor type to the sensor catalogue and adds a corresponding transformation
in transform_sample_ISH function.

This was tested on BDW Wilson Beach (running Intel FW) and on BDW RVP Y
(running STM FW).

Change-Id: Ib0629dca03f8ec645fcd4d5816ee7131e1764e39
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
enumeration.c
transform.c

index a6260c5..d72b023 100644 (file)
@@ -22,6 +22,7 @@ struct sensor_catalog_entry_t sensor_catalog[] = {
        DECLARE_SENSOR3("accel",      SENSOR_TYPE_ACCELEROMETER,  "x", "y", "z")
        DECLARE_SENSOR3("anglvel",    SENSOR_TYPE_GYROSCOPE,      "x", "y", "z")
        DECLARE_SENSOR3("magn",       SENSOR_TYPE_MAGNETIC_FIELD, "x", "y", "z")
+       DECLARE_SENSOR1("intensity",  SENSOR_TYPE_LIGHT,          "both"       )
        DECLARE_SENSOR0("illuminance",SENSOR_TYPE_LIGHT                        )
        DECLARE_SENSOR3("incli",      SENSOR_TYPE_ORIENTATION,    "x", "y", "z")
        DECLARE_SENSOR4("rot",        SENSOR_TYPE_ROTATION_VECTOR,
index 4c7a24b..d1600e9 100644 (file)
@@ -331,6 +331,9 @@ static float transform_sample_ISH(int s, int c, unsigned char* sample_data)
                        }
                        break;
 
+               case SENSOR_TYPE_LIGHT:
+                               return (float) val;
+
                case SENSOR_TYPE_ORIENTATION:
                        return  correction * convert_from_vtf_format(
                                                data_bytes, exponent, val);