aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2016-04-22 17:30:53 -0400
committerJiri Kosina <jkosina@suse.cz>2016-05-03 05:55:05 -0400
commitbef7e200065086e2ceef091f6853f3b053ad2ba9 (patch)
tree97ff7ba5b20414fb89444970a5cfbb2a5e34031f
parent1c74a7f812b135d3df41d7c3671b647aed6467bf (diff)
HID: wacom: Add fuzz factor to distance and tilt axes
The fuzz present on the distance and tilt axes is noticable when a puck is present, and userspace (specifically libinput) would like the ability to filter out the noise. To facilitate this, we assign a fuzz value of '1' for the distance and tilt axes. This is large enough to cover most of the natural variation in distance value as the puck is moved around, and enough to cover the jitter in rotation (reported through tilt axes) when the puck is left alone. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/wacom_sys.c3
-rw-r--r--drivers/hid/wacom_wac.c13
-rw-r--r--drivers/hid/wacom_wac.h1
3 files changed, 10 insertions, 7 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index ccf1883318c3..499cc8213cfe 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -493,7 +493,8 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
493 features->x_fuzz = 4; 493 features->x_fuzz = 4;
494 features->y_fuzz = 4; 494 features->y_fuzz = 4;
495 features->pressure_fuzz = 0; 495 features->pressure_fuzz = 0;
496 features->distance_fuzz = 0; 496 features->distance_fuzz = 1;
497 features->tilt_fuzz = 1;
497 498
498 /* 499 /*
499 * The wireless device HID is basic and layout conflicts with 500 * The wireless device HID is basic and layout conflicts with
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 02c4efea241c..ea949cb2ec1e 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2343,12 +2343,13 @@ static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac)
2343 __set_bit(BTN_STYLUS2, input_dev->keybit); 2343 __set_bit(BTN_STYLUS2, input_dev->keybit);
2344 2344
2345 input_set_abs_params(input_dev, ABS_DISTANCE, 2345 input_set_abs_params(input_dev, ABS_DISTANCE,
2346 0, wacom_wac->features.distance_max, 0, 0); 2346 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0);
2347} 2347}
2348 2348
2349static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) 2349static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
2350{ 2350{
2351 struct input_dev *input_dev = wacom_wac->pen_input; 2351 struct input_dev *input_dev = wacom_wac->pen_input;
2352 struct wacom_features *features = &wacom_wac->features;
2352 2353
2353 wacom_setup_basic_pro_pen(wacom_wac); 2354 wacom_setup_basic_pro_pen(wacom_wac);
2354 2355
@@ -2358,9 +2359,9 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
2358 __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); 2359 __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
2359 2360
2360 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); 2361 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
2361 input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0); 2362 input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0);
2362 input_abs_set_res(input_dev, ABS_TILT_X, 57); 2363 input_abs_set_res(input_dev, ABS_TILT_X, 57);
2363 input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0); 2364 input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0);
2364 input_abs_set_res(input_dev, ABS_TILT_Y, 57); 2365 input_abs_set_res(input_dev, ABS_TILT_Y, 57);
2365} 2366}
2366 2367
@@ -2506,7 +2507,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
2506 case WACOM_G4: 2507 case WACOM_G4:
2507 input_set_abs_params(input_dev, ABS_DISTANCE, 0, 2508 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
2508 features->distance_max, 2509 features->distance_max,
2509 0, 0); 2510 features->distance_fuzz, 0);
2510 /* fall through */ 2511 /* fall through */
2511 2512
2512 case GRAPHIRE: 2513 case GRAPHIRE:
@@ -2568,7 +2569,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
2568 2569
2569 input_set_abs_params(input_dev, ABS_DISTANCE, 0, 2570 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
2570 features->distance_max, 2571 features->distance_max,
2571 0, 0); 2572 features->distance_fuzz, 0);
2572 2573
2573 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 2574 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
2574 input_abs_set_res(input_dev, ABS_Z, 287); 2575 input_abs_set_res(input_dev, ABS_Z, 287);
@@ -2627,7 +2628,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
2627 __set_bit(BTN_STYLUS2, input_dev->keybit); 2628 __set_bit(BTN_STYLUS2, input_dev->keybit);
2628 input_set_abs_params(input_dev, ABS_DISTANCE, 0, 2629 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
2629 features->distance_max, 2630 features->distance_max,
2630 0, 0); 2631 features->distance_fuzz, 0);
2631 } 2632 }
2632 break; 2633 break;
2633 case BAMBOO_PAD: 2634 case BAMBOO_PAD:
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index e2084d914c14..53d16537fd2a 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -177,6 +177,7 @@ struct wacom_features {
177 int y_fuzz; 177 int y_fuzz;
178 int pressure_fuzz; 178 int pressure_fuzz;
179 int distance_fuzz; 179 int distance_fuzz;
180 int tilt_fuzz;
180 unsigned quirks; 181 unsigned quirks;
181 unsigned touch_max; 182 unsigned touch_max;
182 int oVid; 183 int oVid;