diff options
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index bb0b3659437b..d8d372bae3cc 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -174,7 +174,7 @@ static int hidinput_setkeycode(struct input_dev *dev, | |||
174 | 174 | ||
175 | clear_bit(*old_keycode, dev->keybit); | 175 | clear_bit(*old_keycode, dev->keybit); |
176 | set_bit(usage->code, dev->keybit); | 176 | set_bit(usage->code, dev->keybit); |
177 | dbg_hid(KERN_DEBUG "Assigned keycode %d to HID usage code %x\n", | 177 | dbg_hid("Assigned keycode %d to HID usage code %x\n", |
178 | usage->code, usage->hid); | 178 | usage->code, usage->hid); |
179 | 179 | ||
180 | /* | 180 | /* |
@@ -203,8 +203,8 @@ static int hidinput_setkeycode(struct input_dev *dev, | |||
203 | * | 203 | * |
204 | * as seen in the HID specification v1.11 6.2.2.7 Global Items. | 204 | * as seen in the HID specification v1.11 6.2.2.7 Global Items. |
205 | * | 205 | * |
206 | * Only exponent 1 length units are processed. Centimeters are converted to | 206 | * Only exponent 1 length units are processed. Centimeters and inches are |
207 | * inches. Degrees are converted to radians. | 207 | * converted to millimeters. Degrees are converted to radians. |
208 | */ | 208 | */ |
209 | static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | 209 | static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) |
210 | { | 210 | { |
@@ -225,13 +225,16 @@ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | |||
225 | */ | 225 | */ |
226 | if (code == ABS_X || code == ABS_Y || code == ABS_Z) { | 226 | if (code == ABS_X || code == ABS_Y || code == ABS_Z) { |
227 | if (field->unit == 0x11) { /* If centimeters */ | 227 | if (field->unit == 0x11) { /* If centimeters */ |
228 | /* Convert to inches */ | 228 | /* Convert to millimeters */ |
229 | prev = logical_extents; | 229 | unit_exponent += 1; |
230 | logical_extents *= 254; | 230 | } else if (field->unit == 0x13) { /* If inches */ |
231 | if (logical_extents < prev) | 231 | /* Convert to millimeters */ |
232 | prev = physical_extents; | ||
233 | physical_extents *= 254; | ||
234 | if (physical_extents < prev) | ||
232 | return 0; | 235 | return 0; |
233 | unit_exponent += 2; | 236 | unit_exponent -= 1; |
234 | } else if (field->unit != 0x13) { /* If not inches */ | 237 | } else { |
235 | return 0; | 238 | return 0; |
236 | } | 239 | } |
237 | } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) { | 240 | } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) { |