Discussion:
[Linuxwacom-devel] [PATCH input-wacom 1/4] backport: Input: wacom_w8001 - drop use of ABS_MT_TOOL_TYPE
Aaron Armstrong Skomra
2016-07-13 22:45:26 UTC
Permalink
As of e0361b70175 ("Input: wacom_w8001 - split the touch and pen devices
into two devices") the touch events aren't multiplexed over the same device
anymore, the use of ABS_MT_TOOL_TYPE is superfluous. And even before then
it only ever sent MT_TOOL_TYPE_FINGER anyway.

NOTES: 1) This patch backports the bug where
'input_mt_report_slot_state(dev, MT_TOOL_FINGER, touch);' has been removed.
This will be corrected in a subsequent patch.
2) This backport was accidentally skipped in the previous release and is
thus applied out of order.
3) e0361b70175 was only backported to 2.6.38 and 3.7.

Signed-off-by: Peter Hutterer <***@who-t.net>
Signed-off-by: Dmitry Torokhov <***@gmail.com>
[***@wacom.com: Imported into input-wacom repository (5f7e544)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (215a2f5)]
Signed-off-by: Aaron Skomra <***@wacom.com>
---
2.6.38/wacom_w8001.c | 3 ---
3.7/wacom_w8001.c | 3 ---
2 files changed, 6 deletions(-)

diff --git a/2.6.38/wacom_w8001.c b/2.6.38/wacom_w8001.c
index 7946419..1a33fad 100644
--- a/2.6.38/wacom_w8001.c
+++ b/2.6.38/wacom_w8001.c
@@ -155,7 +155,6 @@ static void parse_multi_touch(struct w8001 *w8001)
bool touch = data[0] & (1 << i);

