50000.0f, 1.0f, 0.75f, 0, {}
,
};
-const int retry_cnt = 5;
+const int retry_cnt = 10;
ALSSensor::ALSSensor(): SensorIIODev("als", "in_intensity_scale", "in_intensity_offset", "in_intensity_", retry_cnt){
ALOGV(">>ALSSensor 3D: constructor!");
const long HID_USAGE_SENSOR_UNITS_G = 0x1A;
const long HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD = (0x11, 0xE0);
-const int retry_cnt = 5;
+const int retry_cnt = 10;
AccelSensor::AccelSensor(): SensorIIODev("accel_3d", "in_accel_scale", "in_accel_offset", "in_accel_", retry_cnt){
ALOGV(">>AccelSensor 3D: constructor!");
"HID_SENSOR Compass 3D", "Intel", 1, SENSORS_MAGNETIC_FIELD_HANDLE,
SENSOR_TYPE_MAGNETIC_FIELD, RANGE_M, RESOLUTION_M, 0.1f, 23000, {}
};
-const int retry_cnt = 5;
+const int retry_cnt = 10;
CompassSensor::CompassSensor(): SensorIIODev("magn_3d", "in_magn_scale", "in_magn_offset", "in_magn_", retry_cnt){
ALOGV(">>ComassSensor 3D: constructor!");
};
const int HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND = 0x15;
const int HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND = 0xF012;
-const int retry_cnt = 5;
+const int retry_cnt = 10;
GyroSensor::GyroSensor(): SensorIIODev("gyro_3d", "in_anglvel_scale", "in_anglvel_offset", "in_anglvel_", retry_cnt){
ALOGV("GyroSensor: constructor\n");
return 0;
}
if (enabled){
+ // QUIRK: some sensor hubs need to be turned on and off and on
+ // before sending any information. So we turn it on and off first
+ // before enabling again later in this function.
+ EnableBuffer(1);
+ EnableBuffer(0);
+
if (ReadHIDExponentValue(&unit_expo_value) < 0)
goto err_ret;
if (ReadHIDMeasurmentUnit(&units_value) < 0)
ret = EnableChannels();
if (ret < 0){
ALOGE("ParseIIODirectory Failed due Enable Channels failed\n");
+ if (ret == -EACCES) {
+ // EACCES means the nodes do not have current owner.
+ // Need to retry, or else sensors won't power on.
+ // Other errors can be ignored, as these nodes are
+ // set once, and will return error when set again.
+ return ret;
+ }
}
// Parse the channels and build a list