summaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet/wacom_wac.c
diff options
context:
space:
mode:
authorPing Cheng2010-03-20 06:18:15 +0100
committerDmitry Torokhov2010-04-14 08:24:06 +0200
commit4492efffffeb88d87e7aa74765f3c53b3a7dd40f (patch)
tree258b17da4faf0934efb8bc63a5163d77e047dbc8 /drivers/input/tablet/wacom_wac.c
parentInput: wacom - merge out and in prox events (diff)
downloadkernel-qcow2-linux-4492efffffeb88d87e7aa74765f3c53b3a7dd40f.tar.gz
kernel-qcow2-linux-4492efffffeb88d87e7aa74765f3c53b3a7dd40f.tar.xz
kernel-qcow2-linux-4492efffffeb88d87e7aa74765f3c53b3a7dd40f.zip
Input: wacom - share pen info with touch of the same ID
Touch enbaled devices share the same product ID with pen. However, we do not want to post touch events while pen is in prox. To do so, we used to keep a local static variable to keep track of if pen is in prox or not. This works fine for Tablet PC devices since there is only one device attached. With the newer touch enabled regular tablets, we can not make this assumption any more, i.e, one system may have more than one identical tablet plugged in. This patch adds an new entry, shared, into the struct wacom_wac so touch data can access pen data to locally. This solution assumes the two tools (touch and pen) of the same ID will be probed one after the other without interruption in between by another Wacom device of the same ID.
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r--drivers/input/tablet/wacom_wac.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index b3ba3437a2eb..428144af865f 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -688,7 +688,6 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
struct wacom_features *features = &wacom->features;
char *data = wacom->data;
int prox = 0, pressure, idx = -1;
- static int stylusInProx, touchInProx = 1, touchOut;
struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
dbg("wacom_tpc_irq: received report #%d", data[0]);
@@ -707,16 +706,12 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
prox = data[1] & 0x03;
}
- if (!stylusInProx) { /* stylus not in prox */
+ if (!wacom->shared->stylus_in_proximity) {
if (prox) {
- if (touchInProx) {
- wacom_tpc_touch_in(wacom, wcombo);
- touchOut = 1;
- return 1;
- }
+ wacom_tpc_touch_in(wacom, wcombo);
} else {
- /* 2FGT out-prox */
if (data[0] == WACOM_REPORT_TPC2FG) {
+ /* 2FGT out-prox */
idx = (wacom->id[1] & 0x01) - 1;
if (idx == 0) {
wacom_tpc_touch_out(wacom, wcombo, idx);
@@ -727,23 +722,19 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
idx = (wacom->id[1] & 0x02) - 1;
if (idx == 1)
wacom_tpc_touch_out(wacom, wcombo, idx);
- } else /* one finger touch */
+ } else {
+ /* one finger touch */
wacom_tpc_touch_out(wacom, wcombo, 0);
- touchOut = 0;
- touchInProx = 1;
- return 1;
+ }
+ wacom->id[0] = 0;
}
- } else if (touchOut || !prox) { /* force touch out-prox */
+ } else if (wacom->id[0]) { /* force touch out-prox */
wacom_tpc_touch_out(wacom, wcombo, 0);
- touchOut = 0;
- touchInProx = 1;
- return 1;
}
+ return 1;
} else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */
prox = data[1] & 0x20;
- touchInProx = 0;
-
if (!wacom->id[0]) { /* first in prox */
/* Going into proximity select tool */
wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
@@ -751,6 +742,8 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
wacom->id[0] = STYLUS_DEVICE_ID;
else
wacom->id[0] = ERASER_DEVICE_ID;
+
+ wacom->shared->stylus_in_proximity = true;
}
wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10);
@@ -763,12 +756,10 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05);
if (!prox) { /* out-prox */
wacom->id[0] = 0;
- /* pen is out so touch can be enabled now */
- touchInProx = 1;
+ wacom->shared->stylus_in_proximity = false;
}
wacom_report_key(wcombo, wacom->tool[0], prox);
wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
- stylusInProx = prox;
return 1;
}
return 0;