Issues with fbcon rotation and tslib

Greetings!

My hardware is a Zaurus C-1000 “akita” and i’m running SDL-1.2.14 on a
custom distro based on Openembedded.
The Zaurus default lcd orientation is portrait, meaning the default
resolution is 480x640. This means we have to use
fbcon rotation for a proper 640x480. I’m using SDL_VIDEO_FBCON_ROTATION=CW
for 640x480 and it works just fine.
The problem is tslib which seems to only support calibration for a
resolution provided by pxafb which in our case is 480x640.
This means that tslib coordinates are messed up when i use
SDL_VIDEO_FBCON_ROTATION=CW , ie, touching the screen across it’s x
coordinate
moves the cursor along the y coordinate and vice versa. The coordinates are
fine if i unset SDL_VIDEO_FBCON_ROTATION=CW and test with programs
that have their own rotate routines ie, Milkytracker. tslib has an option to
swap x and y coordinates. This fixes the x coordinate,
but the y coordinate is now inverted, touching the screen upwards on y
coordinate moves the cursor downward on y coordinate.
I have tried several things to fix this so far. First i wrote the following
sdl app to see what kind of coordinates is sdl getting:

#include <stdio.h>
#include “SDL.h”

int main(int argc, char** argv) {

SDL_Surface *screen;

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf(“Unable to initialize SDL: %s\n”, SDL_GetError());
return 1;
}

atexit(SDL_Quit);
screen = SDL_SetVideoMode(x, y, 0, SDL_SWSURFACE);
if (screen == NULL) {
printf(“Unable to set video mode: %s\n”, SDL_GetError());
return 1;
}
SDL_Event event;
int running = 1;

while(running) {
while(SDL_PollEvent(&event)) {
switch(event.type){
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_ESCAPE)
running=0;
else
printf(“key pressed\n”);
case SDL_MOUSEMOTION:
printf(“Current mouse position is: (%d, %d)\n”, event.motion.x,
event.motion.y);
break;
}
}
}
SDL_Quit();
return 0;
}

When i touch the lower left corner of the screen, this little app reports
coordinates close to (0,0) but the cursor is in the upper left corner.
I also modified the ts_calibrate app to calibrate for a user given
resolution, rather than the one provided by the pxafb. This had no effect on
the coordinates.
I tried swapping the coordinates in the handle_tslib() function in
SDL_fbevents.c. This had the same effect as telling tslib to swap the
coordinates.

I’m out of ideas and right now, i’m sure i dont understand the real problem
here. i’m also not entirely sure if this is a problem with tslib or sdl or
both.

If anyone has any ideas, please do tell.