input_mt_slot(dev, i);
- input_mt_report_slot_state(dev, MT_TOOL_FINGER, touch);
if (touch) {
x = (data[6 * i + 1] << 7) | data[6 * i + 2];
y = (data[6 * i + 3] << 7) | data[6 * i + 4];
@@ -513,8 +512,6 @@ static int w8001_setup_touch(struct w8001 *w8001, char *basename,
0, touch.x, 0, 0);
input_set_abs_params(dev, ABS_MT_POSITION_Y,
0, touch.y, 0, 0);
- input_set_abs_params(dev, ABS_MT_TOOL_TYPE,
- 0, MT_TOOL_MAX, 0, 0);

strlcat(basename, " 2FG", basename_sz);
if (w8001->max_pen_x && w8001->max_pen_y)
diff --git a/3.7/wacom_w8001.c b/3.7/wacom_w8001.c
index fe983e7..bab3c6a 100644
--- a/3.7/wacom_w8001.c
+++ b/3.7/wacom_w8001.c
@@ -155,7 +155,6 @@ static void parse_multi_touch(struct w8001 *w8001)
bool touch = data[0] & (1 << i);

input_mt_slot(dev, i);
- input_mt_report_slot_state(dev, MT_TOOL_FINGER, touch);
if (touch) {
x = (data[6 * i + 1] << 7) | data[6 * i + 2];
y = (data[6 * i + 3] << 7) | data[6 * i + 4];
@@ -514,8 +513,6 @@ static int w8001_setup_touch(struct w8001 *w8001, char *basename,
0, touch.x, 0, 0);
input_set_abs_params(dev, ABS_MT_POSITION_Y,
0, touch.y, 0, 0);
- input_set_abs_params(dev, ABS_MT_TOOL_TYPE,
- 0, MT_TOOL_MAX, 0, 0);

strlcat(basename, " 2FG", basename_sz);
if (w8001->max_pen_x && w8001->max_pen_y)
--
1.9.1
Aaron Armstrong Skomra
2016-07-13 22:45:27 UTC
Permalink
Somehow the patch that added two-finger touch support forgot to update
W8001_MAX_LENGTH from 11 to 13.

Signed-off-by: Ping Cheng <***@wacom.com>
Reviewed-by: Peter Hutterer <***@who-t.net>
Cc: ***@vger.kernel.org
Signed-off-by: Dmitry Torokhov <***@gmail.com>
[***@wacom.com: Imported into input-wacom repository (12afb34)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (d1906df)]
Signed-off-by: Aaron Skomra <***@wacom.com>
---
2.6.30/wacom_w8001.c | 2 +-
2.6.36/wacom_w8001.c | 2 +-
2.6.38/wacom_w8001.c | 2 +-
3.7/wacom_w8001.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/2.6.30/wacom_w8001.c b/2.6.30/wacom_w8001.c
index 15e401e..134dac5 100755
--- a/2.6.30/wacom_w8001.c
+++ b/2.6.30/wacom_w8001.c
@@ -27,7 +27,7 @@ MODULE_AUTHOR("Jaya Kumar <***@gmail.com>");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

-#define W8001_MAX_LENGTH 11
+#define W8001_MAX_LENGTH 13
#define W8001_LEAD_MASK 0x80
#define W8001_LEAD_BYTE 0x80
#define W8001_TAB_MASK 0x40
diff --git a/2.6.36/wacom_w8001.c b/2.6.36/wacom_w8001.c
index 03db1de..34414a8 100755
--- a/2.6.36/wacom_w8001.c
+++ b/2.6.36/wacom_w8001.c
@@ -27,7 +27,7 @@ MODULE_AUTHOR("Jaya Kumar <***@gmail.com>");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

-#define W8001_MAX_LENGTH 11
+#define W8001_MAX_LENGTH 13
#define W8001_LEAD_MASK 0x80
#define W8001_LEAD_BYTE 0x80
#define W8001_TAB_MASK 0x40
diff --git a/2.6.38/wacom_w8001.c b/2.6.38/wacom_w8001.c
index 1a33fad..ed04bb9 100644
--- a/2.6.38/wacom_w8001.c
+++ b/2.6.38/wacom_w8001.c
@@ -27,7 +27,7 @@ MODULE_AUTHOR("Jaya Kumar <***@gmail.com>");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

-#define W8001_MAX_LENGTH 11
+#define W8001_MAX_LENGTH 13
#define W8001_LEAD_MASK 0x80
#define W8001_LEAD_BYTE 0x80
#define W8001_TAB_MASK 0x40
diff --git a/3.7/wacom_w8001.c b/3.7/wacom_w8001.c
index bab3c6a..b1b4127 100644
--- a/3.7/wacom_w8001.c
+++ b/3.7/wacom_w8001.c
@@ -27,7 +27,7 @@ MODULE_AUTHOR("Jaya Kumar <***@gmail.com>");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

-#define W8001_MAX_LENGTH 11
+#define W8001_MAX_LENGTH 13
#define W8001_LEAD_MASK 0x80
#define W8001_LEAD_BYTE 0x80
#define W8001_TAB_MASK 0x40
--
1.9.1
Aaron Armstrong Skomra
2016-07-13 22:45:29 UTC
Permalink
The fuzz present on the distance and tilt axes is noticeable 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 <***@wacom.com>
Signed-off-by: Jiri Kosina <***@suse.cz>
[***@wacom.com: Imported into input-wacom repository (bef7e20)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (da3c637)]
Signed-off-by: Aaron Skomra <***@wacom.com>
---
2.6.30/wacom_sys.c | 7 ++++++-
2.6.30/wacom_wac.c | 16 ++++++++++++----
2.6.30/wacom_wac.h | 1 +
2.6.36/wacom_sys.c | 3 ++-
2.6.36/wacom_wac.c | 48 +++++++++++++++++++++++++++++++++++++++---------
2.6.36/wacom_wac.h | 1 +
2.6.38/wacom_sys.c | 3 ++-
2.6.38/wacom_wac.c | 15 ++++++++++-----
2.6.38/wacom_wac.h | 1 +
3.7/wacom_sys.c | 3 ++-
3.7/wacom_wac.c | 13 ++++++++-----
3.7/wacom_wac.h | 1 +
12 files changed, 85 insertions(+), 27 deletions(-)

diff --git a/2.6.30/wacom_sys.c b/2.6.30/wacom_sys.c
index 82bccc3..3d34efe 100644
--- a/2.6.30/wacom_sys.c
+++ b/2.6.30/wacom_sys.c
@@ -404,8 +404,13 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
struct usb_host_interface *interface = intf->cur_altsetting;
struct hid_descriptor *hid_desc;

- /* default device to penabled */
+ /* default features */
features->device_type = BTN_TOOL_PEN;
+ features->x_fuzz = 4;
+ features->y_fuzz = 4;
+ features->pressure_fuzz = 0;
+ features->distance_fuzz = 1;
+ features->tilt_fuzz = 1;

/* only devices that support touch need to retrieve the info */
if (features->type < BAMBOO_PT)
diff --git a/2.6.30/wacom_wac.c b/2.6.30/wacom_wac.c
index 96bcf1e..69d90ed 100644
--- a/2.6.30/wacom_wac.c
+++ b/2.6.30/wacom_wac.c
@@ -1514,12 +1514,13 @@ static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac)
__set_bit(BTN_STYLUS2, input_dev->keybit);

input_set_abs_params(input_dev, ABS_DISTANCE,
- 0, wacom_wac->features.distance_max, 0, 0);
+ 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0);
}

