Skip to content

Commit

Permalink
ui_touch: compatible with coolpad F1
Browse files Browse the repository at this point in the history
Change-Id: I14dcaf624b4e4cbbaa59141defb998ceba85f861
  • Loading branch information
xiaolu committed Sep 16, 2014
1 parent d5c6061 commit a2f4e76
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions ui_touch.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ typedef struct {
int saw_pos_x; // Did this sequence have an ABS_MT_POSITION_X?
int saw_pos_y; // Did this sequence have an ABS_MT_POSITION_Y?
int saw_mt_report; // Did this sequence have an SYN_MT_REPORT?
int saw_mt_tracking_id;
int slide_right;
int slide_left;
point touch_min;
Expand Down Expand Up @@ -204,6 +205,10 @@ static int calibrate_touch(input_device *dev) {
dev->slot_current = 0;
dev->slide_right = 0;
dev->slide_left = 0;
dev->saw_pos_x = 0;
dev->saw_pos_y = 0;
dev->saw_mt_tracking_id = 0;
dev->saw_mt_report = 0;

memset(&info, 0, sizeof(info));
if (ioctl(dev->fd, EVIOCGABS(ABS_MT_POSITION_X), &info) == 0) {
Expand Down Expand Up @@ -704,13 +709,15 @@ static int input_callback(int fd, short revents, void *data) {

if (ev.type == EV_SYN) {
if (ev.code == SYN_MT_REPORT) {
if (dev.saw_pos_x && dev.saw_pos_y) {
dev.saw_pos_x = 0;
dev.saw_pos_y = 0;
} else
handle_release(&dev, &ev);
dev.saw_mt_report = 1;
if (!dev.saw_mt_tracking_id) {
if (dev.saw_pos_x && dev.saw_pos_y) {
dev.saw_pos_x = 0;
dev.saw_pos_y = 0;
} else
handle_release(&dev, &ev);
}
}
return 0;
} else if (ev.type == EV_REL) {
if (ev.code == REL_Y) {
// accumulate the up or down motion reported by
Expand Down Expand Up @@ -738,6 +745,7 @@ static int input_callback(int fd, short revents, void *data) {
dev.slot_current = ev.value;
break;
case ABS_MT_TRACKING_ID:
dev.saw_mt_tracking_id = 1;
dev.tracking_id = ev.value;
if (dev.tracking_id == -1 && dev.slot_current == 0)
handle_release(&dev, &ev);
Expand Down Expand Up @@ -788,6 +796,9 @@ static int input_callback(int fd, short revents, void *data) {
default:
break;
}
} else if (ev.type == EV_KEY) {
if (dev.saw_mt_report && dev.saw_mt_tracking_id && ev.code == BTN_TOUCH && ev.value == 0)
handle_release(&dev, &ev);
} else {
rel_sum = 0;
}
Expand Down

0 comments on commit a2f4e76

Please sign in to comment.