Re: [QtMoko] QX touchscreen input do not work

2012-09-10 Thread Radek Polak
On Monday, September 10, 2012 06:18:15 PM francesco.dev...@mailoo.org wrote:

> > Maybe you can try to remove xserver-xorg-video-glamo and try Xglamo -
> > that one worked always better for me and it's even many times smaller in
> > size.
> 
> Thanks, now it works but it is impossible to rotate the screen in
> landscape mode, the entire screen becomes a mess.
> I tryed:
> # xrandr -o 1
> and
> # xrandr --output default --rotate left
> 
> with xserver-xorg-video-glamo this problem does not happen.
> 
> Also, in QX the option "rotate screen" does nothing, what should it do?

It should rotate the screen according to accelerometers. I cant remember if 
this was ever working with Xglamo or not.

Regards

Radek

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [QtMoko] QX touchscreen input do not work

2012-09-10 Thread Neil Jerram
francesco.dev...@mailoo.org writes:

> Also, in QX the option "rotate screen" does nothing, what should it do?

I have some theoretical patches for that (attached), but I haven't
offered them to Radek because I haven't really got QX working much at
all, and so I couldn't be sure if the QX rotation support was working.

The first attached patch is for the main QtMoko repository; the second
is for the Arora submodule.

Regards,
Neil

>From 2cdb6f0b0e8393379670efe7e4aee6e89056995d Mon Sep 17 00:00:00 2001
From: Neil Jerram 
Date: Tue, 17 Jul 2012 22:55:15 +0200
Subject: [PATCH] Improve accelerometer library, and use it in Arora and QX
 for autorotation

---
 src/3rdparty/applications/arora|2 +-
 src/3rdparty/applications/qx/qbuild.pro|1 +
 src/3rdparty/applications/qx/rotate.cpp|   76 
 src/3rdparty/applications/qx/rotate.h  |5 --
 src/3rdparty/games/qtmaze/form.cpp |2 +-
 src/libraries/accelerometer/accelerometers.cpp |   65 
 src/libraries/accelerometer/accelerometers.h   |6 +-
 7 files changed, 72 insertions(+), 85 deletions(-)

diff --git a/src/3rdparty/applications/arora b/src/3rdparty/applications/arora
index 6fe8d25..c4938dc 16
--- a/src/3rdparty/applications/arora
+++ b/src/3rdparty/applications/arora
@@ -1 +1 @@
-Subproject commit 6fe8d25fd36dbc29b5e6c479db1193e6523eeb7b
+Subproject commit c4938dce05b27426334cd32d594084fbd055880d
diff --git a/src/3rdparty/applications/qx/qbuild.pro b/src/3rdparty/applications/qx/qbuild.pro
index a22a561..3fbf3e7 100644
--- a/src/3rdparty/applications/qx/qbuild.pro
+++ b/src/3rdparty/applications/qx/qbuild.pro
@@ -4,6 +4,7 @@ TARGET=qx
 CONFIG+=qtopia
 LIBS+=-lX11 -lXtst
 DEFINES+=QTOPIA
+MODULES*=accelerometer
 
 # I18n info
 STRING_LANGUAGE=en_US
diff --git a/src/3rdparty/applications/qx/rotate.cpp b/src/3rdparty/applications/qx/rotate.cpp
index 52302d6..4463698 100644
--- a/src/3rdparty/applications/qx/rotate.cpp
+++ b/src/3rdparty/applications/qx/rotate.cpp
@@ -7,6 +7,8 @@
 
 #include 
 
+#include 
+
 /**
  * The acceleromer algorithms and code taken from omnewrotate-0.5.4
  * Copyright © 2008 Rui Miguel Silva Seabra 
@@ -55,9 +57,7 @@ RotateHelper::RotateHelper(QObject *parent, int dflg) : QObject(parent)
 	down = 0;
 	last_pos= -1;
 	current_pos = -1;
-	event3 = -1;
 	debug = dflg;
-	skip_zero = 1;
 	initial_rotation= -1;
 }
 
@@ -88,6 +88,9 @@ void RotateHelper::start(int timeinms)
 		stop();
 	}
 
+	// start accelerometer
+	accelerometer_start(timeinms, NULL, NULL);
+
 	// start up a single shot timer to check accelerometers
 	// it will be restarted each time
 	timer = new QTimer(this);
@@ -103,10 +106,8 @@ void RotateHelper::stop()
 		timer= NULL;
 	}
 
-	if(event3 != -1){
-		close(event3);
-		event3= -1;
-	}
+	// stop accelerometer
+	accelerometer_stop();
 }
 
 void rotate(int degree)
@@ -145,6 +146,10 @@ void RotateHelper::maybe_rotate(int deg)
 
 void RotateHelper::sample()
 {
+	x = 1000 * getacx();
+	y = 1000 * getacy();
+	z = 1000 * getacz();
+
 	if(packet_reader()){
 		int pos= define_position();
 		if(pos != last_pos)
@@ -218,66 +223,9 @@ int RotateHelper::define_position(void)
 	return current_pos;
 }
 
-
-int RotateHelper::read_packet()
-{
-	static struct input_event event_x, event_y, event_z, event_syn;
-	void *packet_memcpy_result = NULL;
-	int packet_size = sizeof(struct input_event);
-	int size_of_packet = 4 * packet_size;
-	int bytes_read = 0;
-	char packet[size_of_packet];
-
-	bytes_read = read(event3, packet, size_of_packet);
-
-	if (bytes_read < packet_size)
-	{
-		qWarning("RotateHelper: fread failed");
-		stop();
-		return -1;
-	}
-
-	/* obtain the full packet */
-	packet_memcpy_result = memcpy(&event_x,   packet,   packet_size);
-	packet_memcpy_result = memcpy(&event_y,   packet + packet_size, packet_size);
-	packet_memcpy_result = memcpy(&event_z,   packet + 2 * packet_size, packet_size);
-	packet_memcpy_result = memcpy(&event_syn, packet + 3 * packet_size, packet_size);
-
-	if(skip_zero && (event_x.value == 0 || event_y.value == 0 || event_z.value == 0))
-	{
-		//	qDebug("Bad packet!");
-		return(0);
-	}
-
-	if (event_syn.type == EV_SYN)
-	{
-		x = event_x.value;
-		y = event_y.value;
-		z = event_z.value;
-
-		return (1);
-	}
-	else
-		return (0);
-}
-
 bool RotateHelper::packet_reader()
 {
-	if(event3 == -1){
-		event3 = open(EVENT_PATH, O_RDONLY);
-
-		if (event3 < 0){
-			qWarning("Can't open '%s': %s\n", EVENT_PATH, strerror(errno));
-			return false;
-		}
-		qDebug("Opened: %s", EVENT_PATH);
-	}
-
-	while(read_packet() == 0);
-	
-	// qDebug("read packet");
-
-	return true;
+	return (x || y || z);
 }
 
 #else // QTOPIA
diff --git a/src/3rdparty/applications/qx/rotate.h b/src/3rdparty/applications/qx/rotate.h
index fdce73b..cfcc608 100644
--- a/src/3rdparty/applications/qx/rotate.h
+++ b/src/3rdparty/applications/qx/rotate.h
@@ -11,8 +11,6 @@
 
 #include 
 
-#define EVENT_PATH "/dev/inpu

Re: [QtMoko] QX touchscreen input do not work

2012-09-10 Thread francesco . devita



Maybe you can try to remove xserver-xorg-video-glamo and try Xglamo - that one
worked always better for me and it's even many times smaller in size.

Thanks, now it works but it is impossible to rotate the screen in 
landscape mode, the entire screen becomes a mess.

I tryed:
# xrandr -o 1
and
# xrandr --output default --rotate left

with xserver-xorg-video-glamo this problem does not happen.

Also, in QX the option "rotate screen" does nothing, what should it do?

Regards
Joif

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community