pi@raspberrypi:~ $ sudo evtest /dev/input/event2 Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0x192f product 0x416 version 0x111 Input device name: "USB Optical Mouse" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 272 (BTN_LEFT) Event code 273 (BTN_RIGHT) Event code 274 (BTN_MIDDLE) Event type 2 (EV_REL) Event code 0 (REL_X) Event code 1 (REL_Y) Event code 6 (REL_HWHEEL) Event code 8 (REL_WHEEL) Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Properties: Testing ... (interrupt to exit) Event: time 1502281968.518936, -------------- EV_SYN ------------ Event: time 1502281968.646926, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 Event: time 1502281968.646926, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0 Event: time 1502281968.646926, -------------- EV_SYN ------------ pi@raspberrypi:~ $ sudo evtest /dev/input/event3 Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0x3eb product 0x8a6e version 0x111 Input device name: "Atmel Atmel maXTouch Digitizer" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 330 (BTN_TOUCH) Event type 3 (EV_ABS) Event code 0 (ABS_X) Value 1078 Min 0 Max 4095 Resolution 12 Event code 1 (ABS_Y) Value 3218 Min 0 Max 4095 Resolution 15 Event code 47 (ABS_MT_SLOT) Value 0 Min 0 Max 9 Event code 53 (ABS_MT_POSITION_X) Value 0 Min 0 Max 4095 Resolution 12 Event code 54 (ABS_MT_POSITION_Y) Value 0 Min 0 Max 4095 Resolution 15 Event code 57 (ABS_MT_TRACKING_ID) Value 0 Min 0 Max 65535 Properties: Property type 1 (INPUT_PROP_DIRECT) Testing ... (interrupt to exit) Event: time 1502282136.626462, -------------- EV_SYN ------------ Event: time 1502282136.703407, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1 Event: time 1502282136.703407, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0 Event: time 1502282136.703407, -------------- EV_SYN ------------
gboolean Ctrl::GtkEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data)
void Switch::MouseMove(Point p, dword keyflags) { Cout() << "Switch::MouseMove(): "; ... } // Add log for the rest of events and try to understand the logic... void Switch::LeftDown(Point p, dword keyflags) { ... } void Switch::LeftUp(Point p, dword keyflags) { ... } void Switch::MouseLeave() { ... }
Cout() << "My message!" << "\n";
GDK_BUTTON_PRESS GDK_PROPERTY_NOTIFY Switch::MouseMove: pushindex: 3 value: 002 Switch::LeftDown: pushindex: 3 value: 002 GDK_EXPOSE GDK_BUTTON_RELEASE Switch::LeftUp (before the outer if cycle): pushindex: 3 value: 002 Switch::LeftUp (inside the outer if cycle): pushindex: 3 value: 002 Switch::LeftUp (inside the inner if cycle): pushindex: 3 v: 005 value: 002 Switch::LeftUp: pushindex: -1 value: 005
GDK_BUTTON_PRESS GDK_PROPERTY_NOTIFY Switch::MouseMove: pushindex: 3 value: 002 GDK_EXPOSE Switch::MouseMove: pushindex: 3 value: 002 Switch::LeftDown: pushindex: 3 value: 002 GDK_EXPOSE GDK_MOTION_NOTIFY GDK_BUTTON_RELEASE Switch::MouseMove: pushindex: -1 value: 002 GDK_EXPOSE Switch::LeftUp (before the outer if cycle): pushindex: -1 value: 002 Switch::LeftUp: pushindex: -1 value: 002
if(pushindex >= 0 && pushindex < cs.GetCount()) { RefreshCase(GetIndex()); const Value& v = cs[pushindex].value; if(v != value) { value = v; UpdateAction(); } RefreshCase(pushindex); }
int i = GetIndex(p); int a = -1; if(keyflags & K_MOUSELEFT) a = i; if(pushindex != a) { RefreshCase(pushindex); RefreshCase(a); pushindex = a; }
int i = GetIndex(p); // int a = -1; int a = pushindex; if(keyflags & K_MOUSELEFT) a = i; if(pushindex != a) { RefreshCase(pushindex); RefreshCase(a); pushindex = a; }
I will try to reach out the person who wrote Switch.cpp to see how we can work out things in a way that the touch screen is supported
I am happy you found the origin of that problem by yourself. I believe it is not, so hard
We need more people like you!!!
The patch must be accepted by Mirek - I will raise the ticket on redmine (Our bugtrack) to not forget your issue. Of course, it could take some time, so please be patient. Your current application might work with custom CtrlLib for now.
Klugier wrote on Thu, 10 August 2017 16:55
I am happy you found the origin of that problem by yourself. I believe it is not, so hard
Actually it wasn't so hard, but without your suggestion I would have been lost.
Klugier wrote on Thu, 10 August 2017 16:55
We need more people like you!!!
Well, we need more people like you from the U++ team my little debugging effort is the least I can do to give back to the U++ community.
Klugier wrote on Thu, 10 August 2017 16:55
The patch must be accepted by Mirek - I will raise the ticket on redmine (Our bugtrack) to not forget your issue. Of course, it could take some time, so please be patient. Your current application might work with custom CtrlLib for now.
No problem, the porting is just started...
Hi Mirek,
I am sorry not giving you feedback, but I am currently on a different project. Anyway, this "touch screen project" is really important in my company and I will provide you with any information/test/debugging you require.
Regards,
Giorgio
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09) drm_kms_helper 155648 1 i915 drm 360448 8 i915,drm_kms_helper /dev/fb0 /dev/dri/card0 /dev/dri/renderD128 /dev/dri/controlD64 BOOT_IMAGE=/boot/vmlinuz-4.9.0-4-amd64 root=UUID=98a2e6b5-fc24-44c8-92cb-52a8c17f70a9 ro quiet /etc/modprobe.d/ direct rendering: Yes server glx vendor string: SGI client glx vendor string: Mesa Project and SGI Vendor: Intel Open Source Technology Center (0x8086) OpenGL vendor string: Intel Open Source Technology Center [ 58.105] (II) LoadModule: "glx" [ 58.129] (II) LoadModule: "modesetting" [ 58.135] (II) LoadModule: "fbdev" [ 58.151] (II) LoadModule: "vesa" [ 58.153] (II) LoadModule: "fbdevhw" [ 58.164] (II) LoadModule: "glamoregl" [ 58.250] (II) LoadModule: "fb" [ 58.459] (II) LoadModule: "libinput"
p = [160, 138] p = [160, 138] p = [160, 138] p = [160, 138] p = [160, 138]
Hi Mirek,
sorry for the very late answer. The project of porting the application to a touch platform was put in hold by the Company I work for, only during these days I was finally able to resume it. Since the time when I reported the issue, there has been a change of the platform: we used a Raspbian on a Raspberry, now we moved to a Debian (latest, 9.3 stretch) on a standard PC. The touch screen is still an EloTouch. These are some details about drivers and configuration of the video:
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09) drm_kms_helper 155648 1 i915 drm 360448 8 i915,drm_kms_helper /dev/fb0 /dev/dri/card0 /dev/dri/renderD128 /dev/dri/controlD64 BOOT_IMAGE=/boot/vmlinuz-4.9.0-4-amd64 root=UUID=98a2e6b5-fc24-44c8-92cb-52a8c17f70a9 ro quiet /etc/modprobe.d/ direct rendering: Yes server glx vendor string: SGI client glx vendor string: Mesa Project and SGI Vendor: Intel Open Source Technology Center (0x8086) OpenGL vendor string: Intel Open Source Technology Center [ 58.105] (II) LoadModule: "glx" [ 58.129] (II) LoadModule: "modesetting" [ 58.135] (II) LoadModule: "fbdev" [ 58.151] (II) LoadModule: "vesa" [ 58.153] (II) LoadModule: "fbdevhw" [ 58.164] (II) LoadModule: "glamoregl" [ 58.250] (II) LoadModule: "fb" [ 58.459] (II) LoadModule: "libinput"
I added the DUMP(p) as per suggestion, and this is the result with a single tap on a switch control (note: this with the standard version of Switch.cpp, not the one I modified as described in this thread):
p = [160, 138] p = [160, 138] p = [160, 138] p = [160, 138] p = [160, 138]
I hope this could help and tell me if I should run some further tests.
Regards,
Gio
GDK_BUTTON_PRESS GDK_PROPERTY_NOTIFY Switch::MouseMove: pushindex: 3 value: 002 GDK_EXPOSE Switch::MouseMove: pushindex: 3 value: 002 Switch::LeftDown: pushindex: 3 value: 002 GDK_EXPOSE GDK_MOTION_NOTIFY GDK_BUTTON_RELEASE Switch::MouseMove: pushindex: -1 value: 002 GDK_EXPOSE Switch::LeftUp (before the outer if cycle): pushindex: -1 value: 002 Switch::LeftUp: pushindex: -1 value: 002
p = [158, 142] keyflags & K_MOUSELEFT = 8388608 p = [158, 142] keyflags & K_MOUSELEFT = 0 p = [158, 142] keyflags & K_MOUSELEFT = 0 p = [158, 142] keyflags & K_MOUSELEFT = 0 p = [158, 142] keyflags & K_MOUSELEFT = 0
this is the output after adding the DDUMP:
MouseMove p = [155, 136] keyflags & K_MOUSELEFT = 8388608 MouseMove p = [155, 136] keyflags & K_MOUSELEFT = 0 MouseMove p = [155, 136] keyflags & K_MOUSELEFT = 0 LeftDown p = [155, 136] keyflags & K_MOUSELEFT = 0 LeftUp p = [155, 136] keyflags & K_MOUSELEFT = 0 MouseMove
Hi Mirek,
this is the log with LOG() of a single tap (using the latest stable version of upp):
MouseMove p = [155, 136] keyflags & K_MOUSELEFT = 8388608 MouseMove p = [155, 136] keyflags & K_MOUSELEFT = 0 MouseMove p = [155, 136] keyflags & K_MOUSELEFT = 0 LeftDown p = [155, 136] keyflags & K_MOUSELEFT = 0 LeftUp p = [155, 136] keyflags & K_MOUSELEFT = 0 MouseMove
#include <CtrlCore/CtrlCore.h> #ifdef GUI_GTK namespace Upp { #define LLOG(x) // DLOG(rmsecs() << ' ' << x) #define LOG_EVENTS
void Ctrl::AddEvent(gpointer user_data, int type, const Value& value, GdkEvent *event) { if(Events.GetCount() > 50000) return; GEvent& e = Events.AddTail(); e.windowid = (uint32)(uintptr_t)user_data; e.type = type; e.value = value; gint x, y; GdkModifierType mod; gdk_window_get_pointer(gdk_get_default_root_window(), &x, &y, &mod); e.mousepos = Point(x, y); e.state = mod; e.count = 1; e.event = NULL; if(event) { e.time = gdk_event_get_time(event); e.event = gdk_event_copy(event); } else { e.time = gtk_get_current_event_time(); e.event = gtk_get_current_event(); } DUMPHEX(mod); }
I have tried to alter mouse flags code to reflect what have we learned so far. Can you retest with current trunk please? (Maybe backup Switch.cpp so that we can do those LOGs again)
LOG("MouseMove"); DUMP(p); DDUMP(keyflags & K_MOUSELEFT);
mirek wrote on Tue, 27 February 2018 09:15I have tried to alter mouse flags code to reflect what have we learned so far. Can you retest with current trunk please? (Maybe backup Switch.cpp so that we can do those LOGs again)
Hi Mirek,
I downloaded and compiled the latest nightly build (11829) and when I made a single touch over a Switch control and now the control works as expected.
Thank you for the fix!