Hi there,
I have implemented three essential mtouch callback function - get_contact_id, is_contact_down and get_coords. Here’s my current implementation of is_contact_down.
static int is_contact_down(void *packet, uint8_t digit_idx, int *valid, void *arg)
{
struct tp_event *message = packet;
uint32_t i;
if (!packet && !valid) {
mtouch_error(NOVATEK_DEVNAME, "Argument pointer packet/valid is NULL!");
return -1;
} else {
*valid = 0;
if (message->touch_point[digit_idx].valid) {
*valid = message->touch_point[digit_idx].status;
if (ts->verbose >= 5) {
mtouch_info(NOVATEK_DEVNAME, "%s: DigitIdx = %d is %s, num_touchpoints/%d", __func__,
digit_idx, (*valid) ? "Down" : "Up", message->num_touchpoints);
}
} else {
if (ts->verbose >= 7) {
mtouch_info(NOVATEK_DEVNAME, "%s: No touch with digit_idx %u", __func__, digit_idx);
}
return EOK;
}
}
return EOK;
}
It’s fine now but I found that when the line which assigns 0 to “*valid” (*valid = 0) is removed, the console will show below error logs:
libinputevents[ERROR]: Mtouch device has inconsistent digit ordering and MTOUCH_FLAGS_INCONSISTENT_DIGIT_ORDER isn’t specified
It means that I need to report the touch point is up (the touch finger leaves the touch screen) despite the touch point isn’t originally active (down/move) for the input digit idx.
Take below case for example,
Frame (N-1): ID 1, 3 and 4 are moving
Frame (N): ID 1 and 3 are moving, ID 4 has leaved
Frame (N+1): ID 1 and 3 are moving
Let’s assumen that the maximum touch poiints are 5 and the correct way to report is as follows.
Frame (N-1): report ID 1, 3 and 4 are valid, additionally report ID 2 and 5 are invalid
Frame (N): report ID 1 and 3 are valid, ID 4 is invalid, additionally report ID 2 and 5 are invalid
Frame (N+1): report ID 1 and 3 are valid, additionally report ID 2, 4 and 5 are invalid
The error logs mentioned above will show if I report in the below way.
Frame (N-1): report ID 1, 3 and 4 are valid
Frame (N): report ID 1 and 3 are valid, ID 4 is invalid
Frame (N+1): report ID 1 and 3 are valid
Does anyone know that the reason I have to report in that way?
Thanks a lot in advance.