2014-06-23 20:57:32

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH 0/5] Input - wacom: split out pad data from the stylus input device

Hi,

This patch series aims at simplifying the handling of Wacom devices from the user
space point of view. As mentioned in the commit message from 1/5, the pad data
are interleaved into the stylus input for some devices, and into the touch input
for others.

It doesn't makes real sense to interleave pad with stylus because pad data are
not linked to the absolute position of a stylus (or its presence). It is a
device by itself which should have its own input node.

It will also help the handling of the old Wacom Graphire 4 which shares its
BTN_LEFT and BTN_RIGHT in its pad and in the mouse.

Again, it's not a problem right now because the user space is currently dealing
with it, but for the Wayland libinput implementation, having something clear
will really help.

This patch series does not break current X11 behavior, the only change from the
user will be that an input device will appear as "Wacom ... Pad pad".

I tried to test/debug it as extensively as possible, but I do not guarantee any
mistake :(

Tested on:
- Bamboo 16FG 4x5
- Bamboo 2FG
- BambooFun 4x5
- Bamboo
- Cintiq 12WX
- Cintiq 21UX2
- Cintiq 21UX
- Cintiq 22HD
- Cintiq 22HDT
- Cintiq 24HD
- DTU2231
- Graphire3
- Intuos3 9x12
- Intuos4 WL
- Intuos5 touch M
- Intuos Pro S

Note: this patch series might requesting to apply the patch for input->phys
I just sent:
https://patchwork.kernel.org/patch/4404391/


Cheers,
Benjamin

Benjamin Tissoires (5):
Input - wacom: create a separate input device for pads
Input - wacom: split out the pad device for Intuos/Cintiq
Input - wacom: split out the pad device for Bamboos
Input - wacom: split out the pad device for DTUS
Input - wacom: split out the pad device for Graphire G4 and MO

drivers/input/tablet/wacom.h | 2 +
drivers/input/tablet/wacom_sys.c | 63 +++++++-
drivers/input/tablet/wacom_wac.c | 328 ++++++++++++++++++++++++---------------
drivers/input/tablet/wacom_wac.h | 2 +
4 files changed, 259 insertions(+), 136 deletions(-)

--
1.9.0


2014-06-23 20:57:40

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH 2/5] Input - wacom: split out the pad device for Intuos/Cintiq

MSC_SERIAL can be safely dropped for pad input devices.

Signed-off-by: Benjamin Tissoires <[email protected]>
---
drivers/input/tablet/wacom_wac.c | 208 +++++++++++++++++++++++----------------
1 file changed, 122 insertions(+), 86 deletions(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 4b16a34..8807ab5 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -584,6 +584,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)

/* pad packets. Works as a second tool and is always in prox */
if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) {
+ input = wacom->pad_input;
if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
input_report_key(input, BTN_0, (data[2] & 0x01));
input_report_key(input, BTN_1, (data[3] & 0x01));
@@ -773,7 +774,6 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
input_report_abs(input, ABS_MISC, 0);
}
}
- input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
return 1;
}

@@ -1656,61 +1656,20 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
break;

case WACOM_24HD:
- __set_bit(BTN_A, input_dev->keybit);
- __set_bit(BTN_B, input_dev->keybit);
- __set_bit(BTN_C, input_dev->keybit);
- __set_bit(BTN_X, input_dev->keybit);
- __set_bit(BTN_Y, input_dev->keybit);
- __set_bit(BTN_Z, input_dev->keybit);
-
- for (i = 6; i < 10; i++)
- __set_bit(BTN_0 + i, input_dev->keybit);
-
- __set_bit(KEY_PROG1, input_dev->keybit);
- __set_bit(KEY_PROG2, input_dev->keybit);
- __set_bit(KEY_PROG3, input_dev->keybit);
-
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
/* fall through */

case DTK:
- for (i = 0; i < 6; i++)
- __set_bit(BTN_0 + i, input_dev->keybit);
-
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);

wacom_setup_cintiq(wacom_wac);
break;

case WACOM_22HD:
- __set_bit(KEY_PROG1, input_dev->keybit);
- __set_bit(KEY_PROG2, input_dev->keybit);
- __set_bit(KEY_PROG3, input_dev->keybit);
- /* fall through */
-
case WACOM_21UX2:
- __set_bit(BTN_A, input_dev->keybit);
- __set_bit(BTN_B, input_dev->keybit);
- __set_bit(BTN_C, input_dev->keybit);
- __set_bit(BTN_X, input_dev->keybit);
- __set_bit(BTN_Y, input_dev->keybit);
- __set_bit(BTN_Z, input_dev->keybit);
- __set_bit(BTN_BASE, input_dev->keybit);
- __set_bit(BTN_BASE2, input_dev->keybit);
- /* fall through */
-
case WACOM_BEE:
- __set_bit(BTN_8, input_dev->keybit);
- __set_bit(BTN_9, input_dev->keybit);
- /* fall through */
-
case CINTIQ:
- for (i = 0; i < 8; i++)
- __set_bit(BTN_0 + i, input_dev->keybit);
-
- input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
- input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);

__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@@ -1719,9 +1678,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
break;

case WACOM_13HD:
- for (i = 0; i < 9; i++)
- __set_bit(BTN_0 + i, input_dev->keybit);
-
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
wacom_setup_cintiq(wacom_wac);
@@ -1729,21 +1685,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,

case INTUOS3:
case INTUOS3L:
- __set_bit(BTN_4, input_dev->keybit);
- __set_bit(BTN_5, input_dev->keybit);
- __set_bit(BTN_6, input_dev->keybit);
- __set_bit(BTN_7, input_dev->keybit);
-
- input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
- /* fall through */
-
case INTUOS3S:
- __set_bit(BTN_0, input_dev->keybit);
- __set_bit(BTN_1, input_dev->keybit);
- __set_bit(BTN_2, input_dev->keybit);
- __set_bit(BTN_3, input_dev->keybit);
-
- input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
/* fall through */

@@ -1757,20 +1699,11 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case INTUOS5L:
case INTUOSPM:
case INTUOSPL:
- if (features->device_type == BTN_TOOL_PEN) {
- __set_bit(BTN_7, input_dev->keybit);
- __set_bit(BTN_8, input_dev->keybit);
- }
- /* fall through */
-
case INTUOS5S:
case INTUOSPS:
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);

if (features->device_type == BTN_TOOL_PEN) {
- 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,
0, 0);
@@ -1791,14 +1724,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,

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);

@@ -1922,17 +1848,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
break;

case CINTIQ_HYBRID:
- __set_bit(BTN_1, input_dev->keybit);
- __set_bit(BTN_2, input_dev->keybit);
- __set_bit(BTN_3, input_dev->keybit);
- __set_bit(BTN_4, input_dev->keybit);
-
- __set_bit(BTN_5, input_dev->keybit);
- __set_bit(BTN_6, input_dev->keybit);
- __set_bit(BTN_7, input_dev->keybit);
- __set_bit(BTN_8, input_dev->keybit);
- __set_bit(BTN_0, input_dev->keybit);
-
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);

@@ -1946,6 +1861,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac)
{
struct wacom_features *features = &wacom_wac->features;
+ int i;

input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);

@@ -1957,6 +1873,126 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);

