RotateScreen for Nokia N900

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.

 

rotatescreen N900 RotateScreen for Nokia N900

 


The steps to create and install rotate.py are:

 

  1. 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.
  2. 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)
    
  3. Save the document with the name rotate.py (PY is the Python file extension)
  4. Copy in a folder on the N900 the file rotate.py.
  5. Start xterm on N900 and type :
    python rotate.py

 

Download | rotate.py

Via | HDBlog.it

This entry was posted in Maemo Applications and tagged , , , , . Bookmark the permalink.
Related Posts:

74 Responses to RotateScreen for Nokia N900

  1. noman ahsan says:

    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

  2. emil says:

    thanks ashan…it’s work’s on my n900 to :P

  3. Simon Hickman says:

    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……

  4. shahid ali says:

    I tried but failed anybody help me to install and run this application.

  5. ray alvin lopez says:

    i did everything but it didn’t work,, file not found

  6. Jexo says:

    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?

  7. Robert says:

    so in order to have a portrait mode, do we need to do this every time and always keep xterm open?

  8. Dushan says:

    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.

  9. dj says:

    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

  10. albwee says:

    This program reboot my n900 when I play bouncer or angry bird games.

  11. praveen says:

    I tried but failed anybody help me to install and run this application.

  12. venusingri says:

    hello
    it works but only half a screen

  13. GanGs_KiD says:

    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

  14. noman sharif says:

    tank you for your support.

  15. mark says:

    it says python rotate.py not found.whats going on how do i fix this?

  16. sweet.roses says:

    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

  17. Gg says:

    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

  18. David says:

    i cant access to it..it says rotate.py not found or no directory…..what should i do….please help…thanks….

  19. ritika says:

    this works…awsum was waiting s despirately for thgis mode….
    but it works on half screen..

  20. Beginner says:

    hi Friend.. How i can open X term? what i need to do to open the x term? Thanks..

  21. noman says:

    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?

  22. waseem says:

    koi janta hai nokia n900 main android kaise install hoga to plz plz apna number do plz plz

  23. jaerie says:

    is this for phone dils only? how about the sms?

  24. jaerie says:

    phone dials i mean

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>