Merge "ODROID: Enable invert touch screen." into odroidn2-4.9.y-android

This commit is contained in:
Chris Kim
2019-01-07 14:13:20 +09:00
committed by Gerrit Code Review
2 changed files with 62 additions and 4 deletions

View File

@@ -607,6 +607,8 @@ static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
return input_mt_get_slot_by_key(input, td->curdata.contactid);
}
extern bool touch_invert_x;
extern bool touch_invert_y;
/*
* this function is called when a whole contact has been processed,
* so that it can assign it to a slot and store the data there
@@ -647,8 +649,18 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
int major = max(s->w, s->h) >> 1;
int minor = min(s->w, s->h) >> 1;
input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
if (touch_invert_x)
input_event(input, EV_ABS, ABS_MT_POSITION_X,
input->absinfo[0].maximum - s->x);
else
input_event(input, EV_ABS, ABS_MT_POSITION_X,
s->x);
if (touch_invert_y)
input_event(input, EV_ABS, ABS_MT_POSITION_Y,
input->absinfo[1].maximum - s->y);
else
input_event(input, EV_ABS, ABS_MT_POSITION_Y,
s->y);
input_event(input, EV_ABS, ABS_MT_TOOL_X, s->cx);
input_event(input, EV_ABS, ABS_MT_TOOL_Y, s->cy);
input_event(input, EV_ABS, ABS_MT_DISTANCE,

View File

@@ -123,6 +123,42 @@ struct dwav_usb_mt {
struct finger_t *finger;
};
bool touch_invert_x;
/*-------------------------------------------------------------------------*/
static int __init touch_invert_x_para_setup(char *s)
{
touch_invert_x = false;
if (!strncmp(s, "true", 4))
touch_invert_x = true;
else if (!strncmp(s, "false", 5))
touch_invert_x = false;
else {
pr_err("%s - wrong touch_invert_x parameter", __func__);
touch_invert_x = true;
}
return 0;
}
__setup("touch_invert_x=", touch_invert_x_para_setup);
bool touch_invert_y;
/*-------------------------------------------------------------------------*/
static int __init touch_invert_y_para_setup(char *s)
{
touch_invert_y = false;
if (!strncmp(s, "true", 4))
touch_invert_y = true;
else if (!strncmp(s, "false", 5))
touch_invert_y = false;
else {
pr_err("%s - wrong touch_invert_y parameter", __func__);
touch_invert_y = true;
}
return 0;
}
__setup("touch_invert_y=", touch_invert_y_para_setup);
/*-------------------------------------------------------------------------*/
static void dwav_usb_mt_report(struct dwav_usb_mt *dwav_usb_mt)
{
@@ -147,10 +183,20 @@ static void dwav_usb_mt_report(struct dwav_usb_mt *dwav_usb_mt)
if (dwav_usb_mt->finger[id].status != TS_EVENT_RELEASE) {
input_mt_report_slot_state(dwav_usb_mt->input,
MT_TOOL_FINGER, true);
input_report_abs(dwav_usb_mt->input,
if (touch_invert_x)
input_report_abs(dwav_usb_mt->input,
ABS_MT_POSITION_X,
max_x - dwav_usb_mt->finger[id].x);
else
input_report_abs(dwav_usb_mt->input,
ABS_MT_POSITION_X,
dwav_usb_mt->finger[id].x);
input_report_abs(dwav_usb_mt->input,
if (touch_invert_y)
input_report_abs(dwav_usb_mt->input,
ABS_MT_POSITION_Y,
max_y - dwav_usb_mt->finger[id].y);
else
input_report_abs(dwav_usb_mt->input,
ABS_MT_POSITION_Y,
dwav_usb_mt->finger[id].y);
input_report_abs(dwav_usb_mt->input,