/[linux-patches]/genpatches-2.6/trunk/2.6.16/2610_wacom-update.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.16/2610_wacom-update.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 471 - (show annotations) (download) (as text)
Sun May 21 12:12:20 2006 UTC (14 years, 5 months ago) by dsd
File MIME type: text/x-diff
File size: 14147 byte(s)
wacom driver update, to fix mouse wheel inversion
1 From: Ping Cheng <pingc@wacom.com>
2 Date: Thu, 30 Mar 2006 00:33:49 +0000 (-0800)
3 Subject: [PATCH] USB: wacom tablet driver update
4 X-Git-Tag: v2.6.17-rc2
5 X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7d3fe085f9cdd3d3eea0154ea02e2f6b4a8f3974
6
7 [PATCH] USB: wacom tablet driver update
8
9 This patch adds support for DTF 521, Intuos3 12x12, and 12x19;
10 fixes minor data report bugs.
11
12 Signed-off-by: Ping Cheng <pingc@wacom.com>
13 Acked-by: Vojtech Pavlik <vojtech@suse.cz>
14 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 ---
16
17 --- a/drivers/usb/input/wacom.c
18 +++ b/drivers/usb/input/wacom.c
19 @@ -9,7 +9,7 @@
20 * Copyright (c) 2000 Daniel Egger <egger@suse.de>
21 * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com>
22 * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be>
23 - * Copyright (c) 2002-2005 Ping Cheng <pingc@wacom.com>
24 + * Copyright (c) 2002-2006 Ping Cheng <pingc@wacom.com>
25 *
26 * ChangeLog:
27 * v0.1 (vp) - Initial release
28 @@ -56,6 +56,8 @@
29 * - Merged wacom_intuos3_irq into wacom_intuos_irq
30 * v1.44 (pc) - Added support for Graphire4, Cintiq 710, Intuos3 6x11, etc.
31 * - Report Device IDs
32 + * v1.45 (pc) - Added support for DTF 521, Intuos3 12x12 and 12x19
33 + * - Minor data report fix
34 */
35
36 /*
37 @@ -78,7 +80,7 @@
38 /*
39 * Version Information
40 */
41 -#define DRIVER_VERSION "v1.44"
42 +#define DRIVER_VERSION "v1.45"
43 #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
44 #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver"
45 #define DRIVER_LICENSE "GPL"
46 @@ -99,6 +101,8 @@ enum {
47 PL,
48 INTUOS,
49 INTUOS3,
50 + INTUOS312,
51 + INTUOS319,
52 CINTIQ,
53 MAX_TYPE
54 };
55 @@ -127,7 +131,19 @@ struct wacom {
56 char phys[32];
57 };
58
59 +#define USB_REQ_GET_REPORT 0x01
60 #define USB_REQ_SET_REPORT 0x09
61 +
62 +static int usb_get_report(struct usb_interface *intf, unsigned char type,
63 + unsigned char id, void *buf, int size)
64 +{
65 + return usb_control_msg(interface_to_usbdev(intf),
66 + usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
67 + USB_REQ_GET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
68 + (type << 8) + id, intf->altsetting[0].desc.bInterfaceNumber,
69 + buf, size, 100);
70 +}
71 +
72 static int usb_set_report(struct usb_interface *intf, unsigned char type,
73 unsigned char id, void *buf, int size)
74 {
75 @@ -206,7 +222,8 @@ static void wacom_pl_irq(struct urb *urb
76 wacom->tool[1] = BTN_TOOL_PEN;
77 id = STYLUS_DEVICE_ID;
78 }
79 - input_report_key(dev, wacom->tool[1], id); /* report in proximity for tool */
80 + input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */
81 + input_report_abs(dev, ABS_MISC, id); /* report tool id */
82 input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
83 input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
84 input_report_abs(dev, ABS_PRESSURE, pressure);
85 @@ -239,7 +256,7 @@ static void wacom_ptu_irq(struct urb *ur
86 struct wacom *wacom = urb->context;
87 unsigned char *data = wacom->data;
88 struct input_dev *dev = wacom->dev;
89 - int retval;
90 + int retval, id;
91
92 switch (urb->status) {
93 case 0:
94 @@ -263,12 +280,15 @@ static void wacom_ptu_irq(struct urb *ur
95
96 input_regs(dev, regs);
97 if (data[1] & 0x04) {
98 - input_report_key(dev, BTN_TOOL_RUBBER, (data[1] & 0x20) ? ERASER_DEVICE_ID : 0);
99 + input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20);
100 input_report_key(dev, BTN_TOUCH, data[1] & 0x08);
101 + id = ERASER_DEVICE_ID;
102 } else {
103 - input_report_key(dev, BTN_TOOL_PEN, (data[1] & 0x20) ? STYLUS_DEVICE_ID : 0);
104 + input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20);
105 input_report_key(dev, BTN_TOUCH, data[1] & 0x01);
106 + id = STYLUS_DEVICE_ID;
107 }
108 + input_report_abs(dev, ABS_MISC, id); /* report tool id */
109 input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2]));
110 input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[4]));
111 input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6]));
112 @@ -312,7 +332,8 @@ static void wacom_penpartner_irq(struct
113 }
114
115 input_regs(dev, regs);
116 - input_report_key(dev, BTN_TOOL_PEN, STYLUS_DEVICE_ID);
117 + input_report_key(dev, BTN_TOOL_PEN, 1);
118 + input_report_abs(dev, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
119 input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1]));
120 input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3]));
121 input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127);
122 @@ -350,6 +371,8 @@ static void wacom_graphire_irq(struct ur
123 goto exit;
124 }
125
126 + if (data[0] == 99) return; /* for Volito tablets */
127 +
128 if (data[0] != 2) {
129 dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
130 goto exit;
131 @@ -374,10 +397,10 @@ static void wacom_graphire_irq(struct ur
132 case 2: /* Mouse with wheel */
133 input_report_key(dev, BTN_MIDDLE, data[1] & 0x04);
134 if (wacom->features->type == WACOM_G4) {
135 - rw = data[7] & 0x04 ? -(data[7] & 0x03) : (data[7] & 0x03);
136 - input_report_rel(dev, REL_WHEEL, rw);
137 + rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03);
138 + input_report_rel(dev, REL_WHEEL, -rw);
139 } else
140 - input_report_rel(dev, REL_WHEEL, (signed char) data[6]);
141 + input_report_rel(dev, REL_WHEEL, -(signed char) data[6]);
142 /* fall through */
143
144 case 3: /* Mouse without wheel */
145 @@ -406,39 +429,27 @@ static void wacom_graphire_irq(struct ur
146 }
147 }
148
149 - input_report_key(dev, wacom->tool[0], (data[1] & 0x10) ? id : 0);
150 + if (data[1] & 0x10)
151 + input_report_abs(dev, ABS_MISC, id); /* report tool id */
152 + else
153 + input_report_abs(dev, ABS_MISC, 0); /* reset tool id */
154 + input_report_key(dev, wacom->tool[0], data[1] & 0x10);
155 input_sync(dev);
156
157 /* send pad data */
158 if (wacom->features->type == WACOM_G4) {
159 - /* fist time sending pad data */
160 - if (wacom->tool[1] != BTN_TOOL_FINGER) {
161 - wacom->id[1] = 0;
162 - wacom->serial[1] = (data[7] & 0x38) >> 2;
163 - }
164 - if (data[7] & 0xf8) {
165 + if ((wacom->serial[1] & 0xc0) != (data[7] & 0xf8)) {
166 + wacom->id[1] = 1;
167 + wacom->serial[1] = (data[7] & 0xf8);
168 input_report_key(dev, BTN_0, (data[7] & 0x40));
169 input_report_key(dev, BTN_4, (data[7] & 0x80));
170 - if (((data[7] & 0x38) >> 2) == (wacom->serial[1] & 0x0e))
171 - /* alter REL_WHEEL value so X apps can get it */
172 - wacom->serial[1] += (wacom->serial[1] & 0x01) ? -1 : 1;
173 - else
174 - wacom->serial[1] = (data[7] & 0x38 ) >> 2;
175 -
176 - /* don't alter the value when there is no wheel event */
177 - if (wacom->serial[1] == 1)
178 - wacom->serial[1] = 0;
179 - rw = wacom->serial[1];
180 - rw = (rw & 0x08) ? -(rw & 0x07) : (rw & 0x07);
181 + rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
182 input_report_rel(dev, REL_WHEEL, rw);
183 - wacom->tool[1] = BTN_TOOL_FINGER;
184 - wacom->id[1] = data[7] & 0xf8;
185 - input_report_key(dev, wacom->tool[1], 0xf0);
186 + input_report_key(dev, BTN_TOOL_FINGER, 0xf0);
187 input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
188 } else if (wacom->id[1]) {
189 wacom->id[1] = 0;
190 - wacom->serial[1] = 0;
191 - input_report_key(dev, wacom->tool[1], 0);
192 + input_report_key(dev, BTN_TOOL_FINGER, 0);
193 input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
194 }
195 input_sync(dev);
196 @@ -516,21 +527,31 @@ static int wacom_intuos_inout(struct urb
197 default: /* Unknown tool */
198 wacom->tool[idx] = BTN_TOOL_PEN;
199 }
200 - input_report_key(dev, wacom->tool[idx], wacom->id[idx]);
201 - input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
202 - input_sync(dev);
203 + if(!((wacom->tool[idx] == BTN_TOOL_LENS) &&
204 + ((wacom->features->type == INTUOS312)
205 + || (wacom->features->type == INTUOS319)))) {
206 + input_report_abs(dev, ABS_MISC, wacom->id[idx]); /* report tool id */
207 + input_report_key(dev, wacom->tool[idx], 1);
208 + input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
209 + input_sync(dev);
210 + }
211 return 1;
212 }
213
214 /* Exit report */
215 if ((data[1] & 0xfe) == 0x80) {
216 input_report_key(dev, wacom->tool[idx], 0);
217 + input_report_abs(dev, ABS_MISC, 0); /* reset tool id */
218 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
219 input_sync(dev);
220 return 1;
221 }
222
223 - return 0;
224 + if((wacom->tool[idx] == BTN_TOOL_LENS) && ((wacom->features->type == INTUOS312)
225 + || (wacom->features->type == INTUOS319)))
226 + return 1;
227 + else
228 + return 0;
229 }
230
231 static void wacom_intuos_general(struct urb *urb)
232 @@ -600,10 +621,9 @@ static void wacom_intuos_irq(struct urb
233 /* pad packets. Works as a second tool and is always in prox */
234 if (data[0] == 12) {
235 /* initiate the pad as a device */
236 - if (wacom->tool[1] != BTN_TOOL_FINGER) {
237 + if (wacom->tool[1] != BTN_TOOL_FINGER)
238 wacom->tool[1] = BTN_TOOL_FINGER;
239 - input_report_key(dev, wacom->tool[1], 1);
240 - }
241 +
242 input_report_key(dev, BTN_0, (data[5] & 0x01));
243 input_report_key(dev, BTN_1, (data[5] & 0x02));
244 input_report_key(dev, BTN_2, (data[5] & 0x04));
245 @@ -614,6 +634,11 @@ static void wacom_intuos_irq(struct urb
246 input_report_key(dev, BTN_7, (data[6] & 0x08));
247 input_report_abs(dev, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
248 input_report_abs(dev, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
249 +
250 + if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | data[2])
251 + input_report_key(dev, wacom->tool[1], 1);
252 + else
253 + input_report_key(dev, wacom->tool[1], 0);
254 input_event(dev, EV_MSC, MSC_SERIAL, 0xffffffff);
255 input_sync(dev);
256 goto exit;
257 @@ -676,8 +701,8 @@ static void wacom_intuos_irq(struct urb
258 input_report_key(dev, BTN_LEFT, data[8] & 0x04);
259 input_report_key(dev, BTN_MIDDLE, data[8] & 0x08);
260 input_report_key(dev, BTN_RIGHT, data[8] & 0x10);
261 - input_report_rel(dev, REL_WHEEL, ((data[8] & 0x02) >> 1)
262 - - (data[8] & 0x01));
263 + input_report_rel(dev, REL_WHEEL, (data[8] & 0x01)
264 + - ((data[8] & 0x02) >> 1));
265
266 /* I3 2D mouse side buttons */
267 if (wacom->features->type == INTUOS3) {
268 @@ -695,7 +720,8 @@ static void wacom_intuos_irq(struct urb
269 }
270 }
271
272 - input_report_key(dev, wacom->tool[idx], wacom->id[idx]);
273 + input_report_abs(dev, ABS_MISC, wacom->id[idx]); /* report tool id */
274 + input_report_key(dev, wacom->tool[idx], 1);
275 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
276 input_sync(dev);
277
278 @@ -733,7 +759,8 @@ static struct wacom_features wacom_featu
279 { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq },
280 { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_pl_irq },
281 { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq },
282 - { "Wacom PL710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq },
283 + { "Wacom DTU710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq },
284 + { "Wacom DTF521", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq },
285 { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_pl_irq },
286 { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq },
287 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq },
288 @@ -744,6 +771,8 @@ static struct wacom_features wacom_featu
289 { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq },
290 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq },
291 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq },
292 + { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 15, INTUOS312, wacom_intuos_irq },
293 + { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 15, INTUOS319, wacom_intuos_irq },
294 { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_intuos_irq },
295 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq },
296 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq },
297 @@ -779,6 +808,7 @@ static struct usb_device_id wacom_ids[]
298 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) },
299 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) },
300 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) },
301 + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC3) },
302 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) },
303 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) },
304 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) },
305 @@ -788,6 +818,8 @@ static struct usb_device_id wacom_ids[]
306 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) },
307 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) },
308 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) },
309 + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) },
310 + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) },
311 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) },
312 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) },
313 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) },
314 @@ -820,7 +852,7 @@ static int wacom_probe(struct usb_interf
315 struct usb_endpoint_descriptor *endpoint;
316 struct wacom *wacom;
317 struct input_dev *input_dev;
318 - char rep_data[2] = {0x02, 0x02};
319 + char rep_data[2], limit = 0;
320
321 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
322 input_dev = input_allocate_device();
323 @@ -857,6 +889,7 @@ static int wacom_probe(struct usb_interf
324 input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0);
325 input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0);
326 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0);
327 + input_dev->absbit[LONG(ABS_MISC)] |= BIT(ABS_MISC);
328
329 switch (wacom->features->type) {
330 case WACOM_G4:
331 @@ -875,6 +908,8 @@ static int wacom_probe(struct usb_interf
332 break;
333
334 case INTUOS3:
335 + case INTUOS312:
336 + case INTUOS319:
337 case CINTIQ:
338 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER);
339 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7);
340 @@ -916,10 +951,13 @@ static int wacom_probe(struct usb_interf
341
342 input_register_device(wacom->dev);
343
344 - /* ask the tablet to report tablet data */
345 - usb_set_report(intf, 3, 2, rep_data, 2);
346 - /* repeat once (not sure why the first call often fails) */
347 - usb_set_report(intf, 3, 2, rep_data, 2);
348 + /* Ask the tablet to report tablet data. Repeat until it succeeds */
349 + do {
350 + rep_data[0] = 2;
351 + rep_data[1] = 2;
352 + usb_set_report(intf, 3, 2, rep_data, 2);
353 + usb_get_report(intf, 3, 2, rep_data, 2);
354 + } while (rep_data[1] != 2 && limit++ < 5);
355
356 usb_set_intfdata(intf, wacom);
357 return 0;

  ViewVC Help
Powered by ViewVC 1.1.20