diff options
author | Ziyan <jaraidaniel@gmail.com> | 2016-09-22 12:20:22 +0200 |
---|---|---|
committer | Andreas Blaesius <skate4life@gmx.de> | 2016-09-22 19:40:41 +0200 |
commit | 4a1b906e8e9167882d5bb539f9b0cd4f31d4e207 (patch) | |
tree | 10e5e13b9b4d9b603960d2b13c7e5ee982997012 /libsensors/piranha_sensors.c | |
parent | a234348b622d15479c68714c78f9d9193d1345be (diff) | |
download | device_samsung_espressowifi-4a1b906e8e9167882d5bb539f9b0cd4f31d4e207.zip device_samsung_espressowifi-4a1b906e8e9167882d5bb539f9b0cd4f31d4e207.tar.gz device_samsung_espressowifi-4a1b906e8e9167882d5bb539f9b0cd4f31d4e207.tar.bz2 |
libsensors: commonize light sensor handlers, fix GP2A conversion
Change-Id: I8f98e17485534147cdbfdb85e7230ef7b6496d2e
Diffstat (limited to 'libsensors/piranha_sensors.c')
-rw-r--r-- | libsensors/piranha_sensors.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/libsensors/piranha_sensors.c b/libsensors/piranha_sensors.c index b4c2814..38d999e 100644 --- a/libsensors/piranha_sensors.c +++ b/libsensors/piranha_sensors.c @@ -49,18 +49,13 @@ struct sensor_t piranha_sensors[] = { { "YAS Orientation Sensor", "Yamaha Corporation", 1, SENSOR_TYPE_ORIENTATION, SENSOR_TYPE_ORIENTATION, 360.0f, 0.1f, 0.0f, 10000, 0, 0, 0, 0, 0, SENSOR_FLAG_CONTINUOUS_MODE, {0}, }, -/* P51xx only */ - { "BH1721 Light Sensor", "ROHM", 1, SENSOR_TYPE_LIGHT, - SENSOR_TYPE_LIGHT, 0.0f, 0.0f, 0.0f, 0, - 0, 0, 0, 0, 0, SENSOR_FLAG_CONTINUOUS_MODE, {0}, }, -/* ---------- */ -/* P31xx only */ - { "GP2A Light Sensor", "Sharp", 1, SENSOR_TYPE_LIGHT, +/* To be changed during the initialization process */ + { "Light Sensor", "Dummy", 1, SENSOR_TYPE_LIGHT, SENSOR_TYPE_LIGHT, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0, 0, 0, SENSOR_FLAG_CONTINUOUS_MODE, {0}, }, /* ---------- */ /* P3100 only */ - { "GP2A Proximity Sensor", "Sharp", 1, SENSOR_TYPE_PROXIMITY, + { "GP2AP002 Proximity Sensor", "Sharp", 1, SENSOR_TYPE_PROXIMITY, SENSOR_TYPE_PROXIMITY, 5.0f, 0.0f, 0.0f, 0, 0, 0, 0, 0, 0, SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ON_CHANGE_MODE, {0}, }, /* ---------- */ @@ -72,12 +67,7 @@ struct piranha_sensors_handlers *piranha_sensors_handlers[] = { &bma250, &yas530, &yas_orientation, -/* P51xx only */ - &bh1721, -/* ---------- */ -/* P31xx only */ - &gp2a_light, -/* ---------- */ + &light, /* P3100 only */ &gp2a_proximity, /* ---------- */ @@ -251,24 +241,25 @@ void piranha_sensors_setup() { ALOGE("Failed to read " DEVICE_VARIANT_SYSFS ", assuming P51xx\n"); strcpy(device, "espresso10"); } - if (f) fclose(f); + if (f) + fclose(f); ALOGD("Device: %s", device); if (strcmp(device, "espresso10") == 0) { /* Device is P51xx */ + piranha_sensors[3].name = "BH1721 Light Sensor"; + piranha_sensors[3].vendor = "ROHM", piranha_sensors_count = 4; } else if (strcmp(device, "espressowifi") == 0) { /* Device is P3110 */ - piranha_sensors[3] = piranha_sensors[4]; - piranha_sensors_handlers[3] = piranha_sensors_handlers[4]; + piranha_sensors[3].name = "AL3201 Light Sensor"; + piranha_sensors[3].vendor = "Lite-On", piranha_sensors_count = 4; } else { /* Device is P3100 */ - piranha_sensors[3] = piranha_sensors[4]; - piranha_sensors_handlers[3] = piranha_sensors_handlers[4]; - piranha_sensors[4] = piranha_sensors[5]; - piranha_sensors_handlers[4] = piranha_sensors_handlers[5]; + piranha_sensors[3].name = "GP2AP002 Light Sensor"; + piranha_sensors[3].vendor = "Sharp", piranha_sensors_count = 5; } |