Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 222877
b: refs/heads/master
c: 83ed79c
h: refs/heads/master
i:
  222875: 93c3a32
v: v3
  • Loading branch information
Dmitry Torokhov authored and Jiri Kosina committed Dec 2, 2010
1 parent 14eca25 commit 3e49059
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d65c3768afb47fb93c43fbfcafef53502edaaa85
refs/heads/master: 83ed79c561da20019cb24944f535530d73b2d615
19 changes: 11 additions & 8 deletions trunk/drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ static int hidinput_setkeycode(struct input_dev *dev,
*
* as seen in the HID specification v1.11 6.2.2.7 Global Items.
*
* Only exponent 1 length units are processed. Centimeters are converted to
* inches. Degrees are converted to radians.
* Only exponent 1 length units are processed. Centimeters and inches are
* converted to millimeters. Degrees are converted to radians.
*/
static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
{
Expand All @@ -184,13 +184,16 @@ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
*/
if (code == ABS_X || code == ABS_Y || code == ABS_Z) {
if (field->unit == 0x11) { /* If centimeters */
/* Convert to inches */
prev = logical_extents;
logical_extents *= 254;
if (logical_extents < prev)
/* Convert to millimeters */
unit_exponent += 1;
} else if (field->unit == 0x13) { /* If inches */
/* Convert to millimeters */
prev = physical_extents;
physical_extents *= 254;
if (physical_extents < prev)
return 0;
unit_exponent += 2;
} else if (field->unit != 0x13) { /* If not inches */
unit_exponent -= 1;
} else {
return 0;
}
} else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) {
Expand Down

0 comments on commit 3e49059

Please sign in to comment.