aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-14 14:13:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-14 14:13:54 -0400
commita818d8e43147f40864363456b37a00b819439307 (patch)
treec0a5139116747c2240f94c024e247a4efd1791c6 /drivers/input/tablet
parentf901e753923192a7793e5d7591e2c03dcb252d68 (diff)
parent31968ecf584330b51a25b7bf881c2b632a02a3fb (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: i8042 - add ALDI/MEDION netbook E1222 to qurik reset table Input: ALPS - fix stuck buttons on some touchpads Input: wm831x-on - convert to use genirq Input: ads7846 - add wakeup support Input: appletouch - fix integer overflow issue Input: ad7877 - increase pen up imeout Input: ads7846 - add support for AD7843 parts Input: bf54x-keys - fix system hang when pressing a key Input: alps - add support for the touchpad on Toshiba Tecra A11-11L Input: remove BKL, fix input_open_file() locking Input: serio_raw - remove BKL Input: mousedev - remove BKL Input: add driver for TWL4030 vibrator device Input: enable remote wakeup for PNP i8042 keyboard ports Input: scancode in get/set_keycodes should be unsigned Input: i8042 - use platfrom_create_bundle() helper Input: wacom - merge out and in prox events Input: gamecon - fix off by one range check Input: wacom - replace WACOM_PKGLEN_PENABLED
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/wacom_sys.c4
-rw-r--r--drivers/input/tablet/wacom_wac.c165
-rw-r--r--drivers/input/tablet/wacom_wac.h1
3 files changed, 62 insertions, 108 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index a1770e6feeec..8b5d2873f0c4 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -371,7 +371,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
371 } else if (pen) { 371 } else if (pen) {
372 /* penabled only accepts exact bytes of data */ 372 /* penabled only accepts exact bytes of data */
373 if (features->type == TABLETPC2FG) 373 if (features->type == TABLETPC2FG)
374 features->pktlen = WACOM_PKGLEN_PENABLED; 374 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
375 features->device_type = BTN_TOOL_PEN; 375 features->device_type = BTN_TOOL_PEN;
376 features->x_max = 376 features->x_max =
377 wacom_le16_to_cpu(&report[i + 3]); 377 wacom_le16_to_cpu(&report[i + 3]);
@@ -410,7 +410,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
410 } else if (pen) { 410 } else if (pen) {
411 /* penabled only accepts exact bytes of data */ 411 /* penabled only accepts exact bytes of data */
412 if (features->type == TABLETPC2FG) 412 if (features->type == TABLETPC2FG)
413 features->pktlen = WACOM_PKGLEN_PENABLED; 413 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
414 features->device_type = BTN_TOOL_PEN; 414 features->device_type = BTN_TOOL_PEN;
415 features->y_max = 415 features->y_max =
416 wacom_le16_to_cpu(&report[i + 3]); 416 wacom_le16_to_cpu(&report[i + 3]);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 3d81443e683a..b3ba3437a2eb 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -155,19 +155,19 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
155{ 155{
156 struct wacom_features *features = &wacom->features; 156 struct wacom_features *features = &wacom->features;
157 unsigned char *data = wacom->data; 157 unsigned char *data = wacom->data;
158 int x, y, rw; 158 int x, y, prox;
159 static int penData = 0; 159 int rw = 0;
160 int retval = 0;
160 161
161 if (data[0] != WACOM_REPORT_PENABLED) { 162 if (data[0] != WACOM_REPORT_PENABLED) {
162 dbg("wacom_graphire_irq: received unknown report #%d", data[0]); 163 dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
163 return 0; 164 goto exit;
164 } 165 }
165 166
166 if (data[1] & 0x80) { 167 prox = data[1] & 0x80;
167 /* in prox and not a pad data */ 168 if (prox || wacom->id[0]) {
168 penData = 1; 169 if (prox) {
169 170 switch ((data[1] >> 5) & 3) {
170 switch ((data[1] >> 5) & 3) {
171 171
172 case 0: /* Pen */ 172 case 0: /* Pen */
173 wacom->tool[0] = BTN_TOOL_PEN; 173 wacom->tool[0] = BTN_TOOL_PEN;
@@ -181,23 +181,13 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
181 181
182 case 2: /* Mouse with wheel */ 182 case 2: /* Mouse with wheel */
183 wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); 183 wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04);
184 if (features->type == WACOM_G4 || features->type == WACOM_MO) {
185 rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03);
186 wacom_report_rel(wcombo, REL_WHEEL, -rw);
187 } else
188 wacom_report_rel(wcombo, REL_WHEEL, -(signed char) data[6]);
189 /* fall through */ 184 /* fall through */
190 185
191 case 3: /* Mouse without wheel */ 186 case 3: /* Mouse without wheel */
192 wacom->tool[0] = BTN_TOOL_MOUSE; 187 wacom->tool[0] = BTN_TOOL_MOUSE;
193 wacom->id[0] = CURSOR_DEVICE_ID; 188 wacom->id[0] = CURSOR_DEVICE_ID;
194 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
195 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
196 if (features->type == WACOM_G4 || features->type == WACOM_MO)
197 wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
198 else
199 wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
200 break; 189 break;
190 }
201 } 191 }
202 x = wacom_le16_to_cpu(&data[2]); 192 x = wacom_le16_to_cpu(&data[2]);
203 y = wacom_le16_to_cpu(&data[4]); 193 y = wacom_le16_to_cpu(&data[4]);
@@ -208,36 +198,32 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
208 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01); 198 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01);
209 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); 199 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
210 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04); 200 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04);
211 }
212 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
213 wacom_report_key(wcombo, wacom->tool[0], 1);
214 } else if (wacom->id[0]) {
215 wacom_report_abs(wcombo, ABS_X, 0);
216 wacom_report_abs(wcombo, ABS_Y, 0);
217 if (wacom->tool[0] == BTN_TOOL_MOUSE) {
218 wacom_report_key(wcombo, BTN_LEFT, 0);
219 wacom_report_key(wcombo, BTN_RIGHT, 0);
220 wacom_report_abs(wcombo, ABS_DISTANCE, 0);
221 } else { 201 } else {
222 wacom_report_abs(wcombo, ABS_PRESSURE, 0); 202 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
223 wacom_report_key(wcombo, BTN_TOUCH, 0); 203 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
224 wacom_report_key(wcombo, BTN_STYLUS, 0); 204 if (features->type == WACOM_G4 ||
225 wacom_report_key(wcombo, BTN_STYLUS2, 0); 205 features->type == WACOM_MO) {
206 wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
207 rw = (signed)(data[7] & 0x04) - (data[7] & 0x03);
208 } else {
209 wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
210 rw = -(signed)data[6];
211 }
212 wacom_report_rel(wcombo, REL_WHEEL, rw);
226 } 213 }
227 wacom->id[0] = 0; 214
228 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ 215 if (!prox)
229 wacom_report_key(wcombo, wacom->tool[0], 0); 216 wacom->id[0] = 0;
217 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
218 wacom_report_key(wcombo, wacom->tool[0], prox);
219 wacom_input_sync(wcombo); /* sync last event */
230 } 220 }
231 221
232 /* send pad data */ 222 /* send pad data */
233 switch (features->type) { 223 switch (features->type) {
234 case WACOM_G4: 224 case WACOM_G4:
235 if (data[7] & 0xf8) { 225 prox = data[7] & 0xf8;
236 if (penData) { 226 if (prox || wacom->id[1]) {
237 wacom_input_sync(wcombo); /* sync last event */
238 if (!wacom->id[0])
239 penData = 0;
240 }
241 wacom->id[1] = PAD_DEVICE_ID; 227 wacom->id[1] = PAD_DEVICE_ID;
242 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); 228 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
243 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); 229 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80));
@@ -245,29 +231,16 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
245 wacom_report_rel(wcombo, REL_WHEEL, rw); 231 wacom_report_rel(wcombo, REL_WHEEL, rw);
246 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 232 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
247 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); 233 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
248 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 234 if (!prox)
249 } else if (wacom->id[1]) { 235 wacom->id[1] = 0;
250 if (penData) { 236 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
251 wacom_input_sync(wcombo); /* sync last event */
252 if (!wacom->id[0])
253 penData = 0;
254 }
255 wacom->id[1] = 0;
256 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
257 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80));
258 wacom_report_rel(wcombo, REL_WHEEL, 0);
259 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0);
260 wacom_report_abs(wcombo, ABS_MISC, 0);
261 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 237 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
262 } 238 }
239 retval = 1;
263 break; 240 break;
264 case WACOM_MO: 241 case WACOM_MO:
265 if ((data[7] & 0xf8) || (data[8] & 0xff)) { 242 prox = (data[7] & 0xf8) || data[8];
266 if (penData) { 243 if (prox || wacom->id[1]) {
267 wacom_input_sync(wcombo); /* sync last event */
268 if (!wacom->id[0])
269 penData = 0;
270 }
271 wacom->id[1] = PAD_DEVICE_ID; 244 wacom->id[1] = PAD_DEVICE_ID;
272 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); 245 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
273 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); 246 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
@@ -275,27 +248,16 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
275 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40)); 248 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
276 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f)); 249 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
277 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 250 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
251 if (!prox)
252 wacom->id[1] = 0;
278 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); 253 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
279 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 254 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
280 } else if (wacom->id[1]) {
281 if (penData) {
282 wacom_input_sync(wcombo); /* sync last event */
283 if (!wacom->id[0])
284 penData = 0;
285 }
286 wacom->id[1] = 0;
287 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
288 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
289 wacom_report_key(wcombo, BTN_4, (data[7] & 0x10));
290 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
291 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
292 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0);
293 wacom_report_abs(wcombo, ABS_MISC, 0);
294 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
295 } 255 }
256 retval = 1;
296 break; 257 break;
297 } 258 }
298 return 1; 259exit:
260 return retval;
299} 261}
300 262
301static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) 263static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
@@ -636,9 +598,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
636static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx) 598static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx)
637{ 599{
638 wacom_report_abs(wcombo, ABS_X, 600 wacom_report_abs(wcombo, ABS_X,
639 (data[2 + idx * 2] & 0xff) | ((data[3 + idx * 2] & 0x7f) << 8)); 601 data[2 + idx * 2] | ((data[3 + idx * 2] & 0x7f) << 8));
640 wacom_report_abs(wcombo, ABS_Y, 602 wacom_report_abs(wcombo, ABS_Y,
641 (data[6 + idx * 2] & 0xff) | ((data[7 + idx * 2] & 0x7f) << 8)); 603 data[6 + idx * 2] | ((data[7 + idx * 2] & 0x7f) << 8));
642 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); 604 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
643 wacom_report_key(wcombo, wacom->tool[idx], 1); 605 wacom_report_key(wcombo, wacom->tool[idx], 1);
644 if (idx) 606 if (idx)
@@ -782,31 +744,24 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
782 744
783 touchInProx = 0; 745 touchInProx = 0;
784 746
785 if (prox) { /* in prox */ 747 if (!wacom->id[0]) { /* first in prox */
786 if (!wacom->id[0]) { 748 /* Going into proximity select tool */
787 /* Going into proximity select tool */ 749 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
788 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; 750 if (wacom->tool[0] == BTN_TOOL_PEN)
789 if (wacom->tool[0] == BTN_TOOL_PEN) 751 wacom->id[0] = STYLUS_DEVICE_ID;
790 wacom->id[0] = STYLUS_DEVICE_ID; 752 else
791 else 753 wacom->id[0] = ERASER_DEVICE_ID;
792 wacom->id[0] = ERASER_DEVICE_ID; 754 }
793 } 755 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
794 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); 756 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10);
795 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10); 757 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
796 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2])); 758 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
797 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); 759 pressure = ((data[7] & 0x01) << 8) | data[6];
798 pressure = ((data[7] & 0x01) << 8) | data[6]; 760 if (pressure < 0)
799 if (pressure < 0) 761 pressure = features->pressure_max + pressure + 1;
800 pressure = features->pressure_max + pressure + 1; 762 wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
801 wacom_report_abs(wcombo, ABS_PRESSURE, pressure); 763 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05);
802 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05); 764 if (!prox) { /* out-prox */
803 } else {
804 wacom_report_abs(wcombo, ABS_X, 0);
805 wacom_report_abs(wcombo, ABS_Y, 0);
806 wacom_report_abs(wcombo, ABS_PRESSURE, 0);
807 wacom_report_key(wcombo, BTN_STYLUS, 0);
808 wacom_report_key(wcombo, BTN_STYLUS2, 0);
809 wacom_report_key(wcombo, BTN_TOUCH, 0);
810 wacom->id[0] = 0; 765 wacom->id[0] = 0;
811 /* pen is out so touch can be enabled now */ 766 /* pen is out so touch can be enabled now */
812 touchInProx = 1; 767 touchInProx = 1;
@@ -1028,7 +983,7 @@ static const struct wacom_features wacom_features_0x93 =
1028static const struct wacom_features wacom_features_0x9A = 983static const struct wacom_features wacom_features_0x9A =
1029 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 984 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
1030static const struct wacom_features wacom_features_0x9F = 985static const struct wacom_features wacom_features_0x9F =
1031 { "Wacom ISDv4 9F", WACOM_PKGLEN_PENABLED, 26202, 16325, 255, 0, TABLETPC }; 986 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
1032static const struct wacom_features wacom_features_0xE2 = 987static const struct wacom_features wacom_features_0xE2 =
1033 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; 988 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
1034static const struct wacom_features wacom_features_0xE3 = 989static const struct wacom_features wacom_features_0xE3 =
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 8590b1e8ec37..b50cf04e61a8 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -17,7 +17,6 @@
17#define WACOM_PKGLEN_GRAPHIRE 8 17#define WACOM_PKGLEN_GRAPHIRE 8
18#define WACOM_PKGLEN_BBFUN 9 18#define WACOM_PKGLEN_BBFUN 9
19#define WACOM_PKGLEN_INTUOS 10 19#define WACOM_PKGLEN_INTUOS 10
20#define WACOM_PKGLEN_PENABLED 8
21#define WACOM_PKGLEN_TPC1FG 5 20#define WACOM_PKGLEN_TPC1FG 5
22#define WACOM_PKGLEN_TPC2FG 14 21#define WACOM_PKGLEN_TPC2FG 14
23 22