OpenMoko Rotate 0.2.0

Woke up 2h earlier because of a problem, solved quickly, took the extra time to greatly improve the heuristics.

If you haven’t tried it before, now it’s the time to try. If you did, NOW is the time to try again 🙂

Fetch it now: rotate-0.2.0.tar.gz (signature)

$ head -3 ChangeLog 
2008-09-22 - 0.2.0
	* greatly improves heuristics
	* fixed heuristics when laying around, and turned up

First brown paperbag release of new Rotate

Oops, heuristics were bad, very bad. Still has quirks, but at least now they’re not so shameful.

There’s a new release: 0.1.1 (signature)

$ head -2 ChangeLog 
2008-09-21 - 0.1.1 - First brown paper bag release
	* improves heuristics
$ cat KNOWN_ISSUES 
Known Issues:
	* reading from the accelerometer hangs after X time/reads
	* some heuristic values may need finetunning (specially when
	  laying around, turned up)

New Rotate for OpenMoko

As said before, since I’m not entirely happy with the previous version of Rotate for OpenMoko, also using it as a way to learn how to write programs for it, I’m writing a new version of Rotate for OpenMoko.

I’m now announcing the first results: release 0.1.0 is out (signature)! The tar.gz file contains both source and a binary suited to run on Om200x.y (at least 2008.9 should work).

Be careful, it bytes.. 🙂

$ cat ChangeLog
2008-09-21 - 0.1.0 - First release.
	Current Features:
	* makes some rotations

	Known Issues:
	* reading from the accelerometer hangs after X time/reads
	* some heuristic values may need finetunning (specially when
	  laying around, turned up)

	Near Future:
	* don't rotate when screen is locked
	* change profile to silent/meeting when phone is turned down
	  and revert when it is turned back up

Getting ready for Rotate rewrite

So… following up on my patch for a better xrandr rotation on Rotate, I’ve been learning how to read the accelerometers, and it’s a lot of fun, actually. I’m so thrilled… I really missed programming 🙂

Now, the good news is that in a couple of days (hopefully) I’ll be posting a completely new Rotate. I’m collecting some positioning data from the second accelerometer, and right now I already know a few positions, at least my little test program is guessing some positions quite right…

s/guess position/libxrandr rotate/ and you get the new Rotate 🙂

All this without running the risk of seeing this software banned (like the iDictatorPhone), where it seems some programmer got his application banned on the iDictatorPhone because it competed with Mail.App. Nice one, Apple, you’re only proving us, Free Software activists, right. Again. 🙂

The following is the current output as I pick it up from the table and place it from turned up into turned down.

Postion (90,90,1026):  horizontal turnedUp
Postion (90,72,990):  horizontal turnedUp
Postion (36,54,990):  horizontal turnedUp
Postion (-36,36,990):  horizontal turnedUp
Postion (18,18,972):  horizontal turnedUp
Postion (18,936,0):  upsideDown
Postion (18,36,882):  horizontal turnedUp
Postion (36,36,900):  horizontal turnedUp
Postion (18,18,1008):  horizontal turnedUp
Postion (-36,1080,0):  upsideDown
Postion (-36,-36,1080):  horizontal turnedUp
Postion (72,1134,0):
Postion (54,18,1314):  horizontal
Postion (54,54,1386):  horizontal
Postion (18,144,1404):  horizontal
Postion (-36,198,1386):  horizontal
Postion (-72,234,1296):
Postion (-54,108,1152):  horizontal
Postion (-396,-72,936):  horizontal turnedUp
Postion (-864,-198,1080):  horizontal left turnedUp
Postion (-504,-36,918):  horizontal turnedUp
Postion (-504,54,1026):  horizontal turnedUp
Postion (-414,54,1098):  horizontal turnedUp
Postion (18,-54,774):  horizontal
Postion (234,-288,378):
Postion (180,-666,18):
Postion (414,-720,216):
Postion (-36,-1080,0):  vertical
Postion (90,-774,-72):
Postion (126,-270,-216):
Postion (234,702,360):
Postion (-360,378,-2304):
Postion (864,1170,-918):  right turnedDown
Postion (126,702,-1800):
Postion (288,558,-1494):
Postion (270,288,-1314):
Postion (54,108,-1206):  horizontal
Postion (108,162,-1098):  horizontal turnedDown
Postion (288,108,-882):  horizontal turnedDown
Postion (342,162,-792):  horizontal
Postion (270,72,-828):  horizontal turnedDown
Postion (306,36,-972):  horizontal turnedDown
Postion (306,90,-1188):  horizontal
Postion (270,324,-1332):
Postion (180,396,-1278):
Postion (126,450,-1386):
Postion (-36,522,-1674):
Postion (36,270,-1404):
Postion (180,90,-1080):  horizontal turnedDown
Postion (72,72,-1044):  horizontal turnedDown
Postion (54,90,-1044):  horizontal turnedDown
Postion (-18,72,-1080):  horizontal turnedDown
Postion (18,72,-1026):  horizontal turnedDown
Postion (18,36,-1080):  horizontal turnedDown
Postion (18,36,-1134):  horizontal
Postion (36,36,-1098):  horizontal turnedDown
Postion (54,36,-1098):  horizontal turnedDown
Postion (90,54,-1080):  horizontal turnedDown

OpenMoko Rotate now using libxrandr

As I peeked into the code of OpenMoko’s Rotate (a program that rotates the screen acording to the current tilt), I noticed it made use of system to launch the xrandr program with appropriate arguments.

Well, system costs a lot in terms of processing power, not to mention launching another program, and that means even less battery time. I didn’t like that, so I wrote a patch that alters the current rotate.c into a new rotate.c in order to use librandr and get it to rotate the screen without the costly system+xrandr duo from hell.

I also built a binary of rotate, which you can download from this link and place on your OpenMoko Neo Freerunner with 2008.8 or 2008.9 (I haven’t the foggiest idea if it works on other versions).

Hopefully, you might want to verify the sha1sums:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

afc833b7cd2c874c1c815a0cb9f7c38a65998ff5  rotate
efcc6277080b2aadc3306a000a97ab202ca2bece  rotate.c
c1eb847d05cd36e0e9f31b5e5f6eb9337f730d0f  rotate_libxrandr.patch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFI1ES1o+C50no0+t4RAjSrAJ41N0KpD7JaY3WfiRViexn4CvQw7QCePNr3
G8Z3ejIwprpK7J7unjMaS1A=
=anNm
-----END PGP SIGNATURE-----

I realise the way I wrote didn’t make it very obvious, so here’s a listing of the files: