Loading services/sensorservice/SensorDevice.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -226,17 +226,24 @@ ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) { buffer[pollsDone].acceleration = oldBuffer.vector; buffer[pollsDone].temperature = oldBuffer.temperature; LOGV("Adding results for sensor %d", buffer[pollsDone].sensor); /* The ALS and PS sensors only report values on change, * instead of a data "stream" like the others. So don't wait * for the number of requested samples to fill, and deliver * it immediately */ if (sensorType == SENSOR_TYPE_PROXIMITY) { #ifdef FOXCONN_SENSORS /* Fix ridiculous API breakages from FIH. */ /* These idiots are returning -1 for FAR, and 1 for NEAR */ if (sensorType == SENSOR_TYPE_PROXIMITY) { if (buffer[pollsDone].distance > 0) { buffer[pollsDone].distance = 0; } else { buffer[pollsDone].distance = 1; } } #endif return pollsDone+1; } else if (sensorType == SENSOR_TYPE_LIGHT) { return pollsDone+1; } pollsDone++; } return pollsDone; Loading Loading
services/sensorservice/SensorDevice.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -226,17 +226,24 @@ ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) { buffer[pollsDone].acceleration = oldBuffer.vector; buffer[pollsDone].temperature = oldBuffer.temperature; LOGV("Adding results for sensor %d", buffer[pollsDone].sensor); /* The ALS and PS sensors only report values on change, * instead of a data "stream" like the others. So don't wait * for the number of requested samples to fill, and deliver * it immediately */ if (sensorType == SENSOR_TYPE_PROXIMITY) { #ifdef FOXCONN_SENSORS /* Fix ridiculous API breakages from FIH. */ /* These idiots are returning -1 for FAR, and 1 for NEAR */ if (sensorType == SENSOR_TYPE_PROXIMITY) { if (buffer[pollsDone].distance > 0) { buffer[pollsDone].distance = 0; } else { buffer[pollsDone].distance = 1; } } #endif return pollsDone+1; } else if (sensorType == SENSOR_TYPE_LIGHT) { return pollsDone+1; } pollsDone++; } return pollsDone; Loading