RotateScreen para rotar la pantalla de tu Nokia N900
Escrito por Zer0mar 10
RotateScreen es un programa hacho en Python capaz de activar la rotación automática de la pantalla de nuestro Nokia N900, para pasarla a modo vertical u horizontal automáticamente.
deben realizar lo siguiente:
crear e instalar rotate.py
- Crear el archivo en python (o descargarlo del final del post si son medios araganes, si lo descargan pasemos al punto 4). Si no deseamos descargarlo podemos utilizar, por ejemplo, el programa ConTEXT.
- Copiamos y pegamos las siguientes líneas:
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) - Guarde el documento con el nombre de rotate.py (PY es la extensión de archivos Python)
- Copiar en una carpeta del N900 el archivo rotate.py.
- Iniciamos xterm en N900 y escribimos:
python rotate.py



Por favor deja un comentario