switch (features->type) {
+ case WACOM_24HD:
+ __set_bit(BTN_A, input_dev->keybit);
+ __set_bit(BTN_B, input_dev->keybit);
+ __set_bit(BTN_C, input_dev->keybit);
+ __set_bit(BTN_X, input_dev->keybit);
+ __set_bit(BTN_Y, input_dev->keybit);
+ __set_bit(BTN_Z, input_dev->keybit);
+
+ for (i = 0; i < 10; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+
+ __set_bit(KEY_PROG1, input_dev->keybit);
+ __set_bit(KEY_PROG2, input_dev->keybit);
+ __set_bit(KEY_PROG3, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
+ input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
+ break;
+
+ case DTK:
+ for (i = 0; i < 6; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+
+ break;
+
+ case WACOM_22HD:
+ __set_bit(KEY_PROG1, input_dev->keybit);
+ __set_bit(KEY_PROG2, input_dev->keybit);
+ __set_bit(KEY_PROG3, input_dev->keybit);
+ /* fall through */
+
+ case WACOM_21UX2:
+ __set_bit(BTN_A, input_dev->keybit);
+ __set_bit(BTN_B, input_dev->keybit);
+ __set_bit(BTN_C, input_dev->keybit);
+ __set_bit(BTN_X, input_dev->keybit);
+ __set_bit(BTN_Y, input_dev->keybit);
+ __set_bit(BTN_Z, input_dev->keybit);
+ __set_bit(BTN_BASE, input_dev->keybit);
+ __set_bit(BTN_BASE2, input_dev->keybit);
+ /* fall through */
+
+ case WACOM_BEE:
+ __set_bit(BTN_8, input_dev->keybit);
+ __set_bit(BTN_9, input_dev->keybit);
+ /* fall through */
+
+ case CINTIQ:
+ for (i = 0; i < 8; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
+ input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
+ break;
+
+ case WACOM_13HD:
+ for (i = 0; i < 9; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
+ break;
+
+ case INTUOS3:
+ case INTUOS3L:
+ __set_bit(BTN_4, input_dev->keybit);
+ __set_bit(BTN_5, input_dev->keybit);
+ __set_bit(BTN_6, input_dev->keybit);
+ __set_bit(BTN_7, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
+ /* fall through */
+
+ case INTUOS3S:
+ __set_bit(BTN_0, input_dev->keybit);
+ __set_bit(BTN_1, input_dev->keybit);
+ __set_bit(BTN_2, input_dev->keybit);
+ __set_bit(BTN_3, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
+ break;
+
+ case INTUOS5:
+ case INTUOS5L:
+ case INTUOSPM:
+ case INTUOSPL:
+ __set_bit(BTN_7, input_dev->keybit);
+ __set_bit(BTN_8, input_dev->keybit);
+ /* fall through */
+
+ case INTUOS5S:
+ case INTUOSPS:
+ /* touch interface does not have the pad device */
+ if (features->device_type != BTN_TOOL_PEN)
+ return 1;
+
+ for (i = 0; i < 7; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+
+ input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
+ 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_WHEEL, 0, 71, 0, 0);
+ break;
+
+ case CINTIQ_HYBRID:
+ for (i = 0; i < 9; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+
+ break;
+
default:
/* no pad supported */
return 1;
--
1.9.0

2014-06-23 20:57:38

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH 3/5] Input - wacom: split out the pad device for Bamboos

We rely on the return code of wacom_bpt*() to do the input_sync().
wacom_wac_irq() then properly sync the input devices.

Signed-off-by: Benjamin Tissoires <[email protected]>
---
drivers/input/tablet/wacom_wac.c | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 8807ab5..5aaa3d2 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1143,6 +1143,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input;
+ struct input_dev *pad_input = wacom->pad_input;
unsigned char *data = wacom->data;
int i;

@@ -1177,14 +1178,12 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)

input_mt_report_pointer_emulation(input, true);

- input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
- input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
- input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
- input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
-
- input_sync(input);
+ input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0);
+ input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0);
+ input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0);
+ input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0);

- return 0;
+ return 1;
}

static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
@@ -1232,7 +1231,7 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)

static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
{
- struct input_dev *input = wacom->input;
+ struct input_dev *input = wacom->pad_input;
struct wacom_features *features = &wacom->features;

if (features->type == INTUOSHT) {
@@ -1269,9 +1268,7 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
}
input_mt_report_pointer_emulation(input, true);

- input_sync(input);
-
- return 0;
+ return 1;
}

static int wacom_bpt_pen(struct wacom_wac *wacom)
@@ -1806,11 +1803,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,

if (features->device_type == BTN_TOOL_FINGER) {

- __set_bit(BTN_LEFT, input_dev->keybit);
- __set_bit(BTN_FORWARD, input_dev->keybit);
- __set_bit(BTN_BACK, input_dev->keybit);
- __set_bit(BTN_RIGHT, input_dev->keybit);
-
if (features->touch_max) {
/* touch interface */
unsigned int flags = INPUT_MT_POINTER;
@@ -1993,6 +1985,21 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,

break;

+ case INTUOSHT:
+ case BAMBOO_PT:
+ /* pad device is on the touch interface */
+ if (features->device_type != BTN_TOOL_FINGER)
+ return 1;
+
+ __clear_bit(ABS_MISC, input_dev->absbit);
+
+ __set_bit(BTN_LEFT, input_dev->keybit);
+ __set_bit(BTN_FORWARD, input_dev->keybit);
+ __set_bit(BTN_BACK, input_dev->keybit);
+ __set_bit(BTN_RIGHT, input_dev->keybit);
+
+ break;
+
default:
/* no pad supported */
return 1;
--
1.9.0

2014-06-23 20:57:37

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH 4/5] Input - wacom: split out the pad device for DTUS

MSC_SERIAL can be safely removed from the pad device.

Signed-off-by: Benjamin Tissoires <[email protected]>
---
drivers/input/tablet/wacom_wac.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 5aaa3d2..d3aef3a 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -217,17 +217,13 @@ static int wacom_dtus_irq(struct wacom_wac *wacom)
"%s: received unknown report #%d", __func__, data[0]);
return 0;
} else if (data[0] == WACOM_REPORT_DTUSPAD) {
+ input = wacom->pad_input;
input_report_key(input, BTN_0, (data[1] & 0x01));
input_report_key(input, BTN_1, (data[1] & 0x02));
input_report_key(input, BTN_2, (data[1] & 0x04));
input_report_key(input, BTN_3, (data[1] & 0x08));
input_report_abs(input, ABS_MISC,
data[1] & 0x0f ? PAD_DEVICE_ID : 0);
- /*
- * Serial number is required when expresskeys are
- * reported through pen interface.
- */
- input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
return 1;
} else {
prox = data[1] & 0x80;
@@ -257,7 +253,6 @@ static int wacom_dtus_irq(struct wacom_wac *wacom)
wacom->id[0] = 0;
input_report_key(input, wacom->tool[0], prox);
input_report_abs(input, ABS_MISC, wacom->id[0]);
- input_event(input, EV_MSC, MSC_SERIAL, 1);
return 1;
}
}
@@ -1615,7 +1610,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac)
{
struct wacom_features *features = &wacom_wac->features;
- int i;

input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);

@@ -1765,11 +1759,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case DTUS:
case PL:
case DTU:
- if (features->type == DTUS) {
- input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
- for (i = 0; i < 4; i++)
- __set_bit(BTN_0 + i, input_dev->keybit);
- }
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
__set_bit(BTN_STYLUS, input_dev->keybit);
@@ -1985,6 +1974,11 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,

break;

