[Desire Q&A, Help & Troubleshooting] Dewag:
Compass calibration problem solved by temporary root and system file deletion !

Calibration problem solved for HTC Desire with Android 2.2 - Froyo.

A factory reset also worked well for me, but after doing that, the calibration was

messed up again by the phone's built-in G-sensor calibration procedure.

I did NOT want to factory reset anymore, because of the time involved

to restore all applications on my non-rooted phone.

BUT I DID WANT TO GET RID OF THE PERMANENT WAVING AND SHAKING

EACH TIME A COMPASS APPLICATION WAS STARTED AND KEPT SEARCHING FOR A BETTER ALTERNATIVE. AND FINALLY FOUND ONE:

A. FOLLOWING LINK DESCRIBES COMPASS PROBLEM, ISSUE 3287 GOOGLE:

(see attached text file "Compass Calibration.txt" for all URL's, since as a first time poster I am not allowed to post outside links)

URL1:

(Note that comment 6 gives the final solution for the problem).

B. I Used SMART COMPASS app from Android Boy (can be found on Android Market Place)

It visualizes the problem by means of a magnetic field measurement bar.

The bar will show red in error state, green after calibration by waving and shaking.

(not fool proof, but field bar is a clear indication when in error state)

C. FOLLOWING LINK DESCRIBES HOW TO INSTALL ADB (Android Debug Bridge) ON A PHONE:

URL2:

D. FOLLOWING LINKS DESCRIBE HOW TO BECOME TEMPORARY ROOT WITH ADB:

URL3:

URL4:

######################################################

START PROCEDURE

1. Follow the procedure mentioned under C. to let the PC communicate with the phone with ADB (Android Debug Bridge). This is a procedure in itself, but needs only to be done once.

2. If communication succeeds, get archive rageagainstthecage-arm5.bin

from the link as mentioned under D, get the file 'rageagainstthecage-arm5.zip'

it is attached to the first posting in the first link under D.

3. Connect the phone with USB cable to PC, selecting 'Charge only'.

4. OPEN DOS COMMAND WINDOW ON PC, AND CONNECT TO PHONE WITH ADB.exe in tools dir:

cd c:\AndroidSDK\tools

adb devices

adb.exe push C:\AndroidSDK\rageagainstthecage-arm5.bin /data/local/tmp

adb.exe shell

cd /data/local/tmp

chmod 0755 rageagainstthecage-arm5.bin

./rageagainstthecage-arm5.bin

THE FOLLOWING TEXT WILL BE PRESENTED (for HTC DEsire):

[*] CVE-2010-EASY Android local root exploit (C) 2010 by 743C

[*] checking NPROC limit ...

[+] RLIMIT_NPROC={3319, 3319}

[*] Searching for adb ...

[+] Found adb as PID 2942

[*] Spawning children. Dont type anything and wait for reset!

[*]

[*] If you like what we are doing you can send us PayPal money to

[*] 7-4-3-C@web.de so we can compensate time, effort and HW costs.

[*] If you are a company and feel like you profit from our work,

[*] we also accept donations > 1000 USD!

[*]

[*] adb connection will be reset. restart adb server on desktop and re-login.

$

(it takes time - approx. 15 seconds - to get back to c:\ prompt in cmd shell)

5. Now wait on the PC until the C:\ prompt is shown again.

(In the case The telephone reboots, wait until finished and login to phone.

Then pull out the USB cable, and after reinserting it, choose 'charge only',

otherwise the SDcard cannot be reached).

6. Restart adb on the PC and you will be ROOT !

(the command prompt was > but will now be # for root after the next commands)

adb devices

adb.exe shell

7. IF YOU WANT TO BACKUP THE FOUR (4) FILES TO BE DELETED, otherwise goto step 6:

mkdir /sdcard/compass_bck

cat /data/misc/rild_nitz_short_name_20404 > /sdcard/compass_bck/rild_nitz_short_name_20404

cat /data/misc/rild_nitz_long_name_20404 > /sdcard/compass_bck/rild_nitz_long_name_20404

cat /data/misc/AK8973Prms.txt.tmp > /sdcard/compass_bck/AK8973Prms.txt.tmp

cat /data/misc/AK8973Prms.txt > /sdcard/compass_bck/AK8973Prms.txt

8. DELETE THE FOLLOWING FILES in /data/misc:

cd /data/misc	(change dir)

ls -l	(show long directory listing)

rm rild* (remove files)

rm AK8*

exit

9. REBOOT THE PHONE !!!

AFTER REBOOT - Start the SMART COMPASS:

The magnetic field bar will again start in red, but after waving / shaking will become green.

When the compass app is closed, and the compass is restarted, the bar will be GREEN, AND YOUR COMPASS WILL BE IMMEDIATELY POINTING IN THE RIGHT DIRECTION, WITHOUT WAVING/SHAKING !

Now, it is NOT necessary anymore to calibrate the sensor by waving and shaking of the phone, when starting an application that makes use of the compass function.

END PROCEDURE

######################################################

I only collected information from forums: thanks !

Note that I did do this procedure about 8 times for testing, and each time it worked. But use on your own risk, of course.

NOTE: it seems that I am not allowed to post outside links (for spam), so unfortunately, you also need to read the attached file to obtain the links !

######################################################