diff options
author | Nikolai Kondrashov <spbnick@gmail.com> | 2012-03-20 10:01:32 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-03-28 04:39:54 -0400 |
commit | b73b2da0353d15b712b27b1aed3c50856bdfc341 (patch) | |
tree | b05bb06a82e54edb3c1c5d8b3c431d14901fa099 /drivers/hid/hid-input.c | |
parent | d464c92b5234227c1698862a1906827e2e398ae0 (diff) |
HID: hid-input: Add digitizer tilt usage support
Add digitizer X Tilt and Y Tilt usage support along with resolution calculation.
Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 002781c5a616..22d8ce6d5a59 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -225,7 +225,10 @@ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | |||
225 | * Verify and convert units. | 225 | * Verify and convert units. |
226 | * See HID specification v1.11 6.2.2.7 Global Items for unit decoding | 226 | * See HID specification v1.11 6.2.2.7 Global Items for unit decoding |
227 | */ | 227 | */ |
228 | if (code == ABS_X || code == ABS_Y || code == ABS_Z) { | 228 | switch (code) { |
229 | case ABS_X: | ||
230 | case ABS_Y: | ||
231 | case ABS_Z: | ||
229 | if (field->unit == 0x11) { /* If centimeters */ | 232 | if (field->unit == 0x11) { /* If centimeters */ |
230 | /* Convert to millimeters */ | 233 | /* Convert to millimeters */ |
231 | unit_exponent += 1; | 234 | unit_exponent += 1; |
@@ -239,7 +242,13 @@ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | |||
239 | } else { | 242 | } else { |
240 | return 0; | 243 | return 0; |
241 | } | 244 | } |
242 | } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) { | 245 | break; |
246 | |||
247 | case ABS_RX: | ||
248 | case ABS_RY: | ||
249 | case ABS_RZ: | ||
250 | case ABS_TILT_X: | ||
251 | case ABS_TILT_Y: | ||
243 | if (field->unit == 0x14) { /* If degrees */ | 252 | if (field->unit == 0x14) { /* If degrees */ |
244 | /* Convert to radians */ | 253 | /* Convert to radians */ |
245 | prev = logical_extents; | 254 | prev = logical_extents; |
@@ -250,7 +259,9 @@ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | |||
250 | } else if (field->unit != 0x12) { /* If not radians */ | 259 | } else if (field->unit != 0x12) { /* If not radians */ |
251 | return 0; | 260 | return 0; |
252 | } | 261 | } |
253 | } else { | 262 | break; |
263 | |||
264 | default: | ||
254 | return 0; | 265 | return 0; |
255 | } | 266 | } |
256 | 267 | ||
@@ -623,6 +634,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
623 | map_key_clear(BTN_TOOL_RUBBER); | 634 | map_key_clear(BTN_TOOL_RUBBER); |
624 | break; | 635 | break; |
625 | 636 | ||
637 | case 0x3d: /* X Tilt */ | ||
638 | map_abs_clear(ABS_TILT_X); | ||
639 | break; | ||
640 | |||
641 | case 0x3e: /* Y Tilt */ | ||
642 | map_abs_clear(ABS_TILT_Y); | ||
643 | break; | ||
644 | |||
626 | case 0x33: /* Touch */ | 645 | case 0x33: /* Touch */ |
627 | case 0x42: /* TipSwitch */ | 646 | case 0x42: /* TipSwitch */ |
628 | case 0x43: /* TipSwitch2 */ | 647 | case 0x43: /* TipSwitch2 */ |