+ case DTUS:
+ for (i = 0; i < 4; i++)
+ __set_bit(BTN_0 + i, input_dev->keybit);
+ break;
+
case INTUOSHT:
case BAMBOO_PT:
/* pad device is on the touch interface */
--
1.9.0

2014-06-23 20:58:16

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH 5/5] Input - wacom: split out the pad device for Graphire G4 and MO

MSC_SERIAL can be safely removed from pad devices. If it is not
here, xf86-input-wacom correctly generates ones for its internal
use.

Signed-off-by: Benjamin Tissoires <[email protected]>
---
drivers/input/tablet/wacom_wac.c | 44 ++++++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index d3aef3a..f170277 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -262,6 +262,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
struct wacom_features *features = &wacom->features;
unsigned char *data = wacom->data;
struct input_dev *input = wacom->input;
+ struct input_dev *pad_input = wacom->pad_input;
int prox;
int rw = 0;
int retval = 0;
@@ -322,7 +323,6 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
wacom->id[0] = 0;
input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
input_report_key(input, wacom->tool[0], prox);
- input_event(input, EV_MSC, MSC_SERIAL, 1);
input_sync(input); /* sync last event */
}

@@ -332,14 +332,13 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
prox = data[7] & 0xf8;
if (prox || wacom->id[1]) {
wacom->id[1] = PAD_DEVICE_ID;
- input_report_key(input, BTN_BACK, (data[7] & 0x40));
- input_report_key(input, BTN_FORWARD, (data[7] & 0x80));
+ input_report_key(pad_input, BTN_BACK, (data[7] & 0x40));
+ input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80));
rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
- input_report_rel(input, REL_WHEEL, rw);
+ input_report_rel(pad_input, REL_WHEEL, rw);
if (!prox)
wacom->id[1] = 0;
- input_report_abs(input, ABS_MISC, wacom->id[1]);
- input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
+ input_report_abs(pad_input, ABS_MISC, wacom->id[1]);
retval = 1;
}
break;
@@ -348,15 +347,14 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
prox = (data[7] & 0xf8) || data[8];
if (prox || wacom->id[1]) {
wacom->id[1] = PAD_DEVICE_ID;
- input_report_key(input, BTN_BACK, (data[7] & 0x08));
- input_report_key(input, BTN_LEFT, (data[7] & 0x20));
- input_report_key(input, BTN_FORWARD, (data[7] & 0x10));
- input_report_key(input, BTN_RIGHT, (data[7] & 0x40));
- input_report_abs(input, ABS_WHEEL, (data[8] & 0x7f));
+ input_report_key(pad_input, BTN_BACK, (data[7] & 0x08));
+ input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20));
+ input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10));
+ input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40));
+ input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f));
if (!prox)
wacom->id[1] = 0;
- input_report_abs(input, ABS_MISC, wacom->id[1]);
- input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
+ input_report_abs(pad_input, ABS_MISC, wacom->id[1]);
retval = 1;
}
break;
@@ -1624,10 +1622,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
/* fall through */

case WACOM_G4:
- input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
-
- __set_bit(BTN_BACK, input_dev->keybit);
- __set_bit(BTN_FORWARD, input_dev->keybit);
/* fall through */

case GRAPHIRE:
@@ -1854,6 +1848,22 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);

switch (features->type) {
+ case WACOM_MO:
+ __set_bit(BTN_BACK, input_dev->keybit);
+ __set_bit(BTN_LEFT, input_dev->keybit);
+ __set_bit(BTN_FORWARD, input_dev->keybit);
+ __set_bit(BTN_RIGHT, input_dev->keybit);
+ input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
+ break;
+
+ case WACOM_G4:
+ __set_bit(BTN_BACK, input_dev->keybit);
+ __set_bit(BTN_LEFT, input_dev->keybit);
+ __set_bit(BTN_FORWARD, input_dev->keybit);
+ __set_bit(BTN_RIGHT, input_dev->keybit);
+ input_set_capability(input_dev, EV_REL, REL_WHEEL);
+ break;
+
case WACOM_24HD:
__set_bit(BTN_A, input_dev->keybit);
__set_bit(BTN_B, input_dev->keybit);
--
1.9.0

2014-06-23 20:58:46

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH 1/5] Input - wacom: create a separate input device for pads

Currently, the pad events are sent through the stylus input device
for the Intuos/Cintiqs, and through the touch input device for the
Bamboos.

To differentiate the buttons pressed on the pad from the ones pressed
on the stylus, the Intuos/Cintiq uses MISC_SERIAL and ABS_MISC. This
lead to a multiplexing of the events into one device, which are then
splitted out in xf86-input-wacom. Bamboos are not using MISC events
because the pad is attached to the touch interface, and only BTN_TOUCH
is used for the finger (and DOUBLE_TAP, etc...). However, the user space
driver still splits out the pad from the touch interface in the same
way it does for the pro line devices.

The other problem we can see with this fact is that some of the Intuos
and Cintiq have a wheel, and the effective range of the reported values
is [0..71]. Unfortunately, the airbrush stylus also sends wheel events
(there is a small wheel on it), but in the range [0..1023]. From the user
space point of view it is kind of difficult to understand that because
the wheel on the pad are quite common, while the airbrush tool is not.

A solution to fix all of these problems is to split out the pad device
from the stylus/touch. This decision makes more sense because the pad is
not linked to the absolute position of the finger or pen, and usually, the
events from the pad are filtered out by the compositor, which then convert
them into actions or keyboard shortcuts.

For backward compatibility with current xf86-input-wacom, the pad devices
still present the ABS_X, ABS_Y and ABS_MISC events, but they can be
completely ignored in the new implementation.

Signed-off-by: Benjamin Tissoires <[email protected]>
---
drivers/input/tablet/wacom.h | 2 ++
drivers/input/tablet/wacom_sys.c | 63 +++++++++++++++++++++++++++++++++++-----
drivers/input/tablet/wacom_wac.c | 27 ++++++++++++++++-
drivers/input/tablet/wacom_wac.h | 2 ++
4 files changed, 85 insertions(+), 9 deletions(-)

diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 9ebf0ed..caa59ca 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -136,4 +136,6 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
void wacom_setup_device_quirks(struct wacom_features *features);
int wacom_setup_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac);
+int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
+ struct wacom_wac *wacom_wac);
#endif
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index c993eee..b9bf37e 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -135,6 +135,9 @@ static int wacom_open(struct input_dev *dev)

mutex_lock(&wacom->lock);

+ if (wacom->open)
+ goto out;
+
if (usb_submit_urb(wacom->irq, GFP_KERNEL)) {
retval = -EIO;
goto out;
@@ -157,9 +160,14 @@ static void wacom_close(struct input_dev *dev)
autopm_error = usb_autopm_get_interface(wacom->intf);

mutex_lock(&wacom->lock);
+ if (!wacom->open)
+ goto out;
+
usb_kill_urb(wacom->irq);
wacom->open = false;
wacom->intf->needs_remote_wakeup = 0;
+
+out:
mutex_unlock(&wacom->lock);

if (!autopm_error)
@@ -1109,19 +1117,16 @@ static void wacom_destroy_battery(struct wacom *wacom)
}
}

