diff options
author | Przemo Firszt <przemo@firszt.eu> | 2012-02-24 08:52:32 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-02-27 09:29:07 -0500 |
commit | 2470900b68ccfde046d5a20c47ae9abb4e406084 (patch) | |
tree | 548bc5ccd4073e1ebccf65d2927c85867c1d2791 /drivers/hid | |
parent | 2c653e6bac85918ae76ed0199f25fb6a2206b92d (diff) |
HID: wacom: Add serial and id reporting for Wacom Intuos4 WL
This patch implements reporting id and serial number of used tool.
Reported values are the same as for USB on of the driver for wacom Intuos4 WL
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-wacom.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index c4a193b6c44e..a3476f9a5103 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c | |||
@@ -35,6 +35,8 @@ struct wacom_data { | |||
35 | __u16 tool; | 35 | __u16 tool; |
36 | unsigned char butstate; | 36 | unsigned char butstate; |
37 | __u8 features; | 37 | __u8 features; |
38 | __u32 id; | ||
39 | __u32 serial; | ||
38 | unsigned char high_speed; | 40 | unsigned char high_speed; |
39 | #ifdef CONFIG_HID_WACOM_POWER_SUPPLY | 41 | #ifdef CONFIG_HID_WACOM_POWER_SUPPLY |
40 | int battery_capacity; | 42 | int battery_capacity; |
@@ -318,26 +320,30 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, | |||
318 | struct input_dev *input, unsigned char *data) | 320 | struct input_dev *input, unsigned char *data) |
319 | { | 321 | { |
320 | __u16 x, y, pressure; | 322 | __u16 x, y, pressure; |
321 | __u32 id; | ||
322 | 323 | ||
323 | switch (data[1]) { | 324 | switch (data[1]) { |
324 | case 0x80: /* Out of proximity report */ | 325 | case 0x80: /* Out of proximity report */ |
325 | input_report_key(input, BTN_TOUCH, 0); | 326 | input_report_key(input, BTN_TOUCH, 0); |
326 | input_report_abs(input, ABS_PRESSURE, 0); | 327 | input_report_abs(input, ABS_PRESSURE, 0); |
327 | input_report_key(input, wdata->tool, 0); | 328 | input_report_key(input, wdata->tool, 0); |
329 | input_report_abs(input, ABS_MISC, 0); | ||
330 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); | ||
328 | wdata->tool = 0; | 331 | wdata->tool = 0; |
329 | input_sync(input); | 332 | input_sync(input); |
330 | break; | 333 | break; |
331 | case 0xC2: /* Tool report */ | 334 | case 0xC2: /* Tool report */ |
332 | id = ((data[2] << 4) | (data[3] >> 4) | | 335 | wdata->id = ((data[2] << 4) | (data[3] >> 4) | |
333 | ((data[7] & 0x0f) << 20) | | 336 | ((data[7] & 0x0f) << 20) | |
334 | ((data[8] & 0xf0) << 12)) & 0xfffff; | 337 | ((data[8] & 0xf0) << 12)); |
338 | wdata->serial = ((data[3] & 0x0f) << 28) + | ||
339 | (data[4] << 20) + (data[5] << 12) + | ||
340 | (data[6] << 4) + (data[7] >> 4); | ||
335 | 341 | ||
336 | switch (id) { | 342 | switch (wdata->id) { |
337 | case 0x802: | 343 | case 0x100802: |
338 | wdata->tool = BTN_TOOL_PEN; | 344 | wdata->tool = BTN_TOOL_PEN; |
339 | break; | 345 | break; |
340 | case 0x80A: | 346 | case 0x10080A: |
341 | wdata->tool = BTN_TOOL_RUBBER; | 347 | wdata->tool = BTN_TOOL_RUBBER; |
342 | break; | 348 | break; |
343 | } | 349 | } |
@@ -356,6 +362,9 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, | |||
356 | input_report_abs(input, ABS_X, x); | 362 | input_report_abs(input, ABS_X, x); |
357 | input_report_abs(input, ABS_Y, y); | 363 | input_report_abs(input, ABS_Y, y); |
358 | input_report_abs(input, ABS_PRESSURE, pressure); | 364 | input_report_abs(input, ABS_PRESSURE, pressure); |
365 | input_report_abs(input, ABS_MISC, wdata->id); | ||
366 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); | ||
367 | input_report_key(input, wdata->tool, 1); | ||
359 | input_sync(input); | 368 | input_sync(input); |
360 | break; | 369 | break; |
361 | } | 370 | } |