diff --git a/gslx680-acpi/gslx680_ts_acpi.c b/gslx680-acpi/gslx680_ts_acpi.c index 748cedb..d8781cc 100644 --- a/gslx680-acpi/gslx680_ts_acpi.c +++ b/gslx680-acpi/gslx680_ts_acpi.c @@ -84,6 +84,9 @@ static char *gsl_fw_name = NULL; module_param_named(fw_name, gsl_fw_name, charp, 0); +static int hysteresis = 0; +module_param(hysteresis, int, 0644); + /* Driver state */ enum gsl_ts_state { GSL_TS_INIT, @@ -335,7 +338,9 @@ static void gsl_ts_mt_event(struct gsl_ts_data *ts, u8 *buf) u8 i; u16 touches, tseq, x, y, id, pressure; struct input_mt_pos positions[GSL_MAX_CONTACTS]; + static struct input_mt_pos prev_positions[GSL_MAX_CONTACTS]; int slots[GSL_MAX_CONTACTS]; + int trigger_events = 0; header = (struct gsl_ts_packet_header *) buf; touches = header->num_fingers; @@ -370,6 +375,14 @@ static void gsl_ts_mt_event(struct gsl_ts_data *ts, u8 *buf) positions[i].x = x; positions[i].y = y; + + if(abs(positions[i].x - prev_positions[i].x) > hysteresis || + abs(positions[i].y - prev_positions[i].y) > hysteresis) { + trigger_events = 1; + prev_positions[i].x = positions[i].x; + prev_positions[i].y = positions[i].y; + } + if (!ts->soft_tracking) { slots[i] = id; } @@ -388,14 +401,16 @@ static void gsl_ts_mt_event(struct gsl_ts_data *ts, u8 *buf) return; } } - - for (i = 0; i < touches; i++) { - input_mt_slot(input, slots[i]); - input_mt_report_slot_state(input, MT_TOOL_FINGER, true); - input_report_abs(input, ABS_MT_POSITION_X, positions[i].x); - input_report_abs(input, ABS_MT_POSITION_Y, positions[i].y); + + if(trigger_events) { + for (i = 0; i < touches; i++) { + input_mt_slot(input, slots[i]); + input_mt_report_slot_state(input, MT_TOOL_FINGER, true); + input_report_abs(input, ABS_MT_POSITION_X, positions[i].x); + input_report_abs(input, ABS_MT_POSITION_Y, positions[i].y); + } } - + input_mt_sync_frame(input); input_sync(input); } @@ -771,5 +786,6 @@ module_i2c_driver(gslx680_ts_driver); MODULE_DESCRIPTION("GSLX680 touchscreen controller driver"); MODULE_AUTHOR("Gregor Riepl "); MODULE_PARM_DESC(fw_name, "firmware file name (default: " GSL_FW_NAME_DEFAULT ")"); +MODULE_PARM_DESC(hysteresis, "X,Y axes hysteresis. Default 0."); MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL");