Re: [QtMoko] QX touchscreen input do not work
Radek Polak pson...@seznam.cz writes: On Monday, September 10, 2012 08:17:05 PM Neil Jerram wrote: 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. Hi Neil, it's applied now. I tried in arora and it works good, so i expect QX to be working too - i will try later on Freerunner. I have one more accelerometer-patch, below. It changes QtMaze so that it doesn't run its own fast timer in parallel with the one in the accelerometer library. I've had this for a while, so I'm confident it's good for GTA04. It would be good to hear from GTA01/2 people that all accelerometer functions are still working correctly there. Regards, Neil From bc52c9b07bd05dfdad3a4dd2828a788b6f3fc3c9 Mon Sep 17 00:00:00 2001 From: Neil Jerram n...@ossau.homelinux.net Date: Sun, 29 Jul 2012 20:34:43 +0200 Subject: [PATCH 05/14] QtMaze: use accelerometer callback instead of running own timer --- src/3rdparty/games/qtmaze/form.cpp | 23 ++- src/3rdparty/games/qtmaze/form.h |5 +++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/3rdparty/games/qtmaze/form.cpp b/src/3rdparty/games/qtmaze/form.cpp index f021414..c02c97a 100644 --- a/src/3rdparty/games/qtmaze/form.cpp +++ b/src/3rdparty/games/qtmaze/form.cpp @@ -195,15 +195,10 @@ void Form::apply_temp_phys_res() post_phys_res(tmp_px,tmp_py, tmp_vx,tmp_vy); } -void Form::tout() +void Form::tout(double ax, double ay) { -//printf([acc] %.4f %.4f %.4f\n, getacx(), getacy(), getacz()); - new_game_state = GAME_STATE_NORMAL; -double ax = getacx(); -double ay = getacy(); - double mid_px=px, mid_py=py; double mid_vx=vx, mid_vy=vy; @@ -537,13 +532,13 @@ void Form::MoveBall(double x, double y) ballshadow_lbl-move(lpx+shadow_shift, lpy+shadow_shift); } -void Form::acc_timerAction() +void Form::acc_timerAction(double acx, double acy) { if (!fullscreen) return; if (game_state == GAME_STATE_NORMAL) { -tout(); +tout(acx, acy); if (game_state != GAME_STATE_NORMAL) { int bshift = (qt_game_config.hole_r - qt_game_config.ball_r) / 3; @@ -854,15 +849,11 @@ Form::Form(QWidget *parent, Qt::WFlags f) info1_lbl-setText( font color=\#e0bc70\ size=\ FONT_SIZE \Touch the screen to continue/font ); InitState(); -accelerometer_start(0, NULL, NULL); +accelerometer_start(PROC_ACC_DATA_INTERVAL, Form::accel_callback, this); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(timerAction())); -QTimer *acc_timer = new QTimer(this); -connect(acc_timer, SIGNAL(timeout()), this, SLOT(acc_timerAction())); -acc_timer-start(PROC_ACC_DATA_INTERVAL); - installEventFilter(this); this-levelno_lbl-installEventFilter(this); this-info1_lbl-installEventFilter(this); @@ -884,3 +875,9 @@ Form::~Form() { // no need to delete child widgets, Qt does it all for us } + +void Form::accel_callback(void *closure, double acx, double acy, double acz) +{ + Form *form = (Form *)closure; + form-acc_timerAction(acx, acy); +} diff --git a/src/3rdparty/games/qtmaze/form.h b/src/3rdparty/games/qtmaze/form.h index 9af8422..68f2e17 100644 --- a/src/3rdparty/games/qtmaze/form.h +++ b/src/3rdparty/games/qtmaze/form.h @@ -49,12 +49,14 @@ private: void ProcessGameState(); int testbump(double x,double y, double mm_vx,double mm_vy); int edgebump(int tx,int ty, double x,double y, double mm_vx,double mm_vy); -void tout(); +void tout(double ax, double ay); void apply_temp_phys_res(); void post_temp_phys_res(double x, double y, double mm_vx, double mm_vy); void post_phys_res(double x, double y, double mm_vx, double mm_vy); void BumpVibrate(double speed); void setButtonsPics(); +void acc_timerAction(double acx, double acy); +static void accel_callback(void *closure, double acx, double acy, double acz); public: Form( QWidget *parent = 0, Qt::WFlags f = 0 ); @@ -62,7 +64,6 @@ public: private slots: void timerAction(); -void acc_timerAction(); bool eventFilter(QObject *target, QEvent *event); void ScreenTouchedPause(); void ScreenTouchedContinue(); -- 1.7.10.4 ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: [QtMoko] QX touchscreen input do not work
On Sunday, September 16, 2012 01:02:23 AM francesco.dev...@mailoo.org wrote: I get the message SDL: unable to load mouse, after a research I see that I can use export SDL_NOMOUSE=1 to get rid of the message above but, obviously, I lose the the touchscreen inputs... how did you solve this issue? IIRC it worked out of the box on GTA04. Maybe you need to set SDL_MOUSEDEV 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
About the rotate screen option in QX, is it using xrandr to make the rotation? If so, one must installs x11-xserver-utils to get xrandr. Maybe this package can be installed automatically by the same script which installs xorg/xglamo in QX. You can try e.g: export SDL_VIDEODRIVER=fbcon apt-get install scummvm scummvm I get the message SDL: unable to load mouse, after a research I see that I can use export SDL_NOMOUSE=1 to get rid of the message above but, obviously, I lose the the touchscreen inputs... how did you solve this issue? Regards Joif ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: [QtMoko] QX touchscreen input do not work
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
It should rotate the screen according to accelerometers. I cant remember if this was ever working with Xglamo or not. Sorry I was wrong, it works with xglamo but as I said before it's impossible to use the landscape mode. I'll check again the xorg.conf of xglamo and xorg-glamo and I'll try again with the latest. Regards Joif ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: [QtMoko] QX touchscreen input do not work
On Monday, September 10, 2012 08:17:05 PM Neil Jerram wrote: 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. Hi Neil, it's applied now. I tried in arora and it works good, so i expect QX to be working too - i will try later on Freerunner. Btw has anyone figured how to rotate X server on GTA04? 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
Radek Polak pson...@seznam.cz writes: On Monday, September 10, 2012 08:17:05 PM Neil Jerram wrote: 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. Hi Neil, it's applied now. I tried in arora and it works good, so i expect QX to be working too - i will try later on Freerunner. Great, thanks! Btw has anyone figured how to rotate X server on GTA04? No, I don't think so. I tried for a while before moving onto QtMoko, but didn't manage to understand the omapfb X driver. And Neil Brown said recently that it was on his list of things he wanted to do but couldn't yet. Regards, Neil ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: [QtMoko] QX touchscreen input do not work
Hi I tryed again with xserver-xorg-video-glamo, I was wrong again because the touchpad works well. The rotate screen option in QX works and the landscape mode is usable in this case. But the touchpad input is not rotated as well. For now on my neo I'm using a script to launch under QX to get apps in landscape mode: sleep 5# it seems that we have to wait some time before sending commands xrandr -o 1 xinput set-int-prop Touchscreen Evdev Axis Inversion 8 0 1 xinput set-int-prop Touchscreen Evdev Axes Swap 8 0 xinput set-int-prop Touchscreen Evdev Axis Calibration 32 98 911 918 107 Regards Joif ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: [QtMoko] QX touchscreen input do not work
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
Re: [QtMoko] QX touchscreen input do not work
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 n...@ossau.homelinux.net 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 stdlib.h +#include accelerometers.h + /** * The acceleromer algorithms and code taken from omnewrotate-0.5.4 * Copyright © 2008 Rui Miguel Silva Seabra r...@1407.org @@ -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 @@
Re: [QtMoko] QX touchscreen input do not work
On Friday, September 07, 2012 10:00:40 PM francesco.dev...@mailoo.org wrote: Hi! I'm playing with QX on QtMoko v47 but it seems that the touchscreen inputs do not work, if I tap or try any movement on the screen nothing happens. This problem happened also with the previous version of QtMoko. I installed xserver-xorg-video-glamo when QX asked it and this is 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. Regards Radek ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community