View Full Version : Accelerometer problems
benjo
12-18-2009, 05:31 AM
Hi all,
I got my N900 today. Having a great time with it at this stage, but there is one problem that I've noticed.
I downloaded the 'Attitude' application, but when I go into it the world just rotates randomly not related at all to the position of the phone. I've also tried playing Bounce Evolution, but the ball just sits there no matter how much i move the phone. I can make it jump with the space bar but that's it. Even the camera - I took a portrait photo and when I viewed it back it hadn't auto-rotated.
Is there some way I can check on the data that is being received by the accelerometer? It seems like I might have a problem.
Thanks,
Ben
kwotski
12-18-2009, 05:40 AM
There's a package called accdisplay, (see http://talk.maemo.org/showthread.php?p=426247#post426247 ) which shows the accelerometer data pretty directly (it might still be in extras-devel - see this big warning: http://talk.maemo.org/showthread.php?p=343619 )
But from what you say, it does seem like you have a problem as you say. Both the apps you've mentioned are known to work.
hopbeat
12-18-2009, 05:42 AM
you can do
cat /sys/devices/platform/gpio-switch/proximity/state
which gives you raw data.
You may want to hit your phone a bit, accelerometer might have got stuck (I don't take responsibility for you hitting it with a hammer :) )
kwotski
12-18-2009, 05:56 AM
Useful to know, hopbeat, but isn't that for the proximity sensor, whereas the question is about the accelerometer?
Or did I miss something? (not unlikely!)
Edit: you can read the accelerometer data directly with (in x-terminal)
cat /sys/class/i2c-adapter/i2c-3/3-001d/coord
(from http://wiki.maemo.org/Accelerometers )
or to view it polled continuously with a 1 second interval:
watch -n 1 "cat /sys/class/i2c-adapter/i2c-3/3-001d/coord"
hopbeat
12-18-2009, 08:40 AM
@kwotski, of course, that's what you get when you are doing something for too long :D
benjo
12-19-2009, 08:27 AM
Edit: you can read the accelerometer data directly with (in x-terminal)
:cat /sys/class/i2c-adapter/i2c-3/3-001d/coord
Thanks for the help everyone. I typed that directly into x-terminal and got the message "No such file or directory". I've installed rootsh and run sudo gainroot as well - not sure if it was needed.
I know nothing about linux or x-terminal. Is typing that in just like that all I need to do?
Eric G
12-19-2009, 10:04 AM
or to view it polled continuously with a 1 second interval:
So I'm sitting on my couch with a terminal open on my laptop watching the numbers change while I slowly rotate my N900, laughing to myself.
If all the youtube videos of the latest gadget can be called geek p0rn, call this one "geek pot.":p
kwotski
12-19-2009, 11:39 AM
Thanks for the help everyone. I typed that directly into x-terminal and got the message "No such file or directory". I've installed rootsh and run sudo gainroot as well - not sure if it was needed.
I know nothing about linux or x-terminal. Is typing that in just like that all I need to do?
Yeah, if you typed it correctly it should work. It's not being there might indicate the driver didn't load properly.
What you might try is restart the N900 and then run the command
dmesg | grep lis302
from x-teminal (you might need to be root) This might show startup messages to do with that driver. Alternatively
dmesg | more
and visually inspect to see if you can see any messages related to the lis302dl driver (that's the name of the accelerometer chip I think)
Or before restart, try
lsmod | grep lis302
lsmod lists the loaded kernel modules (=drivers).
(in the terminal, you can get the | character from the symbol thing (blue-arrow-key+ctrl))
have a look in extras-testing
there is a package called liqacceltests and it includes the tools I wrote to get myself familiar with the accelerometer on the n900
it includes methods to show normal and smoothed values and has a graphing tool too :)
quite useful and informative little toys I have played with for a few months
http://liqbase.net/liq.20090830_175314.liqaccelview_alternative1.scr. png
screenshot of one of the tools
benjo
12-19-2009, 09:29 PM
Or before restart, try
lsmod | grep lis302
lsmod lists the loaded kernel modules (=drivers).
Did this before restart - response was
lis302dl 6784 0
Not sure what that means, although maybe it means the driver exists? What does 6784 0 mean?
What you might try is restart the N900 and then run the command
dmesg | grep lis302
from x-teminal (you might need to be root) This might show startup messages to do with that driver.
Did this after restart. Got no message at all (not even an error message) - just went straight to the next line where i can enter another command.
Alternatively
dmesg | more
and visually inspect to see if you can see any messages related to the lis302dl driver (that's the name of the accelerometer chip I think)
Did this, went through the massive list of message about all sorts of components and drivers and their status but no mention of the lis302dl driver.
Does this mean my phone doesn't have the driver for the accelerometer? If yes, how do I get it?
benjo
12-19-2009, 09:36 PM
omg it's working now! I read back my response and realised that the message before restart seemed to be different to after restart, so i tried attitude and it worked. Then tried Bounce and that worked too.
I'm not sure if it was anything i did in x-terminal, or if it was just the restart, but it's working now so I'm very relieved. Thanks kwotski for your help.
Ben
kwotski
12-19-2009, 10:16 PM
Glad to hear it's working, I guess the restart did the trick.
The lsmod output means the driver called lis302dl is loaded, taking up 6784 bytes of ram, and used by no other drivers.
The dmesg thing - I was just guessing you might see some signon by the driver. My own N900 has been up too long to check how it signs on. Usually, the driver name would appear when it loads or if there are problems (which I thought you might see, TBH ;) )
I guess something upset it and the driver conked out, which was fixed by your rebooting. The special files I refered to in my other post should be there now, I expect?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.