-static int wacom_register_input(struct wacom *wacom)
+static struct input_dev *wacom_allocate_input(struct wacom *wacom)
{
struct input_dev *input_dev;
struct usb_interface *intf = wacom->intf;
struct usb_device *dev = interface_to_usbdev(intf);
struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
- int error;

input_dev = input_allocate_device();
- if (!input_dev) {
- error = -ENOMEM;
- goto fail1;
- }
+ if (!input_dev)
+ return NULL;

input_dev->name = wacom_wac->name;
input_dev->phys = wacom->phys;
@@ -1131,21 +1136,59 @@ static int wacom_register_input(struct wacom *wacom)
usb_to_input_id(dev, &input_dev->id);
input_set_drvdata(input_dev, wacom);

+ return input_dev;
+}
+
+static int wacom_register_input(struct wacom *wacom)
+{
+ struct input_dev *input_dev, *pad_input_dev;
+ struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
+ int error;
+
+ input_dev = wacom_allocate_input(wacom);
+ pad_input_dev = wacom_allocate_input(wacom);
+ if (!input_dev || !pad_input_dev) {
+ error = -ENOMEM;
+ goto fail1;
+ }
+
wacom_wac->input = input_dev;
+ wacom_wac->pad_input = pad_input_dev;
+ wacom_wac->pad_input->name = wacom_wac->pad_name;
+
error = wacom_setup_input_capabilities(input_dev, wacom_wac);
if (error)
- goto fail1;
+ goto fail2;

error = input_register_device(input_dev);
if (error)
goto fail2;

+ error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
+ if (error) {
+ /* no pad in use on this interface */
+ input_free_device(pad_input_dev);
+ wacom_wac->pad_input = NULL;
+ pad_input_dev = NULL;
+ } else {
+ error = input_register_device(pad_input_dev);
+ if (error)
+ goto fail3;
+ }
+
return 0;

+fail3:
+ input_unregister_device(input_dev);
+ input_dev = NULL;
fail2:
- input_free_device(input_dev);
wacom_wac->input = NULL;
+ wacom_wac->pad_input = NULL;
fail1:
+ if (input_dev)
+ input_free_device(input_dev);
+ if (pad_input_dev)
+ input_free_device(pad_input_dev);
return error;
}

@@ -1364,6 +1407,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
wacom_calculate_res(features);

strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
+ snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
+ "%s Pad", features->name);

if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
struct usb_device *other_dev;
@@ -1438,6 +1483,8 @@ static void wacom_disconnect(struct usb_interface *intf)
cancel_work_sync(&wacom->work);
if (wacom->wacom_wac.input)
input_unregister_device(wacom->wacom_wac.input);
+ if (wacom->wacom_wac.pad_input)
+ input_unregister_device(wacom->wacom_wac.pad_input);
wacom_destroy_battery(wacom);
wacom_destroy_leds(wacom);
usb_free_urb(wacom->irq);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 977d05c..4b16a34 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1489,8 +1489,11 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
break;
}

- if (sync)
+ if (sync) {
input_sync(wacom_wac->input);
+ if (wacom_wac->pad_input)
+ input_sync(wacom_wac->pad_input);
+ }
}

static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
@@ -1939,6 +1942,28 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
return 0;
}

