diff --git a/iio-client.cpp b/iio-client.cpp index 7e95127..cebd5a2 100644 --- a/iio-client.cpp +++ b/iio-client.cpp @@ -29,15 +29,11 @@ #include "iio-client.h" -struct idMap iM[MAX_SENSOR] = {{"accel_3d", 0, SENSOR_TYPE_ACCELEROMETER}, - {"incli_3d", 1, SENSOR_TYPE_LINEAR_ACCELERATION}, - {"gravity", 2, SENSOR_TYPE_GRAVITY}, - {"dev_rotation", 3, SENSOR_TYPE_ROTATION_VECTOR}, - {"magn_3d", 4, SENSOR_TYPE_MAGNETIC_FIELD}, - {"geomagnetic_orientation", 5, SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR}, - {"relative_orientation", 6, SENSOR_TYPE_GAME_ROTATION_VECTOR}, - {"gyro_3d", 7, SENSOR_TYPE_GYROSCOPE}, - {"als", 8, SENSOR_TYPE_LIGHT}}; +struct idMap iM[MAX_SENSOR] = { + {"accel_3d", 0, SENSOR_TYPE_ACCELEROMETER}, + {"als", 1, SENSOR_TYPE_LIGHT}, + {"prox", 2, SENSOR_TYPE_PROXIMITY} +}; iioClient::iioClient() { diff --git a/iio-client.h b/iio-client.h index b954e23..9d2da00 100644 --- a/iio-client.h +++ b/iio-client.h @@ -31,7 +31,26 @@ #include "custom-libiio-client/iio.h" -#define MAX_SENSOR 9 +struct iio_channel { + struct iio_device *dev; + struct iio_channel_pdata *pdata; + void *userdata; + + bool is_output; + bool is_scan_element; + struct iio_data_format format; + char *name, *id; + long index; + enum iio_modifier modifier; + enum iio_chan_type type; + + struct iio_channel_attr *attrs; + unsigned int nb_attrs; + + unsigned int number; +}; + +#define MAX_SENSOR 3 struct idMap { const char *name; diff --git a/sensor_hal.cpp b/sensor_hal.cpp index bb6d760..615bd06 100644 --- a/sensor_hal.cpp +++ b/sensor_hal.cpp @@ -54,137 +54,35 @@ static const struct sensor_t sSensorList[MAX_SENSOR] = { SENSOR_FLAG_CONTINUOUS_MODE, {}, }, - {"incli_3d", - "Intel", - 1, - 1, - SENSOR_TYPE_LINEAR_ACCELERATION, - 1000, - 0.1, - 0.0, - 0, - 0, - 0, - "android.sensor.inclinometer", - "", - 20000, - SENSOR_FLAG_CONTINUOUS_MODE, - {}, - }, - {"gravity", - "Intel", - 1, - 2, - SENSOR_TYPE_GRAVITY, - 1000, - 0.1, - 0.0, - 0, - 0, - 0, - "android.sensor.gravity", - "", - 20000, - SENSOR_FLAG_CONTINUOUS_MODE, - {}, - }, - {"dev_rotation", - "Intel", - 1, - 3, - SENSOR_TYPE_ROTATION_VECTOR, - 1000, - 0.1, - 0.0, - 0, - 0, - 0, - "android.sensor.dev_rotation", - "", - 20000, - SENSOR_FLAG_CONTINUOUS_MODE, - {}, - }, - {"magn_3d", - "Intel", - 1, - 4, - SENSOR_TYPE_MAGNETIC_FIELD, - 1000, - 0.1, - 0.0, - 0, - 0, - 0, - "android.sensor.magn_3d", - "", - 20000, - SENSOR_FLAG_CONTINUOUS_MODE, - {}, - }, - {"geomagnetic_orientation", - "Intel", - 1, - 5, - SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR, - 100, - 0.1, - 0.0, - 0, - 0, - 0, - "android.sensor.geomagnetic_orientation", - "", - 20000, - SENSOR_FLAG_CONTINUOUS_MODE, - {}, - }, - {"relative_orientation", + {"Ambient light sensor", "Intel", 1, - 6, - SENSOR_TYPE_GAME_ROTATION_VECTOR, - 100, - 0.1, - 0.0, - 0, - 0, - 0, - "android.sensor.relative_orientation", - "", - 20000, - SENSOR_FLAG_CONTINUOUS_MODE, - {}, - }, - {"gyro_3d", - "Intel", 1, - 7, - SENSOR_TYPE_GYROSCOPE, + SENSOR_TYPE_LIGHT, 100, 0.1, 0.0, 0, 0, 0, - "android.sensor.gyro_3d", + "android.sensor.als", "", 20000, - SENSOR_FLAG_CONTINUOUS_MODE, + SENSOR_FLAG_ON_CHANGE_MODE, {}, }, - {"Ambient light sensor", + {"Proximity sensor", "Intel", 1, - 8, - SENSOR_TYPE_LIGHT, + 2, + SENSOR_TYPE_PROXIMITY, 100, 0.1, 0.0, 0, 0, 0, - "android.sensor.als", + "android.sensor.proxy", "", 20000, SENSOR_FLAG_ON_CHANGE_MODE, @@ -243,8 +141,7 @@ static int poll__poll(struct sensors_poll_device_t* dev, data[i].meta_data.what = META_DATA_FLUSH_COMPLETE; } - evCount = MAX_SENSOR; - } else { + evCount = MAX_SENSOR; } else { evCount = iioc.getPollData(data); }