static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
{
struct input_dev *input_dev = wacom_wac->input;
+ struct wacom_features *features = &wacom_wac->features;

wacom_setup_basic_pro_pen(wacom_wac);

@@ -1529,8 +1530,8 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
__set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);

input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
+ input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, features->tilt_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, features->tilt_fuzz, 0);
}

static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
@@ -1672,9 +1673,13 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
__set_bit(BTN_STYLUS, input_dev->keybit);
__set_bit(BTN_STYLUS2, input_dev->keybit);
+ input_set_abs_params(input_dev, ABS_DISTANCE, 0,
+ features->distance_max,
+ features->distance_fuzz, 0);
}
}
break;
+
case WACOM_MO:
__set_bit(BTN_1, input_dev->keybit);
__set_bit(BTN_5, input_dev->keybit);
@@ -1685,6 +1690,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
case WACOM_G4:
input_set_capability(input_dev, EV_MSC, MSC_SERIAL);

+ input_set_abs_params(input_dev, ABS_DISTANCE, 0, features->distance_max,
+ features->distance_fuzz, 0);
+
__set_bit(BTN_TOOL_FINGER, input_dev->keybit);
__set_bit(BTN_0, input_dev->keybit);
__set_bit(BTN_4, input_dev->keybit);
@@ -1820,7 +1828,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,

input_set_abs_params(input_dev, ABS_DISTANCE, 0,
features->distance_max,
- 0, 0);
+ features->distance_fuzz, 0);

input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);

diff --git a/2.6.30/wacom_wac.h b/2.6.30/wacom_wac.h
index 6a076bf..a9f301d 100755
--- a/2.6.30/wacom_wac.h
+++ b/2.6.30/wacom_wac.h
@@ -120,6 +120,7 @@ struct wacom_features {
int y_fuzz;
int pressure_fuzz;
int distance_fuzz;
+ int tilt_fuzz;
unsigned quirks;
unsigned touch_max;
int oVid;
diff --git a/2.6.36/wacom_sys.c b/2.6.36/wacom_sys.c
index 13c0645..b8294dd 100644
--- a/2.6.36/wacom_sys.c
+++ b/2.6.36/wacom_sys.c
@@ -382,7 +382,8 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
features->x_fuzz = 4;
features->y_fuzz = 4;
features->pressure_fuzz = 0;
- features->distance_fuzz = 0;
+ features->distance_fuzz = 1;
+ features->tilt_fuzz = 1;

/* only devices support touch need to retrieve the info */
if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
diff --git a/2.6.36/wacom_wac.c b/2.6.36/wacom_wac.c
index 81a74ac..055ec3c 100644
--- a/2.6.36/wacom_wac.c
+++ b/2.6.36/wacom_wac.c
@@ -1306,25 +1306,37 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
input_sync(wacom_wac->input);
}

-static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
+static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac)
{
struct input_dev *input_dev = wacom_wac->input;

input_set_capability(input_dev, EV_MSC, MSC_SERIAL);

- __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
+ __set_bit(BTN_STYLUS, input_dev->keybit);
+ __set_bit(BTN_STYLUS2, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_DISTANCE,
+ 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0);
+}
+
+static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
+{
+ struct input_dev *input_dev = wacom_wac->input;
+ struct wacom_features *features = &wacom_wac->features;
+
+ wacom_setup_basic_pro_pen(wacom_wac);
+
+ __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
__set_bit(BTN_TOOL_BRUSH, input_dev->keybit);
__set_bit(BTN_TOOL_PENCIL, input_dev->keybit);
__set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
- __set_bit(BTN_STYLUS, input_dev->keybit);
- __set_bit(BTN_STYLUS2, input_dev->keybit);

input_set_abs_params(input_dev, ABS_DISTANCE,
0, wacom_wac->features.distance_max, 0, 0);
input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
+ input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, features->tilt_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, features->tilt_fuzz, 0);
}