+int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
+ struct wacom_wac *wacom_wac)
+{
+ struct wacom_features *features = &wacom_wac->features;
+
+ input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+
+ /* kept for making legacy xf86-input-wacom working with the wheels */
+ __set_bit(ABS_MISC, input_dev->absbit);
+
+ /* kept for making legacy xf86-input-wacom accepting the pad */
+ input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);
+
+ switch (features->type) {
+ default:
+ /* no pad supported */
+ return 1;
+ }
+ return 0;
+}
+
static const struct wacom_features wacom_features_0x00 =
{ "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index b2c9a9c..f48164c 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -150,6 +150,7 @@ struct wacom_shared {

struct wacom_wac {
char name[WACOM_NAME_MAX];
+ char pad_name[WACOM_NAME_MAX];
unsigned char *data;
int tool[2];
int id[2];
@@ -157,6 +158,7 @@ struct wacom_wac {
struct wacom_features features;
struct wacom_shared *shared;
struct input_dev *input;
+ struct input_dev *pad_input;
int pid;
int battery_capacity;
int num_contacts_left;
--
1.9.0

2014-06-24 00:18:07

by Ping Cheng

[permalink] [raw]
Subject: Re: [PATCH 1/5] Input - wacom: create a separate input device for pads

Hi Benjamin,

On Mon, Jun 23, 2014 at 1:57 PM, Benjamin Tissoires
<[email protected]> wrote:
> Currently, the pad events are sent through the stylus input device
> for the Intuos/Cintiqs, and through the touch input device for the
> Bamboos.
>
> To differentiate the buttons pressed on the pad from the ones pressed
> on the stylus, the Intuos/Cintiq uses MISC_SERIAL and ABS_MISC. This
> lead to a multiplexing of the events into one device, which are then
> splitted out in xf86-input-wacom. Bamboos are not using MISC events
> because the pad is attached to the touch interface, and only BTN_TOUCH
> is used for the finger (and DOUBLE_TAP, etc...). However, the user space
> driver still splits out the pad from the touch interface in the same
> way it does for the pro line devices.
>
> The other problem we can see with this fact is that some of the Intuos
> and Cintiq have a wheel, and the effective range of the reported values
> is [0..71]. Unfortunately, the airbrush stylus also sends wheel events
> (there is a small wheel on it), but in the range [0..1023]. From the user
> space point of view it is kind of difficult to understand that because
> the wheel on the pad are quite common, while the airbrush tool is not.
>
> A solution to fix all of these problems is to split out the pad device
> from the stylus/touch. This decision makes more sense because the pad is
> not linked to the absolute position of the finger or pen, and usually, the
> events from the pad are filtered out by the compositor, which then convert
> them into actions or keyboard shortcuts.

This is a very good solution. I like it.

> For backward compatibility with current xf86-input-wacom, the pad devices
> still present the ABS_X, ABS_Y and ABS_MISC events, but they can be
> completely ignored in the new implementation.

I do not think we need to keep ABS_X and ABS_Y for pad. We've already
supported a tablet (Intuos pen small, a pen only tablet with buttons
reported on touch interface) that does not set ABS_X and ABS_Y for
pad.

Unless you plan to use other means to tell userland those events are
from PAD tool, ABS_MISC is necessary and is a reasonable way to group
PAD events. So, I do not think it is for backward compatibility. It is
there to stay. With that said, the whole patchset is

> Signed-off-by: Benjamin Tissoires <[email protected]>

Reviewed-by: Ping Cheng <[email protected]>

Thank you, Benjamin, for your support.

Ping

> ---
> drivers/input/tablet/wacom.h | 2 ++
> drivers/input/tablet/wacom_sys.c | 63 +++++++++++++++++++++++++++++++++++-----
> drivers/input/tablet/wacom_wac.c | 27 ++++++++++++++++-
> drivers/input/tablet/wacom_wac.h | 2 ++
> 4 files changed, 85 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
> index 9ebf0ed..caa59ca 100644
> --- a/drivers/input/tablet/wacom.h
> +++ b/drivers/input/tablet/wacom.h
> @@ -136,4 +136,6 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
> void wacom_setup_device_quirks(struct wacom_features *features);
> int wacom_setup_input_capabilities(struct input_dev *input_dev,
> struct wacom_wac *wacom_wac);
> +int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
> + struct wacom_wac *wacom_wac);
> #endif
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index c993eee..b9bf37e 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -135,6 +135,9 @@ static int wacom_open(struct input_dev *dev)
>
> mutex_lock(&wacom->lock);
>
> + if (wacom->open)
> + goto out;
> +
> if (usb_submit_urb(wacom->irq, GFP_KERNEL)) {
> retval = -EIO;
> goto out;
> @@ -157,9 +160,14 @@ static void wacom_close(struct input_dev *dev)
> autopm_error = usb_autopm_get_interface(wacom->intf);
>
> mutex_lock(&wacom->lock);
> + if (!wacom->open)
> + goto out;
> +
> usb_kill_urb(wacom->irq);
> wacom->open = false;
> wacom->intf->needs_remote_wakeup = 0;
> +
> +out:
> mutex_unlock(&wacom->lock);
>
> if (!autopm_error)
> @@ -1109,19 +1117,16 @@ static void wacom_destroy_battery(struct wacom *wacom)
> }
> }
>
> -static int wacom_register_input(struct wacom *wacom)
> +static struct input_dev *wacom_allocate_input(struct wacom *wacom)
> {
> struct input_dev *input_dev;
> struct usb_interface *intf = wacom->intf;
> struct usb_device *dev = interface_to_usbdev(intf);
> struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
> - int error;
>
> input_dev = input_allocate_device();
> - if (!input_dev) {
> - error = -ENOMEM;
> - goto fail1;
> - }
> + if (!input_dev)
> + return NULL;
>
> input_dev->name = wacom_wac->name;
> input_dev->phys = wacom->phys;
> @@ -1131,21 +1136,59 @@ static int wacom_register_input(struct wacom *wacom)
> usb_to_input_id(dev, &input_dev->id);
> input_set_drvdata(input_dev, wacom);
>
> + return input_dev;
> +}
> +
> +static int wacom_register_input(struct wacom *wacom)
> +{
> + struct input_dev *input_dev, *pad_input_dev;
> + struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
> + int error;
> +
> + input_dev = wacom_allocate_input(wacom);
> + pad_input_dev = wacom_allocate_input(wacom);
> + if (!input_dev || !pad_input_dev) {
> + error = -ENOMEM;
> + goto fail1;
> + }
> +
> wacom_wac->input = input_dev;
> + wacom_wac->pad_input = pad_input_dev;
> + wacom_wac->pad_input->name = wacom_wac->pad_name;
> +
> error = wacom_setup_input_capabilities(input_dev, wacom_wac);
> if (error)
> - goto fail1;
> + goto fail2;
>
> error = input_register_device(input_dev);
> if (error)
> goto fail2;
>
> + error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
> + if (error) {
> + /* no pad in use on this interface */
> + input_free_device(pad_input_dev);
> + wacom_wac->pad_input = NULL;
> + pad_input_dev = NULL;
> + } else {
> + error = input_register_device(pad_input_dev);
> + if (error)
> + goto fail3;
> + }
> +
> return 0;
>
> +fail3:
> + input_unregister_device(input_dev);
> + input_dev = NULL;
> fail2:
> - input_free_device(input_dev);
> wacom_wac->input = NULL;
> + wacom_wac->pad_input = NULL;
> fail1:
> + if (input_dev)
> + input_free_device(input_dev);
> + if (pad_input_dev)
> + input_free_device(pad_input_dev);
> return error;
> }
>
> @@ -1364,6 +1407,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
> wacom_calculate_res(features);
>
> strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
> + snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
> + "%s Pad", features->name);
>
> if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
> struct usb_device *other_dev;
> @@ -1438,6 +1483,8 @@ static void wacom_disconnect(struct usb_interface *intf)
> cancel_work_sync(&wacom->work);
> if (wacom->wacom_wac.input)
> input_unregister_device(wacom->wacom_wac.input);
> + if (wacom->wacom_wac.pad_input)
> + input_unregister_device(wacom->wacom_wac.pad_input);
> wacom_destroy_battery(wacom);
> wacom_destroy_leds(wacom);
> usb_free_urb(wacom->irq);
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index 977d05c..4b16a34 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -1489,8 +1489,11 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
> break;
> }
>
> - if (sync)
> + if (sync) {
> input_sync(wacom_wac->input);
> + if (wacom_wac->pad_input)
> + input_sync(wacom_wac->pad_input);
> + }
> }
>
> static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
> @@ -1939,6 +1942,28 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
> return 0;
> }
>
> +int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
> + struct wacom_wac *wacom_wac)
> +{
> + struct wacom_features *features = &wacom_wac->features;
> +
> + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> +
> + /* kept for making legacy xf86-input-wacom working with the wheels */
> + __set_bit(ABS_MISC, input_dev->absbit);
> +
> + /* kept for making legacy xf86-input-wacom accepting the pad */
> + input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0);
> + input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);
> +
> + switch (features->type) {
> + default:
> + /* no pad supported */
> + return 1;
> + }
> + return 0;
> +}
> +
> static const struct wacom_features wacom_features_0x00 =
> { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
> 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
> index b2c9a9c..f48164c 100644
> --- a/drivers/input/tablet/wacom_wac.h
> +++ b/drivers/input/tablet/wacom_wac.h
> @@ -150,6 +150,7 @@ struct wacom_shared {
>
> struct wacom_wac {
> char name[WACOM_NAME_MAX];
> + char pad_name[WACOM_NAME_MAX];
> unsigned char *data;
> int tool[2];
> int id[2];
> @@ -157,6 +158,7 @@ struct wacom_wac {
> struct wacom_features features;
> struct wacom_shared *shared;
> struct input_dev *input;
> + struct input_dev *pad_input;
> int pid;
> int battery_capacity;
> int num_contacts_left;
> --
> 1.9.0
>

2014-06-24 14:01:06

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH 1/5] Input - wacom: create a separate input device for pads

Hi Ping,

On Jun 23 2014 or thereabouts, Ping Cheng wrote:
> Hi Benjamin,
>
> On Mon, Jun 23, 2014 at 1:57 PM, Benjamin Tissoires
> <[email protected]> wrote:
> > Currently, the pad events are sent through the stylus input device
> > for the Intuos/Cintiqs, and through the touch input device for the
> > Bamboos.
> >
> > To differentiate the buttons pressed on the pad from the ones pressed
> > on the stylus, the Intuos/Cintiq uses MISC_SERIAL and ABS_MISC. This
> > lead to a multiplexing of the events into one device, which are then
> > splitted out in xf86-input-wacom. Bamboos are not using MISC events
> > because the pad is attached to the touch interface, and only BTN_TOUCH
> > is used for the finger (and DOUBLE_TAP, etc...). However, the user space
> > driver still splits out the pad from the touch interface in the same
> > way it does for the pro line devices.
> >
> > The other problem we can see with this fact is that some of the Intuos
> > and Cintiq have a wheel, and the effective range of the reported values
> > is [0..71]. Unfortunately, the airbrush stylus also sends wheel events
> > (there is a small wheel on it), but in the range [0..1023]. From the user
> > space point of view it is kind of difficult to understand that because
> > the wheel on the pad are quite common, while the airbrush tool is not.
> >
> > A solution to fix all of these problems is to split out the pad device
> > from the stylus/touch. This decision makes more sense because the pad is
> > not linked to the absolute position of the finger or pen, and usually, the
> > events from the pad are filtered out by the compositor, which then convert
> > them into actions or keyboard shortcuts.
>
> This is a very good solution. I like it.
>
> > For backward compatibility with current xf86-input-wacom, the pad devices
> > still present the ABS_X, ABS_Y and ABS_MISC events, but they can be
> > completely ignored in the new implementation.
>
> I do not think we need to keep ABS_X and ABS_Y for pad. We've already
> supported a tablet (Intuos pen small, a pen only tablet with buttons
> reported on touch interface) that does not set ABS_X and ABS_Y for
> pad.

Hmm, actually, when I tried removing X and Y, xf86-input-wacom
complained that max_x and max_y where set to 0, and it thus rejected the
device. Maybe there is a special quirk in the xorg driver for the device
you mentioned?

Anyway, it's not a big deal, and when both xorg and libinput will know
how to handle properly the pad device nodes, we can remove this.

>
> Unless you plan to use other means to tell userland those events are
> from PAD tool, ABS_MISC is necessary and is a reasonable way to group

Well, given that the pad now has its own input node, ABS_MISC could be
dropped. We just need to teach the users that whichever event comes from
this input device is a PAD event.

> PAD events. So, I do not think it is for backward compatibility. It is
> there to stay. With that said, the whole patchset is
>
> > Signed-off-by: Benjamin Tissoires <[email protected]>
>
> Reviewed-by: Ping Cheng <[email protected]>
>

Thanks, that is greatly appreciated!

> Thank you, Benjamin, for your support.
>
> Ping
>

Cheers,
Benjamin

2014-07-11 00:18:55

by Jason Gerecke

[permalink] [raw]
Subject: Re: [PATCH 1/5] Input - wacom: create a separate input device for pads

On Mon, Jun 23, 2014 at 1:57 PM, Benjamin Tissoires
<[email protected]> wrote:
> Currently, the pad events are sent through the stylus input device
> for the Intuos/Cintiqs, and through the touch input device for the
> Bamboos.
>
> To differentiate the buttons pressed on the pad from the ones pressed
> on the stylus, the Intuos/Cintiq uses MISC_SERIAL and ABS_MISC. This
> lead to a multiplexing of the events into one device, which are then
> splitted out in xf86-input-wacom. Bamboos are not using MISC events
> because the pad is attached to the touch interface, and only BTN_TOUCH
> is used for the finger (and DOUBLE_TAP, etc...). However, the user space
> driver still splits out the pad from the touch interface in the same
> way it does for the pro line devices.
>
> The other problem we can see with this fact is that some of the Intuos
> and Cintiq have a wheel, and the effective range of the reported values
> is [0..71]. Unfortunately, the airbrush stylus also sends wheel events
> (there is a small wheel on it), but in the range [0..1023]. From the user
> space point of view it is kind of difficult to understand that because
> the wheel on the pad are quite common, while the airbrush tool is not.
>
> A solution to fix all of these problems is to split out the pad device
> from the stylus/touch. This decision makes more sense because the pad is
> not linked to the absolute position of the finger or pen, and usually, the
> events from the pad are filtered out by the compositor, which then convert
> them into actions or keyboard shortcuts.
>
> For backward compatibility with current xf86-input-wacom, the pad devices
> still present the ABS_X, ABS_Y and ABS_MISC events, but they can be
> completely ignored in the new implementation.
>
> Signed-off-by: Benjamin Tissoires <[email protected]>
> ---
> drivers/input/tablet/wacom.h | 2 ++
> drivers/input/tablet/wacom_sys.c | 63 +++++++++++++++++++++++++++++++++++-----
> drivers/input/tablet/wacom_wac.c | 27 ++++++++++++++++-
> drivers/input/tablet/wacom_wac.h | 2 ++
> 4 files changed, 85 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
> index 9ebf0ed..caa59ca 100644
> --- a/drivers/input/tablet/wacom.h
> +++ b/drivers/input/tablet/wacom.h
> @@ -136,4 +136,6 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
> void wacom_setup_device_quirks(struct wacom_features *features);
> int wacom_setup_input_capabilities(struct input_dev *input_dev,
> struct wacom_wac *wacom_wac);
> +int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
> + struct wacom_wac *wacom_wac);
> #endif
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index c993eee..b9bf37e 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -135,6 +135,9 @@ static int wacom_open(struct input_dev *dev)
>
> mutex_lock(&wacom->lock);
>
> + if (wacom->open)
> + goto out;
> +
> if (usb_submit_urb(wacom->irq, GFP_KERNEL)) {
> retval = -EIO;
> goto out;
> @@ -157,9 +160,14 @@ static void wacom_close(struct input_dev *dev)
> autopm_error = usb_autopm_get_interface(wacom->intf);
>
> mutex_lock(&wacom->lock);
> + if (!wacom->open)
> + goto out;
> +
> usb_kill_urb(wacom->irq);
> wacom->open = false;
> wacom->intf->needs_remote_wakeup = 0;
> +
> +out:
> mutex_unlock(&wacom->lock);
>
> if (!autopm_error)
> @@ -1109,19 +1117,16 @@ static void wacom_destroy_battery(struct wacom *wacom)
> }
> }
>
> -static int wacom_register_input(struct wacom *wacom)
> +static struct input_dev *wacom_allocate_input(struct wacom *wacom)
> {
> struct input_dev *input_dev;
> struct usb_interface *intf = wacom->intf;
> struct usb_device *dev = interface_to_usbdev(intf);
> struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
> - int error;
>
> input_dev = input_allocate_device();
> - if (!input_dev) {
> - error = -ENOMEM;
> - goto fail1;
> - }
> + if (!input_dev)
> + return NULL;
>
> input_dev->name = wacom_wac->name;
> input_dev->phys = wacom->phys;
> @@ -1131,21 +1136,59 @@ static int wacom_register_input(struct wacom *wacom)
> usb_to_input_id(dev, &input_dev->id);
> input_set_drvdata(input_dev, wacom);
>
> + return input_dev;
> +}
> +
> +static int wacom_register_input(struct wacom *wacom)
> +{
> + struct input_dev *input_dev, *pad_input_dev;
> + struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
> + int error;
> +
> + input_dev = wacom_allocate_input(wacom);
> + pad_input_dev = wacom_allocate_input(wacom);
> + if (!input_dev || !pad_input_dev) {
> + error = -ENOMEM;
> + goto fail1;
> + }
> +
> wacom_wac->input = input_dev;
> + wacom_wac->pad_input = pad_input_dev;
> + wacom_wac->pad_input->name = wacom_wac->pad_name;
> +
> error = wacom_setup_input_capabilities(input_dev, wacom_wac);
> if (error)
> - goto fail1;
> + goto fail2;
>
> error = input_register_device(input_dev);
> if (error)
> goto fail2;
>
> + error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
> + if (error) {
> + /* no pad in use on this interface */
> + input_free_device(pad_input_dev);
> + wacom_wac->pad_input = NULL;
> + pad_input_dev = NULL;
> + } else {
> + error = input_register_device(pad_input_dev);
> + if (error)
> + goto fail3;
> + }
> +
> return 0;
>
> +fail3:
> + input_unregister_device(input_dev);
> + input_dev = NULL;
> fail2:
> - input_free_device(input_dev);
> wacom_wac->input = NULL;
> + wacom_wac->pad_input = NULL;
> fail1:
> + if (input_dev)
> + input_free_device(input_dev);
> + if (pad_input_dev)
> + input_free_device(pad_input_dev);
> return error;
> }
>
> @@ -1364,6 +1407,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
> wacom_calculate_res(features);
>
> strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
> + snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
> + "%s Pad", features->name);

