[HD2 Android SD Development] memin1857:
How to restore g-sensor

If you calibrated with android calibration tool and your g-sensor freaked out. Here is how to fix it:

Use rootexplorer to

Delete AccPrmsF.ini and bma_result.txt file in /data/misc (if they exist)

Edit AK8973Prms.txt in /data/misc folder with rootexplorer to these values:

[AK8973]

HDOE_STATUS_SLIDER_OPEN=1

HDOE_STATUS_SLIDER_CLOSE=0

HDOE_SUCTEMP=114

HDAC_SLIDER_OPEN.x=128

HDAC_SLIDER_OPEN.y=135

HDAC_SLIDER_OPEN.z=4

HOFFSET_SLIDER_OPEN.x=250

HOFFSET_SLIDER_OPEN.y=593

HOFFSET_SLIDER_OPEN.z=175

HDAC_SLIDER_CLOSE.x=0

HDAC_SLIDER_CLOSE.y=0

HDAC_SLIDER_CLOSE.z=0

HOFFSET_SLIDER_CLOSE.x=0

HOFFSET_SLIDER_CLOSE.y=0

HOFFSET_SLIDER_CLOSE.z=0

ASENSE.x=256

ASENSE.y=256

ASENSE.z=256

AOFFSET.x=0

AOFFSET.y=0

AOFFSET.z=0

(These values may not solve freezes, check post 11 for different values that may fix freezes)

Some nexus based builds don't have slider open/close lines.

No need to reboot, just save and it should work instantly with most builds. (If it doesn't check post 11) If you delete AK8973Prms.txt or it may get recreated with wrong values (full zeroes) and freak out again. AOFFSET.z=xxx seems to be the culprit of calibrate tools vertical corruption. (Becomes full up or full down like digital when z=veryhigh). Only editing it to zero may solve the problem.

These values may change in time, or between builds. Those were my values, you may try to boot a new version of your android build and rip the file from it and use that instead.

If your g-sensor does not work at all after reboot you may need to restart it. Open terminal emulator and enter these commands:

su

/system/bin/akmd

Now it should be working.

Please tell if it worked for you. By comparing values and working on these values we may as well make g-sensor much better. (Accelerometer doesn't seem to be calibrated) If your build has different file name, please tell us. The instructions in post 10 may not be perfect and I am still working on this and will post if I find anything new. Of course kernel support is also required for getting less flickers, no freezes, proper poll intervall, correct i2c frequency and proper calibration.

EDIT: The values keep changing by itself. Interesting part is I am getting less shake/move freezes (or freezes in only one direction) in sensor apps or games now! I am experimenting with different values and it definitely affects how often freezes happen. I am trying to get the values of what a real calibration would do. Maybe sensor freezes happen when values are out of range. I am sure a proper calibration will get rid of these freezes but since with the current kernels we can't do proper auto calibration, maybe we can do manual one for now. Seems usual x y z accelerometer values are between 10 and -10. When freezes happen they seem to be more than 10 or less than -10. ASENSE values change the range of x y z (minimum working asense is 45 and the more you set the less range x y z has). Also ppp data seem to freeze/restart when sensor freezes happen. If freezes are eliminated even ppp data might work better! Some of the findings might be wrong, of course.

It seems you can update AK8973Prms.txt in realtime with droidexplorer and changes are reflected in realtime when you reopen, switch to the sensor app or sleep/wakeup. This makes testing easier.

It seems I have found non freezing values. Check next post. (Post 11)