yashsingh1/xdaforums huggingface dataset:
[HD2 Android SD Development] memin1857:
Current progress

What has come out so far:

- Orientation is fixed with the procedure in post 1

- People can at least definitely make their g-sensor work again (maybe with freezes), if they did autocalibration and messed up their values. (post 10)

- With Touch Screen freezes, there is success with quite a number of people. Since values are not exact for everyone, I would advise people to use experiment with different values if they can't get rid of the freeze with the values in post 11. The changes happen in realtime with most builds so it is not that difficult to test. Even if you can't get rid of freezes instantly, you will still see values affect how often or with what action/direction freezes happen. It is ALSO good feedback even if you weren't able to eliminate freezes but if they are obviously lowered. Always backup your Android folder through winmo and the files you will edit through root explorer.

Also with some people (including me) the values keep changing by themselves everytime a sensor app is run/switched to. I have tried some builds and newer evo/desirehd based builds may show this behaviour. Freeze frequency also changes by app. Bubble app seems to be the most freezing app. (To find it search the market for bz.ktk.bubble) Enable "show angle" from bubble apps settings.

Remember this is is a manual workaround for non-working autocalibration. This thread has shown that a working autocalibration may fix freezes for good. Also has shown that it is possible to experiment with the values and get rid of freezes. Still, we need more testing and need to find a pattern for a better fix that works for everyone. If this gets fixed in kernel, then all this would be unnecessary, but it might happen because this thread exists, and still the community wins.

I also have a theory, as with nexus based kernels, when touch freezes it doesn't come back. With evo based kernels, when touch freezes it resumes after a few seconds. Maybe this is in the kernel log and might shed some light in exactly what condition freeze happens. (e.g. value out of range, value change too fast, invalid value, exact value/orientation etc.)

There are a lot of people who can't play games because of this. And I remember this touch screen freeze issue started after 23 July kernels. (zimage)

FOR PEOPLE WHO SAY THERE IS NO EFFECT:

Try to temprorarily change AOFFSET.x=90 and return to your app. When phone is on the table, your leveling bubble or pitch/roll must be way off. This way you can see if with your build changes are reflected in realtime or not. If not try restarting, use different sensor app and give feedback please. (After that revert back AOFFSET.x to 0 or other proper value to fix back orientation)
[HD2 Android SD Development] hd2k10:
Edit: Every time you reboot the permissions reset, however if on the startup if I keep the phone level without opening any apps that use the sensor, I reset the permissions and it has been good ever since --- Sensor also works correctly.
[HD2 Android SD Development] jmmmmm:
Changing AOFFSET to 90 had no effect on calibration even after reboot. Pitch 8 / Roll -2

Freezes seem to be less. I will know when I go for a drive later. If you really want to test freezing put it in a car dock and drive on the highway. :)

Im using Hastarin 7.1 with AndroidMedaUltimate 1.1

ANyone know what HOFFSET is?
[HD2 Android SD Development] memin1857:
Edited this post (deleted some lines) after I got some new info about accelerometer.

------

AK8973 is the 3 axis compass chip. It is also the orientation sensor according to phone tester app

BMA150 is the 3 axis accelerometer.

Offset is a value that is added or subtracted from to the raw data coming from the sensor driver.

With Phone Tester app we can see the pitch/roll data (level) comes from the compass chip.

ASENSE is probably accelerometer sensitivity. It is 256 by default and makes the range 10 to -10. Minimum value is 45 (will break if lower than this) and it makes range someting like 60 to -60. If you make values very high (1000-1500) the range becomes like 1.5 to -1.5

SLIDER OPEN CLOSE is most likely for phones that have sliders and makes software know sliders position. Since HD2 doesn't have a slider, SLIDER CLOSE values seem to be ignored. Older builds (such as shubcraft) don't have SLIDER. Just one set of values.

HDAC might be nominal values in phones normal state, HOFFSET would be the offset added or subtracted from HDAC. These are guesses.

I need to experiment with a very old kernel that is before 23 july to see how sensor data comes out. Also with different sensor drivers.

Also at first I had AccPrmsF.ini file created with auto calibrate. It should stand for Accelerometer Parameters. But now a bma_result.txt file is created. BMA is the accelerometer chip.

Autocalibration finds correct offset values for x and y but z has extreme high (like 525) value and this breaks interpretion. When the phone is face down, z value becomes normal.

IS THERE an app for winmo that displays sensor data? I wasn't able to find it yet. (EDIT: FOUND IT! Check post 58 on page 6)

Again my freezes are gone. Now there are no freezes even when abused. Of course it will get back after reboot but I really need to be able to reproduce this everytime.

