void dumpData(void)
{
    if (flag & 0x20) {
        float data[6];
        long fixedData[6];
        int ii;
	int accuracy;

#if TEST_COMPASS_ACCURACY
	float magnetic[3];
	CALL_N_CHECK(inv_get_compass_data(fixedData));
	CALL_N_CHECK(inv_get_compass_accuracy(&accuracy));
	
	printf("Magnetic:  %ld  %ld  %ld : accuracy is %d\n", fixedData[0], fixedData[1], fixedData[2], accuracy);
//	printf("Magnetic:  %12.4f %12.4f %12.4f : accuracy is %d\n", magnetic[0], magnetic[1], magnetic[2], accuracy);

#endif
	
#if TEST_RAW_ACCEL_GYRO   
        CALL_N_CHECK( inv_get_accel(fixedData) );
        CALL_N_CHECK( inv_get_gyro(&fixedData[3]) );
        for (ii = 0; ii < 6; ii++) {
            data[ii] = fixedData[ii] / 65536.0f;
        }
        printf("A: %12.4f %12.4f %12.4f G: %12.4f %12.4f %12.4f \n",
                 data[0], data[1], data[2], data[3], data[4], data[5]);
#endif
    }
}
int MPLSensor::estimateCompassAccuracy()
{
    inv_error_t res;
    int rv;

    res = inv_get_compass_accuracy(&rv);
    if(rv >= SENSOR_STATUS_ACCURACY_MEDIUM) {
         mHaveGoodCompassCal = true;	 
    }
    ALOGE_IF(res != INV_SUCCESS, "error returned from inv_get_compass_accuracy");

    return rv;
}