diff options
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 163 |
1 files changed, 9 insertions, 154 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 0da29cf43713..3d448037c82f 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -367,7 +367,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
367 | { | 367 | { |
368 | struct input_dev *input = hidinput->input; | 368 | struct input_dev *input = hidinput->input; |
369 | struct hid_device *device = input_get_drvdata(input); | 369 | struct hid_device *device = input_get_drvdata(input); |
370 | int max = 0, code; | 370 | int max = 0, code, ret; |
371 | unsigned long *bit = NULL; | 371 | unsigned long *bit = NULL; |
372 | 372 | ||
373 | field->hidinput = hidinput; | 373 | field->hidinput = hidinput; |
@@ -386,6 +386,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
386 | goto ignore; | 386 | goto ignore; |
387 | } | 387 | } |
388 | 388 | ||
389 | ret = hidinput_mapping_quirks(usage, input, bit, &max); | ||
390 | if (ret) | ||
391 | goto mapped; | ||
392 | |||
389 | switch (usage->hid & HID_USAGE_PAGE) { | 393 | switch (usage->hid & HID_USAGE_PAGE) { |
390 | 394 | ||
391 | case HID_UP_UNDEFINED: | 395 | case HID_UP_UNDEFINED: |
@@ -573,14 +577,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
573 | case 0x000: goto ignore; | 577 | case 0x000: goto ignore; |
574 | case 0x034: map_key_clear(KEY_SLEEP); break; | 578 | case 0x034: map_key_clear(KEY_SLEEP); break; |
575 | case 0x036: map_key_clear(BTN_MISC); break; | 579 | case 0x036: map_key_clear(BTN_MISC); break; |
576 | /* | ||
577 | * The next three are reported by Belkin wireless | ||
578 | * keyboard (1020:0006). These values are "reserved" | ||
579 | * in HUT 1.12. | ||
580 | */ | ||
581 | case 0x03a: map_key_clear(KEY_SOUND); break; | ||
582 | case 0x03b: map_key_clear(KEY_CAMERA); break; | ||
583 | case 0x03c: map_key_clear(KEY_DOCUMENTS); break; | ||
584 | 580 | ||
585 | case 0x040: map_key_clear(KEY_MENU); break; | 581 | case 0x040: map_key_clear(KEY_MENU); break; |
586 | case 0x045: map_key_clear(KEY_RADIO); break; | 582 | case 0x045: map_key_clear(KEY_RADIO); break; |
@@ -626,16 +622,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
626 | case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; | 622 | case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; |
627 | case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; | 623 | case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; |
628 | 624 | ||
629 | /* reserved in HUT 1.12. Reported on Petalynx remote */ | ||
630 | case 0x0f6: map_key_clear(KEY_NEXT); break; | ||
631 | case 0x0fa: map_key_clear(KEY_BACK); break; | ||
632 | |||
633 | /* reserved in HUT 1.12. Reported on Genius KB29E */ | ||
634 | case 0x156: map_key_clear(KEY_WORDPROCESSOR); break; | ||
635 | case 0x157: map_key_clear(KEY_SPREADSHEET); break; | ||
636 | case 0x158: map_key_clear(KEY_PRESENTATION); break; | ||
637 | case 0x15c: map_key_clear(KEY_STOP); break; | ||
638 | |||
639 | case 0x182: map_key_clear(KEY_BOOKMARKS); break; | 625 | case 0x182: map_key_clear(KEY_BOOKMARKS); break; |
640 | case 0x183: map_key_clear(KEY_CONFIG); break; | 626 | case 0x183: map_key_clear(KEY_CONFIG); break; |
641 | case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; | 627 | case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; |
@@ -695,51 +681,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
695 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; | 681 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; |
696 | case 0x28c: map_key_clear(KEY_SEND); break; | 682 | case 0x28c: map_key_clear(KEY_SEND); break; |
697 | 683 | ||
698 | /* Reported on a Cherry Cymotion keyboard */ | ||
699 | case 0x301: map_key_clear(KEY_PROG1); break; | ||
700 | case 0x302: map_key_clear(KEY_PROG2); break; | ||
701 | case 0x303: map_key_clear(KEY_PROG3); break; | ||
702 | |||
703 | /* Reported on certain Logitech wireless keyboards */ | ||
704 | case 0x1001: map_key_clear(KEY_MESSENGER); break; | ||
705 | case 0x1003: map_key_clear(KEY_SOUND); break; | ||
706 | case 0x1004: map_key_clear(KEY_VIDEO); break; | ||
707 | case 0x1005: map_key_clear(KEY_AUDIO); break; | ||
708 | case 0x100a: map_key_clear(KEY_DOCUMENTS); break; | ||
709 | case 0x1011: map_key_clear(KEY_PREVIOUSSONG); break; | ||
710 | case 0x1012: map_key_clear(KEY_NEXTSONG); break; | ||
711 | case 0x1013: map_key_clear(KEY_CAMERA); break; | ||
712 | case 0x1014: map_key_clear(KEY_MESSENGER); break; | ||
713 | case 0x1015: map_key_clear(KEY_RECORD); break; | ||
714 | case 0x1016: map_key_clear(KEY_PLAYER); break; | ||
715 | case 0x1017: map_key_clear(KEY_EJECTCD); break; | ||
716 | case 0x1018: map_key_clear(KEY_MEDIA); break; | ||
717 | case 0x1019: map_key_clear(KEY_PROG1); break; | ||
718 | case 0x101a: map_key_clear(KEY_PROG2); break; | ||
719 | case 0x101b: map_key_clear(KEY_PROG3); break; | ||
720 | case 0x101f: map_key_clear(KEY_ZOOMIN); break; | ||
721 | case 0x1020: map_key_clear(KEY_ZOOMOUT); break; | ||
722 | case 0x1021: map_key_clear(KEY_ZOOMRESET); break; | ||
723 | case 0x1023: map_key_clear(KEY_CLOSE); break; | ||
724 | case 0x1027: map_key_clear(KEY_MENU); break; | ||
725 | /* this one is marked as 'Rotate' */ | ||
726 | case 0x1028: map_key_clear(KEY_ANGLE); break; | ||
727 | case 0x1029: map_key_clear(KEY_SHUFFLE); break; | ||
728 | case 0x102a: map_key_clear(KEY_BACK); break; | ||
729 | case 0x102b: map_key_clear(KEY_CYCLEWINDOWS); break; | ||
730 | case 0x1041: map_key_clear(KEY_BATTERY); break; | ||
731 | case 0x1042: map_key_clear(KEY_WORDPROCESSOR); break; | ||
732 | case 0x1043: map_key_clear(KEY_SPREADSHEET); break; | ||
733 | case 0x1044: map_key_clear(KEY_PRESENTATION); break; | ||
734 | case 0x1045: map_key_clear(KEY_UNDO); break; | ||
735 | case 0x1046: map_key_clear(KEY_REDO); break; | ||
736 | case 0x1047: map_key_clear(KEY_PRINT); break; | ||
737 | case 0x1048: map_key_clear(KEY_SAVE); break; | ||
738 | case 0x1049: map_key_clear(KEY_PROG1); break; | ||
739 | case 0x104a: map_key_clear(KEY_PROG2); break; | ||
740 | case 0x104b: map_key_clear(KEY_PROG3); break; | ||
741 | case 0x104c: map_key_clear(KEY_PROG4); break; | ||
742 | |||
743 | default: goto ignore; | 684 | default: goto ignore; |
744 | } | 685 | } |
745 | break; | 686 | break; |
@@ -766,65 +707,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
766 | 707 | ||
767 | case HID_UP_MSVENDOR: | 708 | case HID_UP_MSVENDOR: |
768 | 709 | ||
769 | /* Unfortunately, there are multiple devices which | 710 | goto ignore; |
770 | * emit usages from MSVENDOR page that require different | ||
771 | * handling. If this list grows too much in the future, | ||
772 | * more general handling will have to be introduced here | ||
773 | * (i.e. another blacklist). | ||
774 | */ | ||
775 | |||
776 | /* Chicony Chicony KU-0418 tactical pad */ | ||
777 | if (IS_CHICONY_TACTICAL_PAD(device)) { | ||
778 | set_bit(EV_REP, input->evbit); | ||
779 | switch(usage->hid & HID_USAGE) { | ||
780 | case 0xff01: map_key_clear(BTN_1); break; | ||
781 | case 0xff02: map_key_clear(BTN_2); break; | ||
782 | case 0xff03: map_key_clear(BTN_3); break; | ||
783 | case 0xff04: map_key_clear(BTN_4); break; | ||
784 | case 0xff05: map_key_clear(BTN_5); break; | ||
785 | case 0xff06: map_key_clear(BTN_6); break; | ||
786 | case 0xff07: map_key_clear(BTN_7); break; | ||
787 | case 0xff08: map_key_clear(BTN_8); break; | ||
788 | case 0xff09: map_key_clear(BTN_9); break; | ||
789 | case 0xff0a: map_key_clear(BTN_A); break; | ||
790 | case 0xff0b: map_key_clear(BTN_B); break; | ||
791 | default: goto ignore; | ||
792 | } | ||
793 | |||
794 | /* Microsoft Natural Ergonomic Keyboard 4000 */ | ||
795 | } else if (IS_MS_KB(device)) { | ||
796 | switch(usage->hid & HID_USAGE) { | ||
797 | case 0xfd06: | ||
798 | map_key_clear(KEY_CHAT); | ||
799 | break; | ||
800 | case 0xfd07: | ||
801 | map_key_clear(KEY_PHONE); | ||
802 | break; | ||
803 | case 0xff05: | ||
804 | set_bit(EV_REP, input->evbit); | ||
805 | map_key_clear(KEY_F13); | ||
806 | set_bit(KEY_F14, input->keybit); | ||
807 | set_bit(KEY_F15, input->keybit); | ||
808 | set_bit(KEY_F16, input->keybit); | ||
809 | set_bit(KEY_F17, input->keybit); | ||
810 | set_bit(KEY_F18, input->keybit); | ||
811 | default: goto ignore; | ||
812 | } | ||
813 | |||
814 | /* Microsoft Wireless Notebook Presenter Mouse 8000 */ | ||
815 | } else if (IS_MS_PRESENTER_8000(device)) { | ||
816 | set_bit(EV_REP, input->evbit); | ||
817 | switch(usage->hid & HID_USAGE) { | ||
818 | /* Useful mappings of bottom-side keys for presentations */ | ||
819 | case 0xfd08: map_key_clear(KEY_RIGHT); break; | ||
820 | case 0xfd09: map_key_clear(KEY_LEFT); break; | ||
821 | case 0xfd0b: map_key_clear(KEY_PAUSE); break; | ||
822 | case 0xfd0f: map_key_clear(KEY_F5); break; | ||
823 | default: goto ignore; | ||
824 | } | ||
825 | } else | ||
826 | goto ignore; | ||
827 | break; | ||
828 | 711 | ||
829 | case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ | 712 | case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ |
830 | 713 | ||
@@ -841,38 +724,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
841 | break; | 724 | break; |
842 | 725 | ||
843 | case HID_UP_LOGIVENDOR: | 726 | case HID_UP_LOGIVENDOR: |
844 | set_bit(EV_REP, input->evbit); | ||
845 | switch(usage->hid & HID_USAGE) { | ||
846 | /* Reported on Logitech Ultra X Media Remote */ | ||
847 | case 0x004: map_key_clear(KEY_AGAIN); break; | ||
848 | case 0x00d: map_key_clear(KEY_HOME); break; | ||
849 | case 0x024: map_key_clear(KEY_SHUFFLE); break; | ||
850 | case 0x025: map_key_clear(KEY_TV); break; | ||
851 | case 0x026: map_key_clear(KEY_MENU); break; | ||
852 | case 0x031: map_key_clear(KEY_AUDIO); break; | ||
853 | case 0x032: map_key_clear(KEY_TEXT); break; | ||
854 | case 0x033: map_key_clear(KEY_LAST); break; | ||
855 | case 0x047: map_key_clear(KEY_MP3); break; | ||
856 | case 0x048: map_key_clear(KEY_DVD); break; | ||
857 | case 0x049: map_key_clear(KEY_MEDIA); break; | ||
858 | case 0x04a: map_key_clear(KEY_VIDEO); break; | ||
859 | case 0x04b: map_key_clear(KEY_ANGLE); break; | ||
860 | case 0x04c: map_key_clear(KEY_LANGUAGE); break; | ||
861 | case 0x04d: map_key_clear(KEY_SUBTITLE); break; | ||
862 | case 0x051: map_key_clear(KEY_RED); break; | ||
863 | case 0x052: map_key_clear(KEY_CLOSE); break; | ||
864 | |||
865 | /* Reported on Petalynx Maxter remote */ | ||
866 | case 0x05a: map_key_clear(KEY_TEXT); break; | ||
867 | case 0x05b: map_key_clear(KEY_RED); break; | ||
868 | case 0x05c: map_key_clear(KEY_GREEN); break; | ||
869 | case 0x05d: map_key_clear(KEY_YELLOW); break; | ||
870 | case 0x05e: map_key_clear(KEY_BLUE); break; | ||
871 | |||
872 | default: goto ignore; | ||
873 | } | ||
874 | break; | ||
875 | 727 | ||
728 | goto ignore; | ||
729 | |||
876 | case HID_UP_PID: | 730 | case HID_UP_PID: |
877 | 731 | ||
878 | switch(usage->hid & HID_USAGE) { | 732 | switch(usage->hid & HID_USAGE) { |
@@ -899,6 +753,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
899 | break; | 753 | break; |
900 | } | 754 | } |
901 | 755 | ||
756 | mapped: | ||
902 | if (device->quirks & HID_QUIRK_MIGHTYMOUSE) { | 757 | if (device->quirks & HID_QUIRK_MIGHTYMOUSE) { |
903 | if (usage->hid == HID_GD_Z) | 758 | if (usage->hid == HID_GD_Z) |
904 | map_rel(REL_HWHEEL); | 759 | map_rel(REL_HWHEEL); |