diff options
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 8741d953dcc8..d97f2323af57 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -192,6 +192,7 @@ static int hidinput_setkeycode(struct input_dev *dev, | |||
192 | return -EINVAL; | 192 | return -EINVAL; |
193 | } | 193 | } |
194 | 194 | ||
195 | |||
195 | /** | 196 | /** |
196 | * hidinput_calc_abs_res - calculate an absolute axis resolution | 197 | * hidinput_calc_abs_res - calculate an absolute axis resolution |
197 | * @field: the HID report field to calculate resolution for | 198 | * @field: the HID report field to calculate resolution for |
@@ -234,23 +235,17 @@ __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | |||
234 | case ABS_MT_TOOL_Y: | 235 | case ABS_MT_TOOL_Y: |
235 | case ABS_MT_TOUCH_MAJOR: | 236 | case ABS_MT_TOUCH_MAJOR: |
236 | case ABS_MT_TOUCH_MINOR: | 237 | case ABS_MT_TOUCH_MINOR: |
237 | if (field->unit & 0xffffff00) /* Not a length */ | 238 | if (field->unit == 0x11) { /* If centimeters */ |
238 | return 0; | ||
239 | unit_exponent += hid_snto32(field->unit >> 4, 4) - 1; | ||
240 | switch (field->unit & 0xf) { | ||
241 | case 0x1: /* If centimeters */ | ||
242 | /* Convert to millimeters */ | 239 | /* Convert to millimeters */ |
243 | unit_exponent += 1; | 240 | unit_exponent += 1; |
244 | break; | 241 | } else if (field->unit == 0x13) { /* If inches */ |
245 | case 0x3: /* If inches */ | ||
246 | /* Convert to millimeters */ | 242 | /* Convert to millimeters */ |
247 | prev = physical_extents; | 243 | prev = physical_extents; |
248 | physical_extents *= 254; | 244 | physical_extents *= 254; |
249 | if (physical_extents < prev) | 245 | if (physical_extents < prev) |
250 | return 0; | 246 | return 0; |
251 | unit_exponent -= 1; | 247 | unit_exponent -= 1; |
252 | break; | 248 | } else { |
253 | default: | ||
254 | return 0; | 249 | return 0; |
255 | } | 250 | } |
256 | break; | 251 | break; |