Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions iio-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
21 changes: 20 additions & 1 deletion iio-client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
121 changes: 9 additions & 112 deletions sensor_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

Expand Down