static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
@@ -1427,6 +1439,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,

case WACOM_G4:
input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
+ input_set_abs_params(input_dev, ABS_DISTANCE, 0,
+ features->distance_max,
+ features->distance_fuzz, 0);

__set_bit(BTN_BACK, input_dev->keybit);
__set_bit(BTN_FORWARD, input_dev->keybit);
@@ -1534,22 +1549,37 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
wacom_setup_intuos(wacom_wac);
break;

+ case INTUOS4:
+ case INTUOS4L:
+ __set_bit(BTN_7, input_dev->keybit);
+ __set_bit(BTN_8, input_dev->keybit);
+ /* fall through */
+
+ case INTUOS4S:
+ for (i = 0; i < 7; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
+ wacom_setup_intuos(wacom_wac);
+ break;
+
case INTUOSPM:
case INTUOSPL:
case INTUOS5:
case INTUOS5L:
- case INTUOS4:
- case INTUOS4L:
__set_bit(BTN_7, input_dev->keybit);
__set_bit(BTN_8, input_dev->keybit);
/* fall through */

case INTUOSPS:
case INTUOS5S:
- case INTUOS4S:
for (i = 0; i < 7; i++)
__set_bit(BTN_0 + i, input_dev->keybit);

+ input_set_abs_params(input_dev, ABS_DISTANCE, 0,
+ features->distance_max,
+ features->distance_fuzz, 0);
+
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
wacom_setup_intuos(wacom_wac);
break;
diff --git a/2.6.36/wacom_wac.h b/2.6.36/wacom_wac.h
index 3c638b7..763fe6b 100644
--- a/2.6.36/wacom_wac.h
+++ b/2.6.36/wacom_wac.h
@@ -115,6 +115,7 @@ struct wacom_features {
int y_fuzz;
int pressure_fuzz;
int distance_fuzz;
+ int tilt_fuzz;
unsigned quirks;
unsigned touch_max;
unsigned num_contacts;
diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c
index fb6cc62..9e2c5dc 100644
--- a/2.6.38/wacom_sys.c
+++ b/2.6.38/wacom_sys.c
@@ -634,7 +634,8 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
features->x_fuzz = 4;
features->y_fuzz = 4;
features->pressure_fuzz = 0;
- features->distance_fuzz = 0;
+ features->distance_fuzz = 1;
+ features->tilt_fuzz = 1;

/*
* The wireless device HID is basic and layout conflicts with
diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
index bd03960..cca9393 100644
--- a/2.6.38/wacom_wac.c
+++ b/2.6.38/wacom_wac.c
@@ -1749,12 +1749,14 @@ static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac)
__set_bit(BTN_STYLUS2, input_dev->keybit);

input_set_abs_params(input_dev, ABS_DISTANCE,
- 0, wacom_wac->features.distance_max, 0, 0);
+ 0, wacom_wac->features.distance_max,
+ wacom_wac->features.distance_fuzz, 0);
}

static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
{
struct input_dev *input_dev = wacom_wac->input;
+ struct wacom_features *features = &wacom_wac->features;

wacom_setup_basic_pro_pen(wacom_wac);

@@ -1764,8 +1766,8 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
__set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);

input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
+ input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, features->tilt_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, features->tilt_fuzz, 0);
}

static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
@@ -1933,6 +1935,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,

case WACOM_G4:
input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
+ input_set_abs_params(input_dev, ABS_DISTANCE, 0,
+ features->distance_max,
+ features->distance_fuzz, 0);

__set_bit(BTN_BACK, input_dev->keybit);
__set_bit(BTN_FORWARD, input_dev->keybit);
@@ -2023,7 +2028,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
if (features->device_type == BTN_TOOL_PEN) {
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
features->distance_max,
- 0, 0);
+ features->distance_fuzz, 0);

input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);

@@ -2198,7 +2203,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
__set_bit(BTN_STYLUS2, input_dev->keybit);
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
features->distance_max,
- 0, 0);
+ features->distance_fuzz, 0);
}
}
break;
diff --git a/2.6.38/wacom_wac.h b/2.6.38/wacom_wac.h
index 89f06cd..f8c2fe2 100644
--- a/2.6.38/wacom_wac.h
+++ b/2.6.38/wacom_wac.h
@@ -149,6 +149,7 @@ struct wacom_features {
int y_fuzz;
int pressure_fuzz;
int distance_fuzz;
+ int tilt_fuzz;
unsigned quirks;
unsigned touch_max;
int oVid;
diff --git a/3.7/wacom_sys.c b/3.7/wacom_sys.c
index 5fc85e9..9ba404a 100644
--- a/3.7/wacom_sys.c
+++ b/3.7/wacom_sys.c
@@ -635,7 +635,8 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
features->x_fuzz = 4;
features->y_fuzz = 4;
features->pressure_fuzz = 0;
- features->distance_fuzz = 0;
+ features->distance_fuzz = 1;
+ features->tilt_fuzz = 1;

/*
* The wireless device HID is basic and layout conflicts with
diff --git a/3.7/wacom_wac.c b/3.7/wacom_wac.c
index 3be2035..3669516 100644
--- a/3.7/wacom_wac.c
+++ b/3.7/wacom_wac.c
@@ -1730,12 +1730,13 @@ static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac)
__set_bit(BTN_STYLUS2, input_dev->keybit);

input_set_abs_params(input_dev, ABS_DISTANCE,
- 0, wacom_wac->features.distance_max, 0, 0);
+ 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0);
}

static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
{
struct input_dev *input_dev = wacom_wac->input;
+ struct wacom_features *features = &wacom_wac->features;

wacom_setup_basic_pro_pen(wacom_wac);

@@ -1745,8 +1746,8 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
__set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);

input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
- input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
+ input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, features->tilt_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, features->tilt_fuzz, 0);
}

static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
@@ -1925,6 +1926,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,

case WACOM_G4:
input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
+ input_set_abs_params(input_dev, ABS_DISTANCE, 0,
+ features->distance_max, features->distance_fuzz, 0);

__set_bit(BTN_BACK, input_dev->keybit);
__set_bit(BTN_FORWARD, input_dev->keybit);
@@ -2020,7 +2023,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
if (features->device_type == BTN_TOOL_PEN) {
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
features->distance_max,
- 0, 0);
+ features->distance_fuzz, 0);

input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);

@@ -2158,7 +2161,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
__set_bit(BTN_STYLUS2, input_dev->keybit);
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
features->distance_max,
- 0, 0);
+ features->distance_fuzz, 0);
}
}
break;
diff --git a/3.7/wacom_wac.h b/3.7/wacom_wac.h
index a48579a..4c47d10 100644
--- a/3.7/wacom_wac.h
+++ b/3.7/wacom_wac.h
@@ -149,6 +149,7 @@ struct wacom_features {
int y_fuzz;
int pressure_fuzz;
int distance_fuzz;
+ int tilt_fuzz;
unsigned quirks;
unsigned touch_max;
int oVid;
--
1.9.1
Aaron Armstrong Skomra
2016-07-13 22:45:28 UTC
Permalink
ThinkPad X60 Tablet PC (pen only device) sometime posts
packets that are larger than W8001_PKTLEN_TPCPEN.

NOTE: The w8001 struct has no touch_dev member in 2.6.36
or 2.6.30.

Reported-by: Chris J Arges <***@gmail.com>
Tested-by: Chris J Arges <***@gmail.com>
Signed-off-by: Ping Cheng <***@wacom.com>
Reviewed-by: Peter Hutterer <***@who-t.net>
Cc: ***@vger.kernel.org
Signed-off-by: Dmitry Torokhov <***@gmail.com>
[***@wacom.com: Imported into input-wacom repository (9e72ac7)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (0ae81e81)]
Signed-off-by: Aaron Skomra <***@wacom.com>
---
2.6.38/wacom_w8001.c | 9 +++++++++
3.7/wacom_w8001.c | 9 +++++++++
2 files changed, 18 insertions(+)

diff --git a/2.6.38/wacom_w8001.c b/2.6.38/wacom_w8001.c
index ed04bb9..de7b8ef 100644
--- a/2.6.38/wacom_w8001.c
+++ b/2.6.38/wacom_w8001.c
@@ -339,6 +339,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,
w8001->idx = 0;
parse_multi_touch(w8001);
break;
+
+ default:
+ /*
+ * ThinkPad X60 Tablet PC (pen only device) sometimes
+ * sends invalid data packets that are larger than
+ * W8001_PKTLEN_TPCPEN. Let's start over again.
+ */
+ if (!w8001->touch_dev && w8001->idx > W8001_PKTLEN_TPCPEN - 1)
+ w8001->idx = 0;
}

return IRQ_HANDLED;
diff --git a/3.7/wacom_w8001.c b/3.7/wacom_w8001.c
index b1b4127..0c9191c 100644
--- a/3.7/wacom_w8001.c
+++ b/3.7/wacom_w8001.c
@@ -339,6 +339,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio,
w8001->idx = 0;
parse_multi_touch(w8001);
break;
+
+ default:
+ /*
+ * ThinkPad X60 Tablet PC (pen only device) sometimes
+ * sends invalid data packets that are larger than
+ * W8001_PKTLEN_TPCPEN. Let's start over again.
+ */
+ if (!w8001->touch_dev && w8001->idx > W8001_PKTLEN_TPCPEN - 1)
+ w8001->idx = 0;
}

