Lines Matching refs:res
166 int res; in MPLSensor() local
385 res = write_sysfs_int(mpu.smd_threshold, motionThreshold); in MPLSensor()
391 res = write_sysfs_int(mpu.pedometer_step_thresh, StepCounterThreshold); in MPLSensor()
838 int res, fd; in loadDMP() local
1047 int res = -1; in onDmp() local
1073 res = 0; //Indicate write successful in onDmp()
1090 res = -1; in onDmp()
1096 res = 0; //DMP already set as requested in onDmp()
1104 return res; in onDmp()
1109 int res = 0; in setDmpFeature() local
1116 res = enableGyro(1); in setDmpFeature()
1117 if (res < 0) { in setDmpFeature()
1118 return res; in setDmpFeature()
1121 res = turnOffGyroFifo(); in setDmpFeature()
1122 if (res < 0) { in setDmpFeature()
1123 return res; in setDmpFeature()
1127 res = enableAccel(1); in setDmpFeature()
1128 if (res < 0) { in setDmpFeature()
1129 return res; in setDmpFeature()
1132 res = turnOffAccelFifo(); in setDmpFeature()
1133 if (res < 0) { in setDmpFeature()
1134 return res; in setDmpFeature()
1139 res = enableGyro(0); in setDmpFeature()
1140 if (res < 0) { in setDmpFeature()
1141 return res; in setDmpFeature()
1145 res = enableAccel(0); in setDmpFeature()
1146 if (res < 0) { in setDmpFeature()
1147 return res; in setDmpFeature()
1157 res = -1; in setDmpFeature()
1160 return res; in setDmpFeature()
1165 int res = 0; in computeDmpState() local
1187 return res; in computeDmpState()
1192 int res = 0; in SetDmpState() local
1195 res = onDmp(dmpState); in SetDmpState()
1196 if (res < 0) in SetDmpState()
1197 return res; in SetDmpState()
1204 res = -1; in SetDmpState()
1206 return res; in SetDmpState()
1217 int res = 0; in computeAndSetDmpState() local
1222 res = SetDmpState(dmpState); in computeAndSetDmpState()
1223 if (res < 0) in computeAndSetDmpState()
1224 return res; in computeAndSetDmpState()
1234 int res = 0; in enablePedIndicator() local
1242 res = -1; // indicate an err in enablePedIndicator()
1243 return res; in enablePedIndicator()
1248 res = enableAccel(1); in enablePedIndicator()
1249 if (res < 0) in enablePedIndicator()
1250 return res; in enablePedIndicator()
1254 res = turnOffAccelFifo(); in enablePedIndicator()
1255 if (res < 0) in enablePedIndicator()
1256 return res; in enablePedIndicator()
1264 res = enableAccel(0); in enablePedIndicator()
1265 if (res < 0) in enablePedIndicator()
1266 return res; in enablePedIndicator()
1274 res = -1; in enablePedIndicator()
1277 return res; in enablePedIndicator()
1283 int res = 0; in checkPedStandaloneBatched() local
1287 res = 1; in checkPedStandaloneBatched()
1289 res = 0; in checkPedStandaloneBatched()
1291 LOGV_IF(ENG_VERBOSE, "HAL:checkPedStandaloneBatched=%d", res); in checkPedStandaloneBatched()
1292 return res; in checkPedStandaloneBatched()
1360 int res = 0; in enablePedStandaloneData() local
1367 res = -1; //Indicate an err in enablePedStandaloneData()
1375 res = -1; //Indicate an err in enablePedStandaloneData()
1384 res = enableAccel(0); in enablePedStandaloneData()
1385 if (res < 0) in enablePedStandaloneData()
1386 return res; in enablePedStandaloneData()
1391 res = enableGyro(0); in enablePedStandaloneData()
1392 if (res < 0) in enablePedStandaloneData()
1393 return res; in enablePedStandaloneData()
1398 res = enableAccel(1); in enablePedStandaloneData()
1399 if (res < 0) in enablePedStandaloneData()
1400 return res; in enablePedStandaloneData()
1404 res = turnOffAccelFifo(); in enablePedStandaloneData()
1405 if (res < 0) in enablePedStandaloneData()
1406 return res; in enablePedStandaloneData()
1410 return res; in enablePedStandaloneData()
1478 int res = 0; in enablePedQuaternionData() local
1485 res = -1; //Indicate an err in enablePedQuaternionData()
1494 res = enableAccel(0); in enablePedQuaternionData()
1495 if (res < 0) in enablePedQuaternionData()
1496 return res; in enablePedQuaternionData()
1501 res = enableGyro(0); in enablePedQuaternionData()
1502 if (res < 0) in enablePedQuaternionData()
1503 return res; in enablePedQuaternionData()
1506 res = write_sysfs_int(mpu.gyro_fifo_enable, 1); in enablePedQuaternionData()
1507 res += write_sysfs_int(mpu.accel_fifo_enable, 1); in enablePedQuaternionData()
1508 if (res < 0) in enablePedQuaternionData()
1509 return res; in enablePedQuaternionData()
1526 res = enableAccel(1); in enablePedQuaternionData()
1527 if (res < 0) in enablePedQuaternionData()
1528 return res; in enablePedQuaternionData()
1531 res = enableGyro(1); in enablePedQuaternionData()
1532 if (res < 0) in enablePedQuaternionData()
1533 return res; in enablePedQuaternionData()
1538 res = turnOffAccelFifo(); in enablePedQuaternionData()
1539 if (res < 0) in enablePedQuaternionData()
1540 return res; in enablePedQuaternionData()
1547 res = turnOffGyroFifo(); in enablePedQuaternionData()
1548 if (res < 0) in enablePedQuaternionData()
1549 return res; in enablePedQuaternionData()
1554 return res; in enablePedQuaternionData()
1560 int res = 0; in setPedQuaternionRate() local
1565 res = write_sysfs_int(mpu.ped_q_rate, 1000000000.f / wanted); in setPedQuaternionRate()
1569 return res; in setPedQuaternionRate()
1606 int res = 0; in enable6AxisQuaternionData() local
1613 res = -1; //Indicate an err in enable6AxisQuaternionData()
1622 res = enableAccel(0); in enable6AxisQuaternionData()
1623 if (res < 0) in enable6AxisQuaternionData()
1624 return res; in enable6AxisQuaternionData()
1629 res = enableGyro(0); in enable6AxisQuaternionData()
1630 if (res < 0) in enable6AxisQuaternionData()
1631 return res; in enable6AxisQuaternionData()
1636 res = write_sysfs_int(mpu.gyro_fifo_enable, 1); in enable6AxisQuaternionData()
1639 res += write_sysfs_int(mpu.accel_fifo_enable, 1); in enable6AxisQuaternionData()
1640 if (res < 0) in enable6AxisQuaternionData()
1641 return res; in enable6AxisQuaternionData()
1649 res = write_sysfs_int(mpu.gyro_fifo_enable, 1); in enable6AxisQuaternionData()
1650 res += write_sysfs_int(mpu.accel_fifo_enable, 1); in enable6AxisQuaternionData()
1651 if (res < 0) in enable6AxisQuaternionData()
1652 return res; in enable6AxisQuaternionData()
1665 res = enableAccel(1); in enable6AxisQuaternionData()
1666 if (res < 0) in enable6AxisQuaternionData()
1667 return res; in enable6AxisQuaternionData()
1670 res = enableGyro(1); in enable6AxisQuaternionData()
1671 if (res < 0) in enable6AxisQuaternionData()
1672 return res; in enable6AxisQuaternionData()
1677 res = turnOffAccelFifo(); in enable6AxisQuaternionData()
1678 if (res < 0) in enable6AxisQuaternionData()
1679 return res; in enable6AxisQuaternionData()
1688 res = turnOffGyroFifo(); in enable6AxisQuaternionData()
1689 if (res < 0) in enable6AxisQuaternionData()
1690 return res; in enable6AxisQuaternionData()
1698 return res; in enable6AxisQuaternionData()
1704 int res = 0; in set6AxisQuaternionRate() local
1709 res = write_sysfs_int(mpu.six_axis_q_rate, 1000000000.f / wanted); in set6AxisQuaternionRate()
1713 return res; in set6AxisQuaternionRate()
1759 int res = 0; in enableQuaternionData() local
1766 res = -1; //Indicates an err in enableQuaternionData()
1776 return res; in enableQuaternionData()
1782 int res = 0; in setQuaternionRate() local
1787 res = write_sysfs_int(mpu.three_axis_q_rate, 1000000000.f / wanted); in setQuaternionRate()
1791 return res; in setQuaternionRate()
1797 int res = 0; in enableDmpPedometer() local
1801 return res; in enableDmpPedometer()
1804 res = masterEnable(0); in enableDmpPedometer()
1805 if (res < 0) { in enableDmpPedometer()
1806 return res; in enableDmpPedometer()
1815 res = -1; // indicate an err in enableDmpPedometer()
1816 return res; in enableDmpPedometer()
1826 res = -1; // indicate an err in enableDmpPedometer()
1827 return res; in enableDmpPedometer()
1855 res = -1; in enableDmpPedometer()
1856 return res; in enableDmpPedometer()
1866 res = -1; in enableDmpPedometer()
1867 return res; in enableDmpPedometer()
1872 if ((res = setDmpFeature(en)) < 0) in enableDmpPedometer()
1873 return res; in enableDmpPedometer()
1875 if ((res = computeAndSetDmpState()) < 0) in enableDmpPedometer()
1876 return res; in enableDmpPedometer()
1879 return res; in enableDmpPedometer()
1882 res = masterEnable(1); in enableDmpPedometer()
1884 return res; in enableDmpPedometer()
1891 int res = 0; in masterEnable() local
1894 res = write_sysfs_int(mpu.master_enable, en); in masterEnable()
1895 return res; in masterEnable()
1902 int res = 0; in enableGyro() local
1907 res = write_sysfs_int(mpu.gyro_enable, en); in enableGyro()
1910 res += write_sysfs_int(mpu.gyro_fifo_enable, en); in enableGyro()
1917 return res; in enableGyro()
1924 int res; in enableLowPowerAccel() local
1927 res = write_sysfs_int(mpu.motion_lpa_on, en); in enableLowPowerAccel()
1930 return res; in enableLowPowerAccel()
1937 int res; in enableAccel() local
1942 res = write_sysfs_int(mpu.accel_enable, en); in enableAccel()
1945 res += write_sysfs_int(mpu.accel_fifo_enable, en); in enableAccel()
1952 return res; in enableAccel()
1959 int res = 0; in enableCompass() local
1962 res = mCompassSensor->enable(ID_RM, en); in enableCompass()
1964 res = mCompassSensor->enable(ID_M, en); in enableCompass()
1966 if (en == 0 || res != 0) { in enableCompass()
1967 LOGV_IF(EXTRA_VERBOSE, "HAL:MPL:inv_compass_was_turned_off %d", res); in enableCompass()
1971 return res; in enableCompass()
1979 int res = 0; in enablePressure() local
1982 res = mPressureSensor->enable(ID_PS, en); in enablePressure()
1984 return res; in enablePressure()
1993 int res = 0; in enableBatch() local
1995 res = write_sysfs_int(mpu.batchmode_timeout, timeout); in enableBatch()
1997 res = write_sysfs_int(mpu.six_axis_q_on, 0); in enableBatch()
1998 res = write_sysfs_int(mpu.ped_q_on, 0); in enableBatch()
1999 res = write_sysfs_int(mpu.step_detector_on, 0); in enableBatch()
2000 res = write_sysfs_int(mpu.step_indicator_on, 0); in enableBatch()
2007 return res; in enableBatch()
2130 inv_error_t res = -1; local
2149 res = masterEnable(0);
2150 if(res < 0) {
2151 return res;
2161 res = enableGyro(!!(sensors & INV_THREE_AXIS_GYRO));
2162 if(res < 0) {
2163 return res;
2175 res = enableAccel(!!(sensors & INV_THREE_AXIS_ACCEL));
2176 if(res < 0) {
2177 return res;
2189 … res = enableCompass(!!(sensors & INV_THREE_AXIS_COMPASS), changed & (1 << RawMagneticField));
2190 if(res < 0) {
2191 return res;
2204 res = enablePressure(!!(sensors & INV_ONE_AXIS_PRESSURE));
2205 if(res < 0) {
2206 return res;
2223 res = masterEnable(0);
2224 if(res < 0) {
2225 return res;
2280 res = -1;
2282 return res;
2293 res = enableAccel(on);
2294 if(res < 0) {
2295 return res;
2299 res = turnOffAccelFifo();
2301 if(res < 0) {
2302 return res;
2347 res = masterEnable(1);
2348 if(res < 0)
2349 return res;
2351 return res;
2419 int res = 0; local
2427 res = masterEnable(0);
2428 if (res < 0) {
2429 return res;
2490 res = onDmp(1);
2491 if (res < 0) {
2492 return res;
2504 res = -1;
2506 return res;
2511 res = onDmp(0);
2512 if (res < 0) {
2513 return res;
2527 res = -1;
2535 return res;
2609 int res = inv_store_calibration(); local
2610 if (res) {
3538 int res = update_delay(); local
3540 return res;
3547 int res = 0; local
3611 res = write_attribute_sensor(tempFd, 1000000000.f / tempWanted);
3612 LOGE_IF(res < 0, "HAL:sampling frequency update delay error");
3676 res = write_attribute_sensor(tempFd, 1000000000.f / gyroRate);
3677 if(res < 0) {
3688 res = write_attribute_sensor(tempFd,
3690 LOGE_IF(res < 0, "HAL:ACCEL update delay error");
3697 res = write_attribute_sensor(tempFd, 1000000000.f / accelRate);
3698 LOGE_IF(res < 0, "HAL:ACCEL update delay error");
3739 res = write_attribute_sensor(tempFd, 1000000000.f / wanted);
3740 LOGE_IF(res < 0, "HAL:GYRO update delay error");
3762 res = write_attribute_sensor(tempFd, wanted / 1000000L);
3766 res = write_attribute_sensor(tempFd, 1000000000.f/wanted);
3768 LOGE_IF(res < 0, "HAL:ACCEL update delay error");
3805 LOGE_IF(res < 0, "HAL:PRESSURE update delay error");
3821 res = masterEnable(1);
3822 if(res < 0)
3823 return res;
3827 res = masterEnable(1);
3828 if(res < 0)
3829 return res;
3834 return res;
4692 int i, res = 0, tempFd; local
4695 res += write_sysfs_int(mpu.accel_fifo_enable, 0);
4696 return res;
4702 int i, res = 0, tempFd; local
4705 res += write_sysfs_int(mpu.gyro_fifo_enable, 0);
4706 return res;
4712 int res = 0; local
4716 return res;
4719 res = masterEnable(0);
4720 if (res < 0)
4721 return res;
4729 res = -1; // indicate an err
4730 return res;
4734 res = enableAccel(1);
4735 if (res < 0)
4736 return res;
4740 res = turnOffAccelFifo();
4741 if (res < 0)
4742 return res;
4749 res = -1;
4763 res = enableAccel(0);
4764 if (res < 0)
4765 return res;
4773 res = -1;
4780 if ((res = computeAndSetDmpState()) < 0)
4781 return res;
4784 res = masterEnable(1);
4786 return res;
5874 int res = 0; local
5877 return res;
6096 res = masterEnable(0);
6097 if (res < 0) {
6098 return res;
6222 res = -1;
6232 return res;
6243 int res = 0; local
6273 status = read_sysfs_int(mpu.flush_batch, &res);
6279 if (res == 0) {
6283 …LOGV_IF(ENG_VERBOSE, "HAl:flush - mFlushSensorEnabledVector=%d res=%d status=%d", handle, res, sta…
6291 int res = 0; local
6334 return res;
6420 int res = 0; local
6525 int res = 0; local
6596 int res = 0; local
6600 return res;
6603 res = masterEnable(0);
6604 if (res < 0)
6605 return res;
6614 res = -1; //Indicate an err
6628 if ((res = setDmpFeature(en)) < 0)
6629 return res;
6631 if ((res = computeAndSetDmpState()) < 0)
6632 return res;
6635 return res;
6638 res = masterEnable(1);
6640 return res;
6684 int res = 0; local
6694 res = write_sysfs_int(mpu.smd_delay_threshold, delayThreshold1);
6695 if (res == 0) {
6698 res = write_sysfs_int(mpu.smd_delay_threshold2, delayThreshold2);
6700 if (res == 0) {
6703 res = write_sysfs_int(mpu.smd_threshold, motionThreshold);
6710 return res;
6717 int res = 0; local
6819 int res = 0; local
6832 res = write_attribute_sensor(tempFd, 1000000000.f / gyroRate);
6833 if(res < 0) {
6842 res = write_attribute_sensor(tempFd, 1000000000.f / accelRate);
6843 LOGE_IF(res < 0, "HAL:ACCEL update delay error");
6862 return res;
6871 int res = 0; local
6882 return res;
6889 int res = 0; local
6926 int res = 0; local
6961 res = write_attribute_sensor(tempFd, 1000000000.f / wanted);
6962 LOGE_IF(res < 0, "HAL:sampling frequency update delay error");
6969 res = write_attribute_sensor(tempFd, 1000000000.f / gyroRate);
6970 if(res < 0) {
6979 res = write_attribute_sensor(tempFd, 1000000000.f / accelRate);
6980 LOGE_IF(res < 0, "HAL:ACCEL update delay error");
7008 return res;
7017 int res = 0; local
7024 res = calctDataRates(&resetRate, &gyroRate, &accelRate, &compassRate, &pressureRate);
7025 if (res)
7030 return res;