Touch release not recognized

64 views
Skip to first unread message

Christian Schwarzgruber

unread,
Oct 13, 2014, 8:41:11 AM10/13/14
to ozon...@chromium.org
Hey,

the class TouchEventConverterEvdev does not recognize TOUCH_RELEASE of the touch device nor does it process TOUCH_MOVED correctly as
it gets overridden every time a new event comes in.

e.g. the touch panel driver reports the following events on a touch followed by a release.
Event: time 1174708153.552899, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1174708153.552899, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 296
Event: time 1174708153.552899, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 59
Event: time 1174708153.552899, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1174708153.552899, type 3 (EV_ABS), code 0 (ABS_X), value 296
Event: time 1174708153.552899, type 3 (EV_ABS), code 1 (ABS_Y), value 59
Event: time 1174708153.552899, -------------- SYN_REPORT ------------
Event: time 1174708153.587428, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 297
Event: time 1174708153.587428, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 56
Event: time 1174708153.587428, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1174708153.587428, type 3 (EV_ABS), code 0 (ABS_X), value 297
Event: time 1174708153.587428, type 3 (EV_ABS), code 1 (ABS_Y), value 56
Event: time 1174708153.587428, -------------- SYN_REPORT ------------
Event: time 1174708153.589122, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 304
Event: time 1174708153.589122, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 28
Event: time 1174708153.589122, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1174708153.589122, type 3 (EV_ABS), code 0 (ABS_X), value 304
Event: time 1174708153.589122, type 3 (EV_ABS), code 1 (ABS_Y), value 28
Event: time 1174708153.589122, -------------- SYN_REPORT ------------
Event: time 1174708153.591721, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1174708153.591721, -------------- SYN_REPORT ------------

NOTE: The ABS_X and ABS_Y values after a SYN_MT_REPORT are redundant and can be ignored.

The algorithm does process the BTN_TOUCH value=1 correctly, which indicates a  TOUCH_PRESSED
however the BTN_TOUCH value=0 is ignored in the algorithm, at least for type A devices.
A fix for this problem would be to add an if statement in the switch-case where the condition of the BTN_TOUCH value will be evaluated. 
void TouchEventConverterEvdev::ProcessInputEvent(const input_event& input) {
... // Some code
else if (input.type == EV_KEY) {
    VLOG
(1) << "ProcessInputEvent: " << "type = EV_KEY " << "code = "
           
<< input.code << " value = " << input.value;
   
switch (input.code) {
     
case BTN_TOUCH:
       
if (input.value == 0) {
          VLOG
(1) << "ProcessInputEvent: TOUCH_RELEASED";  // Now touch release would be processed correctly.
          altered_slots_
.set(current_slot_);
          events_
[current_slot_].type_ = ET_TOUCH_RELEASED;
       
}
       
break;
     
default:
        NOTIMPLEMENTED
() << "invalid code for EV_KEY: " << input.code;
   
}
 
}
... Even more code
}


But the line in
void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) {
... // Some code
     
// Subsequent events for this finger will be touch-move until it
     
// is released.
      events_
[i].type_ = ET_TOUCH_MOVED;
... // some more code
}

does nothing at all. As the next TOUCH_PRESSED event  (before release) will overwrite it.

Any help/advice would be appreciated.

regards,
    Christian

Michael Spang

unread,
Oct 14, 2014, 10:45:46 AM10/14/14
to Christian Schwarzgruber, ozon...@chromium.org
We typically use protocol B and so protocol A is untested (and apparently broken). Please file a bug.

Michael
Reply all
Reply to author
Forward
0 new messages