return IRQ_HANDLED;
--
1.9.1
Ping Cheng
2016-07-15 00:09:29 UTC
Permalink
On Wed, Jul 13, 2016 at 3:45 PM, Aaron Armstrong Skomra
Post by Aaron Armstrong Skomra
As of e0361b70175 ("Input: wacom_w8001 - split the touch and pen devices
into two devices") the touch events aren't multiplexed over the same device
anymore, the use of ABS_MT_TOOL_TYPE is superfluous. And even before then
it only ever sent MT_TOOL_TYPE_FINGER anyway.
NOTES: 1) This patch backports the bug where
'input_mt_report_slot_state(dev, MT_TOOL_FINGER, touch);' has been removed.
This will be corrected in a subsequent patch.
2) This backport was accidentally skipped in the previous release and is
thus applied out of order.
3) e0361b70175 was only backported to 2.6.38 and 3.7.
Your comments trigged Dmitry's action. He reverted the patch upstream
already. Now, you need either to revert it at input-wacom after this
one is merged, or not even bother to push this one out. It's your
call. I have no preference ;).
The backporting looks good to me. The whole set is:

Reviewed-by: Ping Cheng <***@wacom.com>

Ping
Post by Aaron Armstrong Skomra
---
2.6.38/wacom_w8001.c | 3 ---
3.7/wacom_w8001.c | 3 ---
2 files changed, 6 deletions(-)
diff --git a/2.6.38/wacom_w8001.c b/2.6.38/wacom_w8001.c
index 7946419..1a33fad 100644
--- a/2.6.38/wacom_w8001.c
+++ b/2.6.38/wacom_w8001.c
@@ -155,7 +155,6 @@ static void parse_multi_touch(struct w8001 *w8001)
bool touch = data[0] & (1 << i);
input_mt_slot(dev, i);
- input_mt_report_slot_state(dev, MT_TOOL_FINGER, touch);
if (touch) {
x = (data[6 * i + 1] << 7) | data[6 * i + 2];
y = (data[6 * i + 3] << 7) | data[6 * i + 4];
@@ -513,8 +512,6 @@ static int w8001_setup_touch(struct w8001 *w8001, char *basename,
0, touch.x, 0, 0);
input_set_abs_params(dev, ABS_MT_POSITION_Y,
0, touch.y, 0, 0);
- input_set_abs_params(dev, ABS_MT_TOOL_TYPE,
- 0, MT_TOOL_MAX, 0, 0);
strlcat(basename, " 2FG", basename_sz);
if (w8001->max_pen_x && w8001->max_pen_y)
diff --git a/3.7/wacom_w8001.c b/3.7/wacom_w8001.c
index fe983e7..bab3c6a 100644
--- a/3.7/wacom_w8001.c
+++ b/3.7/wacom_w8001.c
@@ -155,7 +155,6 @@ static void parse_multi_touch(struct w8001 *w8001)
bool touch = data[0] & (1 << i);
input_mt_slot(dev, i);
- input_mt_report_slot_state(dev, MT_TOOL_FINGER, touch);
if (touch) {
x = (data[6 * i + 1] << 7) | data[6 * i + 2];
y = (data[6 * i + 3] << 7) | data[6 * i + 4];
@@ -514,8 +513,6 @@ static int w8001_setup_touch(struct w8001 *w8001, char *basename,
0, touch.x, 0, 0);
input_set_abs_params(dev, ABS_MT_POSITION_Y,
0, touch.y, 0, 0);
- input_set_abs_params(dev, ABS_MT_TOOL_TYPE,
- 0, MT_TOOL_MAX, 0, 0);
strlcat(basename, " 2FG", basename_sz);
if (w8001->max_pen_x && w8001->max_pen_y)
--
1.9.1
Loading...