This may cause some heartburn for some users that have xsetwacom
scripts (or use similar tools that need a device name). Our X driver
already appends a " pad" suffix to the device name, so this results in
X devices now having the double-suffix " Pad pad". I agree with adding
the suffix here though, so I think I'll write a patch to fix this in
xf86-input-wacom.

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....

>
> if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
> struct usb_device *other_dev;
> @@ -1438,6 +1483,8 @@ static void wacom_disconnect(struct usb_interface *intf)
> cancel_work_sync(&wacom->work);
> if (wacom->wacom_wac.input)
> input_unregister_device(wacom->wacom_wac.input);
> + if (wacom->wacom_wac.pad_input)
> + input_unregister_device(wacom->wacom_wac.pad_input);
> wacom_destroy_battery(wacom);
> wacom_destroy_leds(wacom);
> usb_free_urb(wacom->irq);
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index 977d05c..4b16a34 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -1489,8 +1489,11 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
> break;
> }
>
> - if (sync)
> + if (sync) {
> input_sync(wacom_wac->input);
> + if (wacom_wac->pad_input)
> + input_sync(wacom_wac->pad_input);
> + }
> }
>
> static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
> @@ -1939,6 +1942,28 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
> return 0;
> }
>
> +int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
> + struct wacom_wac *wacom_wac)
> +{
> + struct wacom_features *features = &wacom_wac->features;
> +
> + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> +
> + /* kept for making legacy xf86-input-wacom working with the wheels */
> + __set_bit(ABS_MISC, input_dev->absbit);
> +
> + /* kept for making legacy xf86-input-wacom accepting the pad */
> + input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0);
> + input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);
> +
> + switch (features->type) {
> + default:
> + /* no pad supported */
> + return 1;
> + }
> + return 0;
> +}
> +
> static const struct wacom_features wacom_features_0x00 =
> { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
> 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
> index b2c9a9c..f48164c 100644
> --- a/drivers/input/tablet/wacom_wac.h
> +++ b/drivers/input/tablet/wacom_wac.h
> @@ -150,6 +150,7 @@ struct wacom_shared {
>
> struct wacom_wac {
> char name[WACOM_NAME_MAX];
> + char pad_name[WACOM_NAME_MAX];
> unsigned char *data;
> int tool[2];
> int id[2];
> @@ -157,6 +158,7 @@ struct wacom_wac {
> struct wacom_features features;
> struct wacom_shared *shared;
> struct input_dev *input;
> + struct input_dev *pad_input;
> int pid;
> int battery_capacity;
> int num_contacts_left;
> --
> 1.9.0
>

2014-07-11 01:21:18

by Jason Gerecke

[permalink] [raw]
Subject: Re: [PATCH 0/5] Input - wacom: split out pad data from the stylus input device

On Mon, Jun 23, 2014 at 1:57 PM, Benjamin Tissoires
<[email protected]> wrote:
> Hi,
>
> This patch series aims at simplifying the handling of Wacom devices from the user
> space point of view. As mentioned in the commit message from 1/5, the pad data
> are interleaved into the stylus input for some devices, and into the touch input
> for others.
>
> It doesn't makes real sense to interleave pad with stylus because pad data are
> not linked to the absolute position of a stylus (or its presence). It is a
> device by itself which should have its own input node.
>
> It will also help the handling of the old Wacom Graphire 4 which shares its
> BTN_LEFT and BTN_RIGHT in its pad and in the mouse.
>
> Again, it's not a problem right now because the user space is currently dealing
> with it, but for the Wayland libinput implementation, having something clear
> will really help.
>
> This patch series does not break current X11 behavior, the only change from the
> user will be that an input device will appear as "Wacom ... Pad pad".
>
> I tried to test/debug it as extensively as possible, but I do not guarantee any
> mistake :(
>
> Tested on:
> - Bamboo 16FG 4x5
> - Bamboo 2FG
> - BambooFun 4x5
> - Bamboo
> - Cintiq 12WX
> - Cintiq 21UX2
> - Cintiq 21UX
> - Cintiq 22HD
> - Cintiq 22HDT
> - Cintiq 24HD
> - DTU2231
> - Graphire3
> - Intuos3 9x12
> - Intuos4 WL
> - Intuos5 touch M
> - Intuos Pro S
>
> Note: this patch series might requesting to apply the patch for input->phys
> I just sent:
> https://patchwork.kernel.org/patch/4404391/
>
>
> Cheers,
> Benjamin
>
> Benjamin Tissoires (5):
> Input - wacom: create a separate input device for pads
> Input - wacom: split out the pad device for Intuos/Cintiq
> Input - wacom: split out the pad device for Bamboos
> Input - wacom: split out the pad device for DTUS
> Input - wacom: split out the pad device for Graphire G4 and MO
>
> drivers/input/tablet/wacom.h | 2 +
> drivers/input/tablet/wacom_sys.c | 63 +++++++-
> drivers/input/tablet/wacom_wac.c | 328 ++++++++++++++++++++++++---------------
> drivers/input/tablet/wacom_wac.h | 2 +
> 4 files changed, 259 insertions(+), 136 deletions(-)
>
> --
> 1.9.0
>

These look fine to me as well (aside from the one minor comment):

Reviewed-by: Jason Gerecke <[email protected]>

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....

2014-07-11 13:17:22

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [Linuxwacom-devel] [PATCH 1/5] Input - wacom: create a separate input device for pads

On Thu, Jul 10, 2014 at 8:18 PM, Jason Gerecke <[email protected]> wrote:
> On Mon, Jun 23, 2014 at 1:57 PM, Benjamin Tissoires
> <[email protected]> wrote:
>> Currently, the pad events are sent through the stylus input device
>> for the Intuos/Cintiqs, and through the touch input device for the
>> Bamboos.
>>
>> To differentiate the buttons pressed on the pad from the ones pressed
>> on the stylus, the Intuos/Cintiq uses MISC_SERIAL and ABS_MISC. This
>> lead to a multiplexing of the events into one device, which are then
>> splitted out in xf86-input-wacom. Bamboos are not using MISC events
>> because the pad is attached to the touch interface, and only BTN_TOUCH
>> is used for the finger (and DOUBLE_TAP, etc...). However, the user space
>> driver still splits out the pad from the touch interface in the same
>> way it does for the pro line devices.
>>
>> The other problem we can see with this fact is that some of the Intuos
>> and Cintiq have a wheel, and the effective range of the reported values
>> is [0..71]. Unfortunately, the airbrush stylus also sends wheel events
>> (there is a small wheel on it), but in the range [0..1023]. From the user
>> space point of view it is kind of difficult to understand that because
>> the wheel on the pad are quite common, while the airbrush tool is not.
>>
>> A solution to fix all of these problems is to split out the pad device
>> from the stylus/touch. This decision makes more sense because the pad is
>> not linked to the absolute position of the finger or pen, and usually, the
>> events from the pad are filtered out by the compositor, which then convert
>> them into actions or keyboard shortcuts.
>>
>> For backward compatibility with current xf86-input-wacom, the pad devices
>> still present the ABS_X, ABS_Y and ABS_MISC events, but they can be
>> completely ignored in the new implementation.
>>
>> Signed-off-by: Benjamin Tissoires <[email protected]>
>> ---
>> drivers/input/tablet/wacom.h | 2 ++
>> drivers/input/tablet/wacom_sys.c | 63 +++++++++++++++++++++++++++++++++++-----
>> drivers/input/tablet/wacom_wac.c | 27 ++++++++++++++++-
>> drivers/input/tablet/wacom_wac.h | 2 ++
>> 4 files changed, 85 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
>> index 9ebf0ed..caa59ca 100644
>> --- a/drivers/input/tablet/wacom.h
>> +++ b/drivers/input/tablet/wacom.h
>> @@ -136,4 +136,6 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
>> void wacom_setup_device_quirks(struct wacom_features *features);
>> int wacom_setup_input_capabilities(struct input_dev *input_dev,
>> struct wacom_wac *wacom_wac);
>> +int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
>> + struct wacom_wac *wacom_wac);
>> #endif
>> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
>> index c993eee..b9bf37e 100644
>> --- a/drivers/input/tablet/wacom_sys.c
>> +++ b/drivers/input/tablet/wacom_sys.c
>> @@ -135,6 +135,9 @@ static int wacom_open(struct input_dev *dev)
>>
>> mutex_lock(&wacom->lock);
>>
>> + if (wacom->open)
>> + goto out;
>> +
>> if (usb_submit_urb(wacom->irq, GFP_KERNEL)) {
>> retval = -EIO;
>> goto out;
>> @@ -157,9 +160,14 @@ static void wacom_close(struct input_dev *dev)
>> autopm_error = usb_autopm_get_interface(wacom->intf);
>>
>> mutex_lock(&wacom->lock);
>> + if (!wacom->open)
>> + goto out;
>> +
>> usb_kill_urb(wacom->irq);
>> wacom->open = false;
>> wacom->intf->needs_remote_wakeup = 0;
>> +
>> +out:
>> mutex_unlock(&wacom->lock);
>>
>> if (!autopm_error)
>> @@ -1109,19 +1117,16 @@ static void wacom_destroy_battery(struct wacom *wacom)
>> }
>> }
>>
>> -static int wacom_register_input(struct wacom *wacom)
>> +static struct input_dev *wacom_allocate_input(struct wacom *wacom)
>> {
>> struct input_dev *input_dev;
>> struct usb_interface *intf = wacom->intf;
>> struct usb_device *dev = interface_to_usbdev(intf);
>> struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
>> - int error;
>>
>> input_dev = input_allocate_device();
>> - if (!input_dev) {
>> - error = -ENOMEM;
>> - goto fail1;
>> - }
>> + if (!input_dev)
>> + return NULL;
>>
>> input_dev->name = wacom_wac->name;
>> input_dev->phys = wacom->phys;
>> @@ -1131,21 +1136,59 @@ static int wacom_register_input(struct wacom *wacom)
>> usb_to_input_id(dev, &input_dev->id);
>> input_set_drvdata(input_dev, wacom);
>>
>> + return input_dev;
>> +}
>> +
>> +static int wacom_register_input(struct wacom *wacom)
>> +{
>> + struct input_dev *input_dev, *pad_input_dev;
>> + struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
>> + int error;
>> +
>> + input_dev = wacom_allocate_input(wacom);
>> + pad_input_dev = wacom_allocate_input(wacom);
>> + if (!input_dev || !pad_input_dev) {
>> + error = -ENOMEM;
>> + goto fail1;
>> + }
>> +
>> wacom_wac->input = input_dev;
>> + wacom_wac->pad_input = pad_input_dev;
>> + wacom_wac->pad_input->name = wacom_wac->pad_name;
>> +
>> error = wacom_setup_input_capabilities(input_dev, wacom_wac);
>> if (error)
>> - goto fail1;
>> + goto fail2;
>>
>> error = input_register_device(input_dev);
>> if (error)
>> goto fail2;
>>
>> + error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
>> + if (error) {
>> + /* no pad in use on this interface */
>> + input_free_device(pad_input_dev);
>> + wacom_wac->pad_input = NULL;
>> + pad_input_dev = NULL;
>> + } else {
>> + error = input_register_device(pad_input_dev);
>> + if (error)
>> + goto fail3;
>> + }
>> +
>> return 0;
>>
>> +fail3:
>> + input_unregister_device(input_dev);
>> + input_dev = NULL;
>> fail2:
>> - input_free_device(input_dev);
>> wacom_wac->input = NULL;
>> + wacom_wac->pad_input = NULL;
>> fail1:
>> + if (input_dev)
>> + input_free_device(input_dev);
>> + if (pad_input_dev)
>> + input_free_device(pad_input_dev);
>> return error;
>> }
>>
>> @@ -1364,6 +1407,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>> wacom_calculate_res(features);
>>
>> strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
>> + snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
>> + "%s Pad", features->name);
>
> This may cause some heartburn for some users that have xsetwacom
> scripts (or use similar tools that need a device name). Our X driver
> already appends a " pad" suffix to the device name, so this results in
> X devices now having the double-suffix " Pad pad". I agree with adding
> the suffix here though, so I think I'll write a patch to fix this in
> xf86-input-wacom.

Yeah, but as there was already some part of the code which appended
such suffixes in some cases, I think fixing this in xf86-input-wacom
is the best solution.

Cheers,
Benjamin

>
> Jason
> ---
> Now instead of four in the eights place /
> you’ve got three, ‘Cause you added one /
> (That is to say, eight) to the two, /
> But you can’t take seven from three, /
> So you look at the sixty-fours....
>
>>
>> if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
>> struct usb_device *other_dev;
>> @@ -1438,6 +1483,8 @@ static void wacom_disconnect(struct usb_interface *intf)
>> cancel_work_sync(&wacom->work);
>> if (wacom->wacom_wac.input)
>> input_unregister_device(wacom->wacom_wac.input);
>> + if (wacom->wacom_wac.pad_input)
>> + input_unregister_device(wacom->wacom_wac.pad_input);
>> wacom_destroy_battery(wacom);
>> wacom_destroy_leds(wacom);
>> usb_free_urb(wacom->irq);
>> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
>> index 977d05c..4b16a34 100644
>> --- a/drivers/input/tablet/wacom_wac.c
>> +++ b/drivers/input/tablet/wacom_wac.c
>> @@ -1489,8 +1489,11 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
>> break;
>> }
>>
>> - if (sync)
>> + if (sync) {
>> input_sync(wacom_wac->input);
>> + if (wacom_wac->pad_input)
>> + input_sync(wacom_wac->pad_input);
>> + }
>> }
>>
>> static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
>> @@ -1939,6 +1942,28 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>> return 0;
>> }
>>
>> +int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
>> + struct wacom_wac *wacom_wac)
>> +{
>> + struct wacom_features *features = &wacom_wac->features;
>> +
>> + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
>> +
>> + /* kept for making legacy xf86-input-wacom working with the wheels */
>> + __set_bit(ABS_MISC, input_dev->absbit);
>> +
>> + /* kept for making legacy xf86-input-wacom accepting the pad */
>> + input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0);
>> + input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);
>> +
>> + switch (features->type) {
>> + default:
>> + /* no pad supported */
>> + return 1;
>> + }
>> + return 0;
>> +}
>> +
>> static const struct wacom_features wacom_features_0x00 =
>> { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
>> 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
>> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
>> index b2c9a9c..f48164c 100644
>> --- a/drivers/input/tablet/wacom_wac.h
>> +++ b/drivers/input/tablet/wacom_wac.h
>> @@ -150,6 +150,7 @@ struct wacom_shared {
>>
>> struct wacom_wac {
>> char name[WACOM_NAME_MAX];
>> + char pad_name[WACOM_NAME_MAX];
>> unsigned char *data;
>> int tool[2];
>> int id[2];
>> @@ -157,6 +158,7 @@ struct wacom_wac {
>> struct wacom_features features;
>> struct wacom_shared *shared;
>> struct input_dev *input;
>> + struct input_dev *pad_input;
>> int pid;
>> int battery_capacity;
>> int num_contacts_left;
>> --
>> 1.9.0
>>
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> Linuxwacom-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel