aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2008-02-07 10:48:46 -0500
committerJiri Kosina <jkosina@suse.cz>2008-02-11 07:01:51 -0500
commit68a1f2cc8676f22a6fd49f344f99e326eb7f5117 (patch)
treed71703b0cbb0f13b8b183e8d512872e8ef763ed5 /drivers/hid
parentdda3fd3535566b4d2b450dded23f1334a5f60bd6 (diff)
HID: fix processing of event quirks
The old code (before move) stopped further processing of the event after it has been already processed by the quirk handler. The new code didn't propagate the return value properly, and therefore the processing always proceeded, which was wrong. This patch fixes it. Pointed out in kernel.org bugzilla #9842 Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-input-quirks.c17
-rw-r--r--drivers/hid/hid-input.c3
2 files changed, 11 insertions, 9 deletions
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index a870ba58faa..dceadd0c141 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -352,7 +352,7 @@ int hidinput_mapping_quirks(struct hid_usage *usage,
352 return 0; 352 return 0;
353} 353}
354 354
355void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) 355int hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)
356{ 356{
357 struct input_dev *input; 357 struct input_dev *input;
358 358
@@ -362,34 +362,34 @@ void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, stru
362 || ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) { 362 || ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) {
363 if (value) hid->quirks |= HID_QUIRK_2WHEEL_MOUSE_HACK_ON; 363 if (value) hid->quirks |= HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
364 else hid->quirks &= ~HID_QUIRK_2WHEEL_MOUSE_HACK_ON; 364 else hid->quirks &= ~HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
365 return; 365 return 1;
366 } 366 }
367 367
368 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) && 368 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) &&
369 (usage->type == EV_REL) && 369 (usage->type == EV_REL) &&
370 (usage->code == REL_WHEEL)) { 370 (usage->code == REL_WHEEL)) {
371 hid->delayed_value = value; 371 hid->delayed_value = value;
372 return; 372 return 1;
373 } 373 }
374 374
375 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) && 375 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) &&
376 (usage->hid == 0x000100b8)) { 376 (usage->hid == 0x000100b8)) {
377 input_event(input, EV_REL, value ? REL_HWHEEL : REL_WHEEL, hid->delayed_value); 377 input_event(input, EV_REL, value ? REL_HWHEEL : REL_WHEEL, hid->delayed_value);
378 return; 378 return 1;
379 } 379 }
380 380
381 if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) { 381 if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) {
382 input_event(input, usage->type, usage->code, -value); 382 input_event(input, usage->type, usage->code, -value);
383 return; 383 return 1;
384 } 384 }
385 385
386 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON) && (usage->code == REL_WHEEL)) { 386 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON) && (usage->code == REL_WHEEL)) {
387 input_event(input, usage->type, REL_HWHEEL, value); 387 input_event(input, usage->type, REL_HWHEEL, value);
388 return; 388 return 1;
389 } 389 }
390 390
391 if ((hid->quirks & HID_QUIRK_APPLE_HAS_FN) && hidinput_apple_event(hid, input, usage, value)) 391 if ((hid->quirks & HID_QUIRK_APPLE_HAS_FN) && hidinput_apple_event(hid, input, usage, value))
392 return; 392 return 1;
393 393
394 /* Handling MS keyboards special buttons */ 394 /* Handling MS keyboards special buttons */
395 if (hid->quirks & HID_QUIRK_MICROSOFT_KEYS && 395 if (hid->quirks & HID_QUIRK_MICROSOFT_KEYS &&
@@ -416,8 +416,9 @@ void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, stru
416 if (hid->quirks & HID_QUIRK_HWHEEL_WHEEL_INVERT && 416 if (hid->quirks & HID_QUIRK_HWHEEL_WHEEL_INVERT &&
417 usage->type == EV_REL && usage->code == REL_HWHEEL) { 417 usage->type == EV_REL && usage->code == REL_HWHEEL) {
418 input_event(input, usage->type, REL_WHEEL, -value); 418 input_event(input, usage->type, REL_WHEEL, -value);
419 return; 419 return 1;
420 } 420 }
421 return 0;
421} 422}
422 423
423 424
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 5325d98b432..43342785110 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -854,7 +854,8 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
854 return; 854 return;
855 855
856 /* handle input events for quirky devices */ 856 /* handle input events for quirky devices */
857 hidinput_event_quirks(hid, field, usage, value); 857 if (hidinput_event_quirks(hid, field, usage, value))
858 return;
858 859
859 if (usage->hat_min < usage->hat_max || usage->hat_dir) { 860 if (usage->hat_min < usage->hat_max || usage->hat_dir) {
860 int hat_dir = usage->hat_dir; 861 int hat_dir = usage->hat_dir;