Rotate is a Python script to activate the automatic rotation of the screen of our Nokia N900 and change to landscape or portrait mode automatically.

The steps to create and install rotate.py are:
- Create the file in python (or download at the end of post, then go directly to step 4). we can use, for example, the program ConTEXT.
- Copy and paste the following lines :
from ctypes import * import os import sys import time from math import atan2 from pprint import pprint xlib = cdll.LoadLibrary("libX11.so.6") rr = cdll.LoadLibrary("libXrandr.so.2") def get_rotation(): f = open("/sys/class/i2c-adapter/i2c-3/3-001d/coord", 'r' ) coords = [int(w) for w in f.readline().split()] f.close() return coords print get_rotation() def rotate(angle): rr.XRRSetScreenConfigAndRate(display,config,root,size,angle,rate,timestamp) display = xlib.XOpenDisplay(os.getenv("DISPLAY")) screen = xlib.XDefaultScreen(display) root = xlib.XDefaultRootWindow(display, screen) class XRRScreenConfiguration(Structure): pass gsi = rr.XRRGetScreenInfo gsi.restype = POINTER(XRRScreenConfiguration) config = gsi(display, root) current_time = c_ulong() rr.XRRTimes.restpye = c_ulong timestamp = rr.XRRTimes(display, screen, byref(current_time)) xccr = rr.XRRConfigCurrentRate xccr.restype = c_int rate = xccr(config) rotation = c_ushort() size = rr.XRRConfigCurrentConfiguration(config, byref(rotation)) while True: [x,y,z] = get_rotation() print x,y,z if y < -500: rotate(1) elif y > 500: rotate(4) elif x < -500: rotate(2) elif x > 500: rotate(8) time.sleep(1) - Save the document with the name rotate.py (PY is the Python file extension)
- Copy in a folder on the N900 the file rotate.py.
- Start xterm on N900 and type :
python rotate.py
Download | rotate.py
Via | HDBlog.it

hi all….it works for me and it quite helpful too…im happy having this function in my n900…..those who hav problm with it…i suggest u to follow the steps as showed by teo……
1.copy the( rotate.py) file in ( .document ) in ur N900
2.run xterm
3.write…. cd MyDocs/.documents….press enter …then
4.write…. python rotate.py…press enter…
after pressing enter it will show numbers….minimize the xterm and enjoy…
if u want to disable it just close the xterm….gudluck
thanks ashan…it’s work’s on my n900 to
do you have to have python installed? i am not techy, can follow instructions, but havent done anything python on my n900 as dont know really what it is……But am soooo desperate to have portrate mode……
I tried but failed anybody help me to install and run this application.
i did everything but it didn’t work,, file not found
hey man bro… please tell me how to do this… i am new in this phone field so please tell me… ill be very thankfull to you ahsan.. salam how r u?
so in order to have a portrait mode, do we need to do this every time and always keep xterm open?
Not working properly since all the alignments are going shambolic …this will be good to demonstrate someone that n900 also rotating its screen as android and iphone.
1.copy the( rotate.py) file in ( .document ) in ur N900
2.open xterm
3.write—-> cd MyDocs/.documents and then press enter …then
4.write—-> python rotate.py and then press enter
after pressing enter it will show numbers….minimize the xterm and enjoy…
if u want to disable it just close the xterm….gudluck
This program reboot my n900 when I play bouncer or angry bird games.
I tried but failed anybody help me to install and run this application.
hello
it works but only half a screen
If you try and it did not work
do this:
Connect to the internet and open the X-terminal
Write:
——————–
root
apt-get install python
exit
cd MyDocs
python rotate.py
——————–
Then it should works find…………….but it is not very good
tank you for your support.
it says python rotate.py not found.whats going on how do i fix this?
i cant do this plz help me on my id my name is shazia if u want to talk with u can do plz plz help me
Nice phone but nokia fuck it up whit no screen rotation that’s the only reason I want to sell the phone
You need 2 hands for most app
I thinks thats why they are getting behind .
What is going on nokia wake up change you crapy simbyan or what ever you call it
It used to be great but now is just ridiculous and maemo is good but not for regular people
i cant access to it..it says rotate.py not found or no directory…..what should i do….please help…thanks….
this works…awsum was waiting s despirately for thgis mode….
but it works on half screen..
hi Friend.. How i can open X term? what i need to do to open the x term? Thanks..
hi.i run the exterminal and i can rotate my screen n900 but when i closed the exterminal my screen mob not rotate..what can i do?
koi janta hai nokia n900 main android kaise install hoga to plz plz apna number do plz plz
is this for phone dils only? how about the sms?
phone dials i mean