pvbrowser/pvb

BOTTON location problem in touchscreen

xwang98 opened this issue · 11 comments

We tested a simple pvs application with the pvb on a touchscreen tablet, with tslib and linux buffer frame mode.

We noticed a problem. In a mask with multiple buttons, when we touch button A, then button B, then button A... The event ID received in the pvs is often the previous button pressed, rather than current pressed button.

We have a theory about it but not confirmed yet: the PVB may only update the mouse position on MOUSE_OVER and MOUSE_RELEASE event, but on touchscreen there is no MOUSE_OVER event, so when touch down a button, the mouse position used is actually for previous pressed button.

We have very little knowledge about QT and PVB internals. Can anyone give some advices and clues here? much appreciated!

Hi!

I already used pvbrowser under debian and a touchscreen with no issues. (here ---> https://savannah.nongnu.org/projects/rb1000)

I'd suggest to test your app in a desktop, and double check your mask.cpp, perhaps the id of your buttons are exchanged int the enum and/or static const char *widgetName[] structures. (at the top of the file)

also pvbrowser will be able to help you better for sure

cheers

Thanks, @gentooza!

We tested the app from desktop and there is no any issue. The problem was found in our project software originally. To validate it, we wrote a simple pvs with single mask. The problem is still there.

We use the standard Qt QPushButton there.
Thus it should work, if Qt does mouse handling correctly.
I assume Qt does this correctly.

In order to test i connected to out pvsexample with an Android tablet and
verified that button handling is OK for me.

Please connect to
pv://pvbrowser.org
and click icon "SVG1".
There you see a simple SVG demo with some buttons on the right.

Now try the buttons "Hello" and "World" repeatedly.

Thank you! Yes, it works fine on my Android phone too.

The platform we used is Linux with framebuffer, which may have different behavior with Android. We will test the sample application from our tablet tomorrow.

We plan to test a native QT program on our platform to check if it is related with PVB.

@pvbrowser,

We have build the native QT sample calculator and it has the sample problem. so it should not be the PVB issue.

But our work is kind of stuck here.. we run the "evtest" and the event from touchscreen seems no problem. so it is QT5.5 inside issue? That is something we really don't want to touch.

We are thinking finding another tablet from different vendor, and give it another shot.

Any advice on how to progress it is really appreciated!

we pasted some evtest log here:

Event: time 1513740139.422620, type 3 (EV_ABS), code 0 (ABS_X), value 397
Event: time 1513740139.422628, type 3 (EV_ABS), code 1 (ABS_Y), value 134
Event: time 1513740139.422633, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 20
Event: time 1513740139.422639, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1513740139.422655, -------------- EV_SYN ------------
Event: time 1513740139.535869, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
Event: time 1513740139.535877, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1513740139.535893, -------------- EV_SYN ------------

Event: time 1513740165.657625, type 3 (EV_ABS), code 0 (ABS_X), value 127
Event: time 1513740165.657635, type 3 (EV_ABS), code 1 (ABS_Y), value 184
Event: time 1513740165.657640, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 20
Event: time 1513740165.657646, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1513740165.657664, -------------- EV_SYN ------------
Event: time 1513740165.769941, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
Event: time 1513740165.769947, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1513740165.769961, -------------- EV_SYN ------------

If a bugreport to Digia for the Qt problem is not possible
the following workaround might be possible:

Modify the pvbrowser Sources a little bit in order to poll your own hardware.

Edit pvb/pvserver/util.cpp
Search for "int pvPollEvent(" function.
Locate lines
####################
/* call select /
ret = select(maxfdp1,&rset,&wset,&eset,&timeout);
if(ret == 0) /
timeout */
{
####################
within pvPollEvent function.

There you might try to catch the events that directly come from your hardware.

Insert something like the following in order to generate a TEXT_EVENT for the pvserver that will contain the parameters.
####################
/* call select /
ret = select(maxfdp1,&rset,&wset,&eset,&timeout);
if(ret == 0) /
timeout */
{
if(clientIsRunningOnLocalhost)
{
if(pollMyHardware(&ABS_X, &ABS_Y, &ABS_PRESSURE))
{
sprintf(event,"text(0,"MyHardware:%d %d %d")\n", ABS_X, ABS_Y, ABS_PRESSURE);
return 0;
}
}
// snip...
####################
That will result in a call of
slotTextEvent() with id=0 and text="MyHardware:x y pressure"

Within your pvserver you will then have to do a "hitText" in order to find the button that was clicked.

PS: p->url should contain "localhost" if the according client is running on localhost

If polling your own hardware is fast enough in the cycletime in which
slotNullEvent()
is called,
you may handle the mouse events there and do not need to modify sourcecode of the framework.

PS: If you run ./your_pvserver -sleep=100 the ccletime will be 100 msec.

Another thought:
You can handle YourHardware that generates touch events like any other hardware that acquires measurement values.

This could also be done within a separate process.
The output could be written to a rlSharedMemory / rlMailbox or even a palin textfile (may be within a RAMDISK)

In slotNullEvent() you can then react on these values.

@pvbrowser , thanks a lots for the advice!

If we fetch the touchscreen event from pvs or other assistance process, then the pvb won't have chance to handle the event? other widgets like wheel still require the event to be functional.

You could eventually handle these events (within the pvbrowser client).
http://doc.qt.io/qt-5/qabstractbutton.html#mouseMoveEvent
http://doc.qt.io/qt-5/qabstractbutton.html#mousePressEvent
http://doc.qt.io/qt-5/qabstractbutton.html#mouseReleaseEvent

as a substitude for SIGNAL(clicked())

See class: MyQPushButton

@pvbrowser The board vendor has sent us new board with upgraded touchscreen firmware and solved the problem. Thank you very much for the help!