EDIT: I saw that gps status app interprets acceleration correctly. It seems change in accelerometer value is what is important and it may be fine. Lets focus on freezes.
[HD2 Android SD Development] DiamondGeeza:
I must be doing something wrong here. Using root explorer I can get to /data/misc/ but there is only 1 file and some folders for bluetooth and wifi and such no AK8973Prms.txt file. Same thing if I check with droidexplorer.A search for the file in rootexplorer turned up nothing.

My sensors seem to be working ok albeit with the freezes and about 2deg off each way. Using gps status app it seems that the compass only works when completely flat, I assume that some calculations should be happening in the background using the inclinometers to compensate for this and it aint.
[HD2 Android SD Development] DiamondGeeza:
Looking at the chip specs the BMA150 does the orientation. As gravity always points down it can tell which way down is and uses this to do the orientation of the phone. The bottom axis on sensor debug is always reading -9 or -10 ish if you compare the phone on all edges it seems they all should read -10 but one side might be -9.8 and the other -10.2 I think this is down to the 2deg out of my calibration.
[HD2 Android SD Development] memin1857:
Acceleration is measured in meter / seconds square. It means how much speed your are gaining (accelerating) I think it has to be 0, 0, 0 when the phone is still or at constant speed. (EDIT: IGNORE THIS PARAGRAPH, I wasn't taking gravity into account)

10m/s2 is free fall. (About 1G)

Phones orientation changes x y z accelerometer values in m/s2. Phones different orientations make accelerometer show (x/y/z) as 0/0/10 - 0/10/0 and 10/0/0.

Check phone tester app and you can see AK8973 compass is the orientation sensor, BMA150 is 3 axis accelerometer.

EDIT: Gps status app interprets acceleration correctly. I wasn't thinking about gravity. Focus should be on freezes again
[HD2 Android SD Development] memin1857:
Try updating your su binary from superuser settings TWICE. Then restart rootexplorer.

If compass only works when phone is flat, you have old kernel. Newest kernels fixed it. (as compass was 3 axis, old kernels did not assume that) Try hastarin 7.2 kernel.
[HD2 Android SD Development] Vermik:
try new kernel =) u don't need this
[HD2 Android SD Development] jmmmmm:
Which kernel?
[HD2 Android SD Development] Vermik:
7.1 ot 7.2 ....but I'm new here =).....lol....I will sell my hd and buy an desire hd xD....I love android
[HD2 Android SD Development] kholk:
Selling an HTC HD2 for going with a Desire HD is like saying "I've got too much money in my pocket" IMHO.

I'm getting a Desire Z and I haven't sold my HD2 (sold Milestone instead)..the HD2 is somewhat incredible!
[HD2 Android SD Development] jmmmmm:
If you're that new, why post a suggestion that you are not sure about. Lol
[HD2 Android SD Development] DiamondGeeza:
The accelerometer will be measuring G force, which is always 1G in the Z because of gravity, This way they always know which way the phone is pointing in the XYZ axis.
[HD2 Android SD Development] memin1857:
We are already using latest kernels. Its not that simple..
[HD2 Android SD Development] memin1857:
Ok. Lets focus on freezes then.

I just saw that gps status shows proper acceleration in Gs.
[HD2 Android SD Development] memin1857:
If anybody has access to a native android phone, (such as desire or evo) can you compare phone tester app sensor outputs to hd2 if they look similar? Also check for flicker, update intervals. Don't forget to try different orientations. Please also check AK8973Prms.txt in /data/misc (if your phone is rooted of course.
[HD2 Android SD Development] Jack E:
nvm delete this
[HD2 Android SD Development] tadzio:
@memin1857, let me say a big THANK YOU from an unexpected side. :)

As you may or may not know, quite a few Desire owners have the problem that the calibration of the compass does not "stick" - it gets lost as soon as the app stops using the compass.

Searching xda-developers, I found this thread and learned about the file AK8973Prms.txt. And indeed - there seems to be a bug in HTC's FroYo 2.2 version for the Desire. Whenever I run the g sensor calibration, it writes a new AK8973Prms.txt that contains only the three AOFFSET.x/y/z lines. All others are gone, which really confuses the magnetometer. :) Fortunately it's sufficient to just delete that file and run any app that uses a compass, which recreates the file properly (only the AOFFSET are all 0).

So, while this does probably not help you with your HD2 specific problems, at least you know that you made a few Desire owners happy. :)

Thanks again

tadzio
[HD2 Android SD Development] memin1857:
I'm glad that it helped you.

If you have time can you help us with the post 48? (Since you have a desire?)

Install phone tester app from the market and tap sensor status.

1) Do your sensor datas flicker a lot while the phone is still?

2) Does your accelerometer values range between about 10 and -10?

3) With phone in three different orientations, does the accelerometer data show as around (x/y/z) 0/0/10, 0/10/0 and 10/0/0 accordingly? (Approximate numbers are ok, you can write 9.8xx as 10 and 0.xxx as 0) Test with phone lying on table, standing up and sideways please. You may ignore negative sign.

4) How often are the sensor data get updated in display? Like very fast or maybe as slow as a few times per second?

If you have access to an hd2 android, you would also visually compare.
[HD2 Android SD Development] jmmmmm:
NOt sure if anyone else has done this but I compared my HD2 with a G1 using SensorDebug. The results where remarkable similar except that the pitch on the HD2 was 8 and the pitch on the G1 was 0/-1 when restung flat on a table. Even the readings were jumping similarly so there doesnt appear to be anything wrong with the sensors, its just the calibration that doesnt work.
[HD2 Android SD Development] memin1857:
I have tried with very old kernels (23 july) and old sensors.xxx.so driver

and it doesn't make any difference. Only the polling interval is lower.
[HD2 Android SD Development] ksuperman:
Working Like a Charm

This setting solved my screen freeze problem on Core Droid Froyo /EVO Sense

v0.5 (03.10.2010) by Sergio76....

Thanx a Million!
[HD2 Android SD Development] tadzio:
Of course. Here's what I found:

1. The Accelerometer data change very quickly (around 50 times per second), but only by up to 0.05 m/s²

2. Yes.

3. Yes. I get:

- flat: x = 0, y = 0, z = 10.2

- upright: x = 0, y = 9.9, z = 0

- sideways: x = -9.8, y = 0, z = 0

4.Update rate seems to be around 50 Hz - definitly faster than I can read the values.

Unfortunately, I don't have access to an HD2, so I can't compare.

Just for completeness, here's the AK8973Prms.txt that was automatically re-generated after I deleted the broken version and ran GPS Status (note that I also deleted AK8973Prms.txt.tmp and bma_result.txt):

[AK8973]
HDOE_STATUS_SLIDER_OPEN=3
HDOE_STATUS_SLIDER_CLOSE=0
HDOE_SUCTEMP=114
HDAC_SLIDER_OPEN.x=0
HDAC_SLIDER_OPEN.y=0
HDAC_SLIDER_OPEN.z=0
HOFFSET_SLIDER_OPEN.x=-89
HOFFSET_SLIDER_OPEN.y=-962
HOFFSET_SLIDER_OPEN.z=-1007
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

Before that, I ran the g sensor calibration two or three times, and I got the following values:

AOFFSET.x between 0 and 2

AOFFSET.y between 3 and 4

AOFFSET.z between -7 and -3

Cheers

tadzio
[HD2 Android SD Development] jigners:
just how step 2 and 4 exactly accomplished?:o
[HD2 Android SD Development] memin1857:
I recommend against doing those. It breaks things if you autocalibrate. (check newer posts)

Bu still here are the gsensor enable disable scripts if you want anyway: (credit goes to darkstone)

Disable:

mv /system/bin/akmd /system/bin/akmd2

killall akmd

Enable:

mv /system/bin/akmd2 /system/bin/akmd

/system/bin/akmd

Don't forget to backup first.

Thank you very much for the info. With some feedback it seems, sensor refresh rate, flicker, ranges seem to be same with hd2 android and other native android phones.
[HD2 Android SD Development] memin1857:
Sensor data for winmo

Finally I found software that displays sensor data for winmo: (for comparison)

http://www.freewarepocketpc.net/get-mtoolbox.html

(CLICK ON MIRROR DOWNLOAD)

Filename is: mtoolbox_0.3.0.cab
[HD2 Android SD Development] nologin:
Great findings. Thanks a lot.

Although your settings don't eliminate my screen freeze completely, it has improved a lot. Also, scrolling is much smoothier after your fix. Before was like serious scroll lag.

Default configuration have freezes: YES

New values fix freezes: NO (But improved a lot)

Different files: NO

Build/Kernel: mattc evo 1.0.1 / hastarin 7.2 / 2.10.50 radio
[HD2 Android SD Development] Amal77:
Where is /data/misc/AK8973Prms.txt ?

Already updated the su binary. Still can't see any?

Btw, I'm using Core Droid 0.5.

Thanks
[HD2 Android SD Development] memin1857:
Z axis calibration

This is addendum to post 1

I have found how to calibrate the z axis. (post 1 calibrated x and y axis)

Gravity is usually 9.81m/s2

So accelerometer x y z values must be between about -9.8 and 9.8.

Use sensordebug or phone tester app

Put your on phone on the table and check the z axis accelerometer value. It must be as close as possible to 9.8. If it is significantly more or less than that

Edit AOFFSET.z=0 in Ak8973Prms.txt with root explorer, try giving different values (start by changing 0 to 10 or -10) and make z axis accelerometer report in your sensor app close to 9.8. (give some offset) Then turn your phone screen face down and make the edge of the screen protrude from the edge of the table (so you can look it from underside) and verify that it is now close to negative -9.8

Note: As an alternative way, you can hold the phone up and try to make z axis close to 0 but using a table might be more accurate.

Without calibration, values range from e.g. 10.2 to -9.4 (0.4 off from 9.8) and so like that. Try to make full up and full down values about the same (disregarding the negative sign)

You may want to protrude the camera lens from the edge of the table since it makes a physical 1 degree offset. (or lower AOFFSET.y by about 2 to compansate)

If you did the calibration in post 1 you will see that your x and y axes are also in range between 9.8 and -9.8. If you see numbers in 10, it is wrong. Your ASENSE values must be 256 (default) for this proper range.

YOU GET 9.8 when phone is STILL. Of course it will change when you are actually moving the phone. Don't go nuts to make the values exactly 9.8. Make it close enough and it is ok.

You can use negative values for AOFFSET. Calibrated AOFFSET values for my phone are x=2 y=-9 z=12

I am not sure what would be affected if z-axis is out of calibration, still no harm. I like it calibrated :)

Software, when interpreting accelerometer data, look for "changes" in data to detect movement and direction, so a very sensitive calibration maybe wouldn't matter much. Again, no harm.

EDIT: My sensors seem to be working perfectly since I also calibrated the z-axis. I need confirmation on this.

EDIT 2: I have a theory about why auto calibration not work: When you do auto calibration z axis is messed up. I think when you auto calibrate, the calibrate tool tries to 0 all the axes, but I believe (since the phone is on the table) it should try to 0 x and y but try to make z axis 9.81.
[HD2 Android SD Development] memin1857:
Are you using rootexplorer?

Other file managers (such as astro or estrongs) are usually unable to access data folder even if you have root permissions and superuser app with new su binary.

Also try DroidExplorer (de.codeplex.com) from pc. (It accesses through usb cable with adb/usb debugging) It may solve your problem.

EDIT: TO BE ABLE TO USE ASTRO TO ACCESS /DATA

Change permissions of /data folder to read write execute for every option (rwxrwxrwx)

From terminal emulator enter these commands

su

chmode 777 /data
[HD2 Android SD Development] jmmmmm:
Guys which kernel is this supposed to work with. I have tried with 2 different ones and this is just not working. None of it.
[HD2 Android SD Development] memin1857:
It is not exactly known, but it works with many people.

Please tell us which two kernels you tried and with which exact build?

It worked with almost any build or kernel I tried. (evo based, desire based, desire hd based, nexus based, all had evo based kernels such as hastarin, huanyu)
[HD2 Android SD Development] jmmmmm:
Im using the Hyperdroid 1.6 (AdroidMedaUltimate) build

Kernels: Hastarin 7.1/7.2 and michy's r1

Man this would be sweet if it worked.
[HD2 Android SD Development] memin1857:
Someone (crawlingcity) reported earlier that it worked with hyperdroid 1.6 / michyprima R11.

Maybe its the combination of evo based hastarin kernel/again evo based r1 kernel with nexus one based hyperdroid build you are using and it doesn't work.

Can you temprorarily change to michyprima r11 kernel and test? (you don't need to update wireless driver, just temprorarily replace zimage) r11 kernel is based on nexus one. It is a better match for hyperdroid (a cm6 nexus one based build)
[HD2 Android SD Development] jmmmmm:
Sorry I meant r11 not r1. What I did was go back to the default build for hyperdroid. Still no joy.
[HD2 Android SD Development] Amal77:
Yup, used both DroidExplorer and Rootexplorer... Both can't see the txt file...

Only have screen_lock_status file in the misc folder... :confused:

Tried checking using lh on the terminal, still no luck...

Thanks
[HD2 Android SD Development] memin1857:
uh, okay.

These I can think of for trying:

- Change the way you edit the file. How are you editing the file?

- Try deleting the file and it will get recreated after you open a sensor app or reboot. Try with that one, and also try editing that one.

- Temprorarily try a sense based build and see if it works for you. For example mdeejay 3.4 (desire hd) would be ok.

- What are the permissions of the file? It should look like. rwxrwx

If you edit the file in windows pc it gets corrupted.

Your feedback is welcome.
[HD2 Android SD Development] memin1857:
With rootexplorer try changing the permissions of data folder itself to read write execute (all ticked, like chmod 777)

I did it and now even astro can see the contents of /data

You can also do this with terminal emulator.

Enter these commands:

su

chmod 777 /data

chmod 777 /data/misc

chmod 777 /data/misc/AK8973Prms.txt
[HD2 Android SD Development] jmmmmm:
Well its not looking good here. Im using Root Explorer to edit. I have deleted the file several times now.

I just dont think it works with HyperDroid. Maybe someone with hyperdroid that has it working can send/post thier file so we can take a look at it.
[HD2 Android SD Development] memin1857:
There was at least one user with HyperDroid and it worked for him.

Try changing permissions for the /data folder

From terminal emulator:

su

chmod 777 /data

chmod 777 /data/misc

chmod 777 /data/misc/AK8973Prms.txt
[HD2 Android SD Development] jmmmmm:
@memin1857

I dont think my sensor is puling info from this file. Here is what I did.

1. Delete file

2. Reboot

3. Clear file contents (root explorer)

4. Open SensorDebug

SensorDebug still shows the same info and the file is still empty.

:confused::confused::confused:
[HD2 Android SD Development] memin1857:
Install Phone Tester App. Goto Sensors.

Tap properties of compass.

Is the Vendor: The Android Open Source OR Asahi Kasei?

Backup your sensor file(s) from /system/lib/hw (file names beginning with sensors)

Try the attached one from this post.

Both directly copy the file and also another copy whose name matches the one in your builds. (replace yours)

sensors.xxxx.so => xxxx can be htcleo default ace or similar name (depends on build)
[HD2 Android SD Development] Amal77:
no such file or directory... :(

I don't think its there in the first place...

Should I just create the file and push it there? :o
[HD2 Android SD Development] jmmmmm:
Vendor is Asahi
[HD2 Android SD Development] memin1857:
You have the old sensors driver. Try the one I attached. (be careful about different filenames, replace/put them all) Backup yours first.

Put more than one copy of the sensors file in /system/lib/hw with different filenames. including yours. (this way you can make sure your build will find the filename it is looking for)

I have seen

sensors.htcleo.so

sensors.bravo.so

sensors.default.so

sensors.ace.so
[HD2 Android SD Development] jmmmmm:
Ok so now I see Android Open but its still not responding to any file changes.
[HD2 Android SD Development] memin1857:
I can't think of anything more, sorry.

I am out of ideas, sorry I couldn't help you.
[HD2 Android SD Development] jmmmmm:
Thanks... I do appreciate it mate.
[HD2 Android SD Development] Amal77:
Thanks nway :)
[HD2 Android SD Development] terminal 7:
my fix

i have a great rom working based on cyan6 and the g-sensor had to be turned off because the thing was freezing all the time - so i fixed it...

i installed a good working sense evo based rom that had no g-sensor problems, i let it run for a while then copied the AK8973prms.txt file to a location, then re- booted my old favorite cyan6 based rom and coppied the file into place.

/data/misc/ak8973prms.txt

alls well that ends well - for me this has worked brilliantly, no freezing screen even as i walk about using my hd2.. great...

[AK8973]

HDOE_STATUS_SLIDER_OPEN=3

HDOE_STATUS_SLIDER_CLOSE=0

HDOE_SUCTEMP=108

HDAC_SLIDER_OPEN.x=129

HDAC_SLIDER_OPEN.y=135

HDAC_SLIDER_OPEN.z=2

HOFFSET_SLIDER_OPEN.x=-351

HOFFSET_SLIDER_OPEN.y=660

HOFFSET_SLIDER_OPEN.z=514

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

thats the file if you fancy having a go yourself .. :) - thanks to all on this post for pointin in the right direction, as always great work by all :)
[HD2 Android SD Development] alik713:
Can't find said file in Droid Core V 0.5.

:(
[HD2 Android SD Development] memin1857:
Nice!!! I'm glad it worked for one more user.

While it's proven it works, it's still not perfect for everyone, and I'm yet to reproduce everytime I want. Still, there has been nice progress. Thanks to everybody who provided feedback.
[HD2 Android SD Development] jmmmmm:
[UPDATE] Apparently I needed to reboot the phone after making the change in the text file to for the sensor to read anything. Instant changes are not working for me, but if I change then reboot it sees the change.

Screen freezes are still a problem but at least the sensor is calibrated now.

Thanks for your help today!!! :)