diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-08 07:52:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-08 07:52:00 -0500 |
commit | 4d117c5c6b00254e51c61ff5b506ccaba21a5a03 (patch) | |
tree | ecb9d3ee4bfd9610c459c1eb0c0357c2905f3ae4 /drivers/input/tablet/wacom_sys.c | |
parent | 6c415b9234a8c71f290e5d4fddc467f103f32719 (diff) | |
parent | 43714539eab42b2fa3653ea7bd667b36c2291b11 (diff) |
Merge branch 'sched/urgent' into sched/core
Diffstat (limited to 'drivers/input/tablet/wacom_sys.c')
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 228 |
1 files changed, 199 insertions, 29 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 09e227aa0d49..484496daa0f3 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -14,8 +14,41 @@ | |||
14 | #include "wacom.h" | 14 | #include "wacom.h" |
15 | #include "wacom_wac.h" | 15 | #include "wacom_wac.h" |
16 | 16 | ||
17 | /* defines to get HID report descriptor */ | ||
18 | #define HID_DEVICET_HID (USB_TYPE_CLASS | 0x01) | ||
19 | #define HID_DEVICET_REPORT (USB_TYPE_CLASS | 0x02) | ||
20 | #define HID_USAGE_UNDEFINED 0x00 | ||
21 | #define HID_USAGE_PAGE 0x05 | ||
22 | #define HID_USAGE_PAGE_DIGITIZER 0x0d | ||
23 | #define HID_USAGE_PAGE_DESKTOP 0x01 | ||
24 | #define HID_USAGE 0x09 | ||
25 | #define HID_USAGE_X 0x30 | ||
26 | #define HID_USAGE_Y 0x31 | ||
27 | #define HID_USAGE_X_TILT 0x3d | ||
28 | #define HID_USAGE_Y_TILT 0x3e | ||
29 | #define HID_USAGE_FINGER 0x22 | ||
30 | #define HID_USAGE_STYLUS 0x20 | ||
31 | #define HID_COLLECTION 0xc0 | ||
32 | |||
33 | enum { | ||
34 | WCM_UNDEFINED = 0, | ||
35 | WCM_DESKTOP, | ||
36 | WCM_DIGITIZER, | ||
37 | }; | ||
38 | |||
39 | struct hid_descriptor { | ||
40 | struct usb_descriptor_header header; | ||
41 | __le16 bcdHID; | ||
42 | u8 bCountryCode; | ||
43 | u8 bNumDescriptors; | ||
44 | u8 bDescriptorType; | ||
45 | __le16 wDescriptorLength; | ||
46 | } __attribute__ ((packed)); | ||
47 | |||
48 | /* defines to get/set USB message */ | ||
17 | #define USB_REQ_GET_REPORT 0x01 | 49 | #define USB_REQ_GET_REPORT 0x01 |
18 | #define USB_REQ_SET_REPORT 0x09 | 50 | #define USB_REQ_SET_REPORT 0x09 |
51 | #define WAC_HID_FEATURE_REPORT 0x03 | ||
19 | 52 | ||
20 | static int usb_get_report(struct usb_interface *intf, unsigned char type, | 53 | static int usb_get_report(struct usb_interface *intf, unsigned char type, |
21 | unsigned char id, void *buf, int size) | 54 | unsigned char id, void *buf, int size) |
@@ -80,25 +113,21 @@ static void wacom_sys_irq(struct urb *urb) | |||
80 | void wacom_report_key(void *wcombo, unsigned int key_type, int key_data) | 113 | void wacom_report_key(void *wcombo, unsigned int key_type, int key_data) |
81 | { | 114 | { |
82 | input_report_key(get_input_dev((struct wacom_combo *)wcombo), key_type, key_data); | 115 | input_report_key(get_input_dev((struct wacom_combo *)wcombo), key_type, key_data); |
83 | return; | ||
84 | } | 116 | } |
85 | 117 | ||
86 | void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data) | 118 | void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data) |
87 | { | 119 | { |
88 | input_report_abs(get_input_dev((struct wacom_combo *)wcombo), abs_type, abs_data); | 120 | input_report_abs(get_input_dev((struct wacom_combo *)wcombo), abs_type, abs_data); |
89 | return; | ||
90 | } | 121 | } |
91 | 122 | ||
92 | void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data) | 123 | void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data) |
93 | { | 124 | { |
94 | input_report_rel(get_input_dev((struct wacom_combo *)wcombo), rel_type, rel_data); | 125 | input_report_rel(get_input_dev((struct wacom_combo *)wcombo), rel_type, rel_data); |
95 | return; | ||
96 | } | 126 | } |
97 | 127 | ||
98 | void wacom_input_event(void *wcombo, unsigned int type, unsigned int code, int value) | 128 | void wacom_input_event(void *wcombo, unsigned int type, unsigned int code, int value) |
99 | { | 129 | { |
100 | input_event(get_input_dev((struct wacom_combo *)wcombo), type, code, value); | 130 | input_event(get_input_dev((struct wacom_combo *)wcombo), type, code, value); |
101 | return; | ||
102 | } | 131 | } |
103 | 132 | ||
104 | __u16 wacom_be16_to_cpu(unsigned char *data) | 133 | __u16 wacom_be16_to_cpu(unsigned char *data) |
@@ -118,7 +147,6 @@ __u16 wacom_le16_to_cpu(unsigned char *data) | |||
118 | void wacom_input_sync(void *wcombo) | 147 | void wacom_input_sync(void *wcombo) |
119 | { | 148 | { |
120 | input_sync(get_input_dev((struct wacom_combo *)wcombo)); | 149 | input_sync(get_input_dev((struct wacom_combo *)wcombo)); |
121 | return; | ||
122 | } | 150 | } |
123 | 151 | ||
124 | static int wacom_open(struct input_dev *dev) | 152 | static int wacom_open(struct input_dev *dev) |
@@ -160,7 +188,7 @@ static void wacom_close(struct input_dev *dev) | |||
160 | 188 | ||
161 | void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 189 | void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
162 | { | 190 | { |
163 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_1) | | 191 | input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_1) | |
164 | BIT_MASK(BTN_5); | 192 | BIT_MASK(BTN_5); |
165 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | 193 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
166 | } | 194 | } |
@@ -170,7 +198,7 @@ void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
170 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); | 198 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); |
171 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); | 199 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); |
172 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER); | 200 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER); |
173 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) | | 201 | input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_0) | |
174 | BIT_MASK(BTN_4); | 202 | BIT_MASK(BTN_4); |
175 | } | 203 | } |
176 | 204 | ||
@@ -178,7 +206,7 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
178 | { | 206 | { |
179 | input_dev->evbit[0] |= BIT_MASK(EV_REL); | 207 | input_dev->evbit[0] |= BIT_MASK(EV_REL); |
180 | input_dev->relbit[0] |= BIT_MASK(REL_WHEEL); | 208 | input_dev->relbit[0] |= BIT_MASK(REL_WHEEL); |
181 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 209 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_LEFT) | |
182 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); | 210 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); |
183 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | | 211 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | |
184 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); | 212 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); |
@@ -188,7 +216,7 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
188 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 216 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
189 | { | 217 | { |
190 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER); | 218 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER); |
191 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) | | 219 | input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_0) | |
192 | BIT_MASK(BTN_1) | BIT_MASK(BTN_2) | BIT_MASK(BTN_3); | 220 | BIT_MASK(BTN_1) | BIT_MASK(BTN_2) | BIT_MASK(BTN_3); |
193 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); | 221 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
194 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 222 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
@@ -196,14 +224,14 @@ void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
196 | 224 | ||
197 | void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 225 | void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
198 | { | 226 | { |
199 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_4) | | 227 | input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_4) | |
200 | BIT_MASK(BTN_5) | BIT_MASK(BTN_6) | BIT_MASK(BTN_7); | 228 | BIT_MASK(BTN_5) | BIT_MASK(BTN_6) | BIT_MASK(BTN_7); |
201 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | 229 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
202 | } | 230 | } |
203 | 231 | ||
204 | void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 232 | void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
205 | { | 233 | { |
206 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_8) | BIT_MASK(BTN_9); | 234 | input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_8) | BIT_MASK(BTN_9); |
207 | } | 235 | } |
208 | 236 | ||
209 | void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 237 | void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -211,7 +239,7 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
211 | input_dev->evbit[0] |= BIT_MASK(EV_MSC) | BIT_MASK(EV_REL); | 239 | input_dev->evbit[0] |= BIT_MASK(EV_MSC) | BIT_MASK(EV_REL); |
212 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); | 240 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); |
213 | input_dev->relbit[0] |= BIT_MASK(REL_WHEEL); | 241 | input_dev->relbit[0] |= BIT_MASK(REL_WHEEL); |
214 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 242 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_LEFT) | |
215 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE) | | 243 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE) | |
216 | BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA); | 244 | BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA); |
217 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | | 245 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | |
@@ -228,8 +256,7 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
228 | 256 | ||
229 | void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 257 | void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
230 | { | 258 | { |
231 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_STYLUS2) | | 259 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_STYLUS2); |
232 | BIT_MASK(BTN_TOOL_RUBBER); | ||
233 | } | 260 | } |
234 | 261 | ||
235 | void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 262 | void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -237,15 +264,129 @@ void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
237 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER); | 264 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER); |
238 | } | 265 | } |
239 | 266 | ||
267 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, | ||
268 | struct wacom_wac *wacom_wac) | ||
269 | { | ||
270 | struct usb_device *dev = interface_to_usbdev(intf); | ||
271 | struct wacom_features *features = wacom_wac->features; | ||
272 | char limit = 0, result = 0; | ||
273 | int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0; | ||
274 | unsigned char *report; | ||
275 | |||
276 | report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL); | ||
277 | if (!report) | ||
278 | return -ENOMEM; | ||
279 | |||
280 | /* retrive report descriptors */ | ||
281 | do { | ||
282 | result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
283 | USB_REQ_GET_DESCRIPTOR, | ||
284 | USB_RECIP_INTERFACE | USB_DIR_IN, | ||
285 | HID_DEVICET_REPORT << 8, | ||
286 | intf->altsetting[0].desc.bInterfaceNumber, /* interface */ | ||
287 | report, | ||
288 | hid_desc->wDescriptorLength, | ||
289 | 5000); /* 5 secs */ | ||
290 | } while (result < 0 && limit++ < 5); | ||
291 | |||
292 | if (result < 0) | ||
293 | goto out; | ||
294 | |||
295 | for (i = 0; i < hid_desc->wDescriptorLength; i++) { | ||
296 | |||
297 | switch (report[i]) { | ||
298 | case HID_USAGE_PAGE: | ||
299 | switch (report[i + 1]) { | ||
300 | case HID_USAGE_PAGE_DIGITIZER: | ||
301 | usage = WCM_DIGITIZER; | ||
302 | i++; | ||
303 | break; | ||
304 | |||
305 | case HID_USAGE_PAGE_DESKTOP: | ||
306 | usage = WCM_DESKTOP; | ||
307 | i++; | ||
308 | break; | ||
309 | } | ||
310 | break; | ||
311 | |||
312 | case HID_USAGE: | ||
313 | switch (report[i + 1]) { | ||
314 | case HID_USAGE_X: | ||
315 | if (usage == WCM_DESKTOP) { | ||
316 | if (finger) { | ||
317 | features->touch_x_max = | ||
318 | features->touch_y_max = | ||
319 | wacom_le16_to_cpu(&report[i + 3]); | ||
320 | features->x_max = | ||
321 | wacom_le16_to_cpu(&report[i + 6]); | ||
322 | i += 7; | ||
323 | } else if (pen) { | ||
324 | features->x_max = | ||
325 | wacom_le16_to_cpu(&report[i + 3]); | ||
326 | i += 4; | ||
327 | } | ||
328 | } else if (usage == WCM_DIGITIZER) { | ||
329 | /* max pressure isn't reported | ||
330 | features->pressure_max = (unsigned short) | ||
331 | (report[i+4] << 8 | report[i + 3]); | ||
332 | */ | ||
333 | features->pressure_max = 255; | ||
334 | i += 4; | ||
335 | } | ||
336 | break; | ||
337 | |||
338 | case HID_USAGE_Y: | ||
339 | if (usage == WCM_DESKTOP) | ||
340 | features->y_max = | ||
341 | wacom_le16_to_cpu(&report[i + 3]); | ||
342 | i += 4; | ||
343 | break; | ||
344 | |||
345 | case HID_USAGE_FINGER: | ||
346 | finger = 1; | ||
347 | i++; | ||
348 | break; | ||
349 | |||
350 | case HID_USAGE_STYLUS: | ||
351 | pen = 1; | ||
352 | i++; | ||
353 | break; | ||
354 | |||
355 | case HID_USAGE_UNDEFINED: | ||
356 | if (usage == WCM_DESKTOP && finger) /* capacity */ | ||
357 | features->pressure_max = | ||
358 | wacom_le16_to_cpu(&report[i + 3]); | ||
359 | i += 4; | ||
360 | break; | ||
361 | } | ||
362 | break; | ||
363 | |||
364 | case HID_COLLECTION: | ||
365 | /* reset UsagePage ans Finger */ | ||
366 | finger = usage = 0; | ||
367 | break; | ||
368 | } | ||
369 | } | ||
370 | |||
371 | result = 0; | ||
372 | |||
373 | out: | ||
374 | kfree(report); | ||
375 | return result; | ||
376 | } | ||
377 | |||
240 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) | 378 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) |
241 | { | 379 | { |
242 | struct usb_device *dev = interface_to_usbdev(intf); | 380 | struct usb_device *dev = interface_to_usbdev(intf); |
381 | struct usb_host_interface *interface = intf->cur_altsetting; | ||
243 | struct usb_endpoint_descriptor *endpoint; | 382 | struct usb_endpoint_descriptor *endpoint; |
244 | struct wacom *wacom; | 383 | struct wacom *wacom; |
245 | struct wacom_wac *wacom_wac; | 384 | struct wacom_wac *wacom_wac; |
385 | struct wacom_features *features; | ||
246 | struct input_dev *input_dev; | 386 | struct input_dev *input_dev; |
247 | int error = -ENOMEM; | 387 | int error = -ENOMEM; |
248 | char rep_data[2], limit = 0; | 388 | char rep_data[2], limit = 0; |
389 | struct hid_descriptor *hid_desc; | ||
249 | 390 | ||
250 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 391 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
251 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); | 392 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); |
@@ -268,8 +409,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
268 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); | 409 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); |
269 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); | 410 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); |
270 | 411 | ||
271 | wacom_wac->features = get_wacom_feature(id); | 412 | wacom_wac->features = features = get_wacom_feature(id); |
272 | BUG_ON(wacom_wac->features->pktlen > 10); | 413 | BUG_ON(features->pktlen > 10); |
273 | 414 | ||
274 | input_dev->name = wacom_wac->features->name; | 415 | input_dev->name = wacom_wac->features->name; |
275 | wacom->wacom_wac = wacom_wac; | 416 | wacom->wacom_wac = wacom_wac; |
@@ -282,18 +423,37 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
282 | input_dev->open = wacom_open; | 423 | input_dev->open = wacom_open; |
283 | input_dev->close = wacom_close; | 424 | input_dev->close = wacom_close; |
284 | 425 | ||
426 | endpoint = &intf->cur_altsetting->endpoint[0].desc; | ||
427 | |||
428 | /* TabletPC need to retrieve the physical and logical maximum from report descriptor */ | ||
429 | if (wacom_wac->features->type == TABLETPC) { | ||
430 | if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { | ||
431 | if (usb_get_extra_descriptor(&interface->endpoint[0], | ||
432 | HID_DEVICET_REPORT, &hid_desc)) { | ||
433 | printk("wacom: can not retrive extra class descriptor\n"); | ||
434 | goto fail2; | ||
435 | } | ||
436 | } | ||
437 | error = wacom_parse_hid(intf, hid_desc, wacom_wac); | ||
438 | if (error) | ||
439 | goto fail2; | ||
440 | } | ||
441 | |||
285 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 442 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
286 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) | | 443 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) | |
287 | BIT_MASK(BTN_TOUCH) | BIT_MASK(BTN_STYLUS); | 444 | BIT_MASK(BTN_TOUCH) | BIT_MASK(BTN_STYLUS); |
288 | input_set_abs_params(input_dev, ABS_X, 0, wacom_wac->features->x_max, 4, 0); | 445 | input_set_abs_params(input_dev, ABS_X, 0, features->x_max, 4, 0); |
289 | input_set_abs_params(input_dev, ABS_Y, 0, wacom_wac->features->y_max, 4, 0); | 446 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, 4, 0); |
290 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom_wac->features->pressure_max, 0, 0); | 447 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 0, 0); |
448 | if (features->type == TABLETPC) { | ||
449 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_DOUBLETAP); | ||
450 | input_set_abs_params(input_dev, ABS_RX, 0, features->touch_x_max, 4, 0); | ||
451 | input_set_abs_params(input_dev, ABS_RY, 0, features->touch_y_max, 4, 0); | ||
452 | } | ||
291 | input_dev->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); | 453 | input_dev->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); |
292 | 454 | ||
293 | wacom_init_input_dev(input_dev, wacom_wac); | 455 | wacom_init_input_dev(input_dev, wacom_wac); |
294 | 456 | ||
295 | endpoint = &intf->cur_altsetting->endpoint[0].desc; | ||
296 | |||
297 | usb_fill_int_urb(wacom->irq, dev, | 457 | usb_fill_int_urb(wacom->irq, dev, |
298 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), | 458 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), |
299 | wacom_wac->data, wacom_wac->features->pktlen, | 459 | wacom_wac->data, wacom_wac->features->pktlen, |
@@ -305,13 +465,22 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
305 | if (error) | 465 | if (error) |
306 | goto fail3; | 466 | goto fail3; |
307 | 467 | ||
308 | /* Ask the tablet to report tablet data. Repeat until it succeeds */ | 468 | /* |
309 | do { | 469 | * Ask the tablet to report tablet data if it is not a Tablet PC. |
310 | rep_data[0] = 2; | 470 | * Repeat until it succeeds |
311 | rep_data[1] = 2; | 471 | */ |
312 | usb_set_report(intf, 3, 2, rep_data, 2); | 472 | if (wacom_wac->features->type != TABLETPC) { |
313 | usb_get_report(intf, 3, 2, rep_data, 2); | 473 | do { |
314 | } while (rep_data[1] != 2 && limit++ < 5); | 474 | rep_data[0] = 2; |
475 | rep_data[1] = 2; | ||
476 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, | ||
477 | 2, rep_data, 2); | ||
478 | if (error >= 0) | ||
479 | error = usb_get_report(intf, | ||
480 | WAC_HID_FEATURE_REPORT, 2, | ||
481 | rep_data, 2); | ||
482 | } while ((error < 0 || rep_data[1] != 2) && limit++ < 5); | ||
483 | } | ||
315 | 484 | ||
316 | usb_set_intfdata(intf, wacom); | 485 | usb_set_intfdata(intf, wacom); |
317 | return 0; | 486 | return 0; |
@@ -333,7 +502,8 @@ static void wacom_disconnect(struct usb_interface *intf) | |||
333 | usb_kill_urb(wacom->irq); | 502 | usb_kill_urb(wacom->irq); |
334 | input_unregister_device(wacom->dev); | 503 | input_unregister_device(wacom->dev); |
335 | usb_free_urb(wacom->irq); | 504 | usb_free_urb(wacom->irq); |
336 | usb_buffer_free(interface_to_usbdev(intf), 10, wacom->wacom_wac->data, wacom->data_dma); | 505 | usb_buffer_free(interface_to_usbdev(intf), 10, |
506 | wacom->wacom_wac->data, wacom->data_dma); | ||
337 | kfree(wacom->wacom_wac); | 507 | kfree(wacom->wacom_wac); |
338 | kfree(wacom); | 508 | kfree(wacom); |
339 | } | 509 | } |