aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-12-02 20:40:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-12-02 20:40:04 -0500
commit59e57c622c3502346e8f930421ebc482d639520c (patch)
treeb3e8e450fdcc07dd1ed92fac9cc712870f2ca2dc /drivers/hid/hid-input.c
parent33dd94ae1ccbfb7bf0fb6c692bc3d1c4269e6177 (diff)
parent83ed79c561da20019cb24944f535530d73b2d615 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: length resolution should be reported units/mm HID: add support for F430 Force Feedback Wheel HID: egalax: Use kzalloc HID: Remove KERN_DEBUG from dbg_hid use Manually fixed trivial conflict in drivers/hid/hid-input.c (due to removal of KERN_DEBUG from dbg_hid use clashing with new keycode interface switch)
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c21
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 */
209static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) 209static __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) {