diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
commit | f43dc23d5ea91fca257be02138a255f02d98e806 (patch) | |
tree | b29722f6e965316e90ac97abf79923ced250dc21 /include/linux/input.h | |
parent | f8e53553f452dcbf67cb89c8cba63a1cd6eb4cc0 (diff) | |
parent | 4162cf64973df51fc885825bc9ca4d055891c49f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into common/serial-rework
Conflicts:
arch/sh/kernel/cpu/sh2/setup-sh7619.c
arch/sh/kernel/cpu/sh2a/setup-mxg.c
arch/sh/kernel/cpu/sh2a/setup-sh7201.c
arch/sh/kernel/cpu/sh2a/setup-sh7203.c
arch/sh/kernel/cpu/sh2a/setup-sh7206.c
arch/sh/kernel/cpu/sh3/setup-sh7705.c
arch/sh/kernel/cpu/sh3/setup-sh770x.c
arch/sh/kernel/cpu/sh3/setup-sh7710.c
arch/sh/kernel/cpu/sh3/setup-sh7720.c
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
arch/sh/kernel/cpu/sh4/setup-sh7760.c
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-shx3.c
arch/sh/kernel/cpu/sh5/setup-sh5.c
drivers/serial/sh-sci.c
drivers/serial/sh-sci.h
include/linux/serial_sci.h
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 291 |
1 files changed, 247 insertions, 44 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index 8b3bc3e0d146..c4e9d91ec979 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -34,7 +34,7 @@ struct input_event { | |||
34 | * Protocol version. | 34 | * Protocol version. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #define EV_VERSION 0x010000 | 37 | #define EV_VERSION 0x010001 |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * IOCTLs (0x00 - 0x7f) | 40 | * IOCTLs (0x00 - 0x7f) |
@@ -47,6 +47,25 @@ struct input_id { | |||
47 | __u16 version; | 47 | __u16 version; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | /** | ||
51 | * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls | ||
52 | * @value: latest reported value for the axis. | ||
53 | * @minimum: specifies minimum value for the axis. | ||
54 | * @maximum: specifies maximum value for the axis. | ||
55 | * @fuzz: specifies fuzz value that is used to filter noise from | ||
56 | * the event stream. | ||
57 | * @flat: values that are within this value will be discarded by | ||
58 | * joydev interface and reported as 0 instead. | ||
59 | * @resolution: specifies resolution for the values reported for | ||
60 | * the axis. | ||
61 | * | ||
62 | * Note that input core does not clamp reported values to the | ||
63 | * [minimum, maximum] limits, such task is left to userspace. | ||
64 | * | ||
65 | * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in | ||
66 | * units per millimeter (units/mm), resolution for rotational axes | ||
67 | * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian. | ||
68 | */ | ||
50 | struct input_absinfo { | 69 | struct input_absinfo { |
51 | __s32 value; | 70 | __s32 value; |
52 | __s32 minimum; | 71 | __s32 minimum; |
@@ -56,25 +75,53 @@ struct input_absinfo { | |||
56 | __s32 resolution; | 75 | __s32 resolution; |
57 | }; | 76 | }; |
58 | 77 | ||
78 | /** | ||
79 | * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls | ||
80 | * @scancode: scancode represented in machine-endian form. | ||
81 | * @len: length of the scancode that resides in @scancode buffer. | ||
82 | * @index: index in the keymap, may be used instead of scancode | ||
83 | * @flags: allows to specify how kernel should handle the request. For | ||
84 | * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel | ||
85 | * should perform lookup in keymap by @index instead of @scancode | ||
86 | * @keycode: key code assigned to this scancode | ||
87 | * | ||
88 | * The structure is used to retrieve and modify keymap data. Users have | ||
89 | * option of performing lookup either by @scancode itself or by @index | ||
90 | * in keymap entry. EVIOCGKEYCODE will also return scancode or index | ||
91 | * (depending on which element was used to perform lookup). | ||
92 | */ | ||
93 | struct input_keymap_entry { | ||
94 | #define INPUT_KEYMAP_BY_INDEX (1 << 0) | ||
95 | __u8 flags; | ||
96 | __u8 len; | ||
97 | __u16 index; | ||
98 | __u32 keycode; | ||
99 | __u8 scancode[32]; | ||
100 | }; | ||
101 | |||
59 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ | 102 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ |
60 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ | 103 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ |
61 | #define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ | 104 | #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ |
62 | #define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ | 105 | #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ |
63 | #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ | 106 | |
64 | #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ | 107 | #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */ |
108 | #define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry) | ||
109 | #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */ | ||
110 | #define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry) | ||
65 | 111 | ||
66 | #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ | 112 | #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ |
67 | #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ | 113 | #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ |
68 | #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ | 114 | #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ |
115 | #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ | ||
69 | 116 | ||
70 | #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */ | 117 | #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ |
71 | #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ | 118 | #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ |
72 | #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ | 119 | #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ |
73 | #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ | 120 | #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ |
74 | 121 | ||
75 | #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ | 122 | #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ |
76 | #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ | 123 | #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ |
77 | #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */ | 124 | #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */ |
78 | 125 | ||
79 | #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ | 126 | #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ |
80 | #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ | 127 | #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ |
@@ -83,6 +130,18 @@ struct input_absinfo { | |||
83 | #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ | 130 | #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ |
84 | 131 | ||
85 | /* | 132 | /* |
133 | * Device properties and quirks | ||
134 | */ | ||
135 | |||
136 | #define INPUT_PROP_POINTER 0x00 /* needs a pointer */ | ||
137 | #define INPUT_PROP_DIRECT 0x01 /* direct input devices */ | ||
138 | #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ | ||
139 | #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ | ||
140 | |||
141 | #define INPUT_PROP_MAX 0x1f | ||
142 | #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) | ||
143 | |||
144 | /* | ||
86 | * Event types | 145 | * Event types |
87 | */ | 146 | */ |
88 | 147 | ||
@@ -376,8 +435,9 @@ struct input_absinfo { | |||
376 | #define KEY_DISPLAY_OFF 245 /* display device to off state */ | 435 | #define KEY_DISPLAY_OFF 245 /* display device to off state */ |
377 | 436 | ||
378 | #define KEY_WIMAX 246 | 437 | #define KEY_WIMAX 246 |
438 | #define KEY_RFKILL 247 /* Key that controls all radios */ | ||
379 | 439 | ||
380 | /* Range 248 - 255 is reserved for special needs of AT keyboard driver */ | 440 | /* Code 255 is reserved for special needs of AT keyboard driver */ |
381 | 441 | ||
382 | #define BTN_MISC 0x100 | 442 | #define BTN_MISC 0x100 |
383 | #define BTN_0 0x100 | 443 | #define BTN_0 0x100 |
@@ -543,6 +603,8 @@ struct input_absinfo { | |||
543 | #define KEY_FRAMEFORWARD 0x1b5 | 603 | #define KEY_FRAMEFORWARD 0x1b5 |
544 | #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ | 604 | #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ |
545 | #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ | 605 | #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ |
606 | #define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ | ||
607 | #define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ | ||
546 | 608 | ||
547 | #define KEY_DEL_EOL 0x1c0 | 609 | #define KEY_DEL_EOL 0x1c0 |
548 | #define KEY_DEL_EOS 0x1c1 | 610 | #define KEY_DEL_EOS 0x1c1 |
@@ -595,6 +657,55 @@ struct input_absinfo { | |||
595 | #define KEY_NUMERIC_STAR 0x20a | 657 | #define KEY_NUMERIC_STAR 0x20a |
596 | #define KEY_NUMERIC_POUND 0x20b | 658 | #define KEY_NUMERIC_POUND 0x20b |
597 | 659 | ||
660 | #define KEY_CAMERA_FOCUS 0x210 | ||
661 | #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ | ||
662 | |||
663 | #define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */ | ||
664 | #define KEY_TOUCHPAD_ON 0x213 | ||
665 | #define KEY_TOUCHPAD_OFF 0x214 | ||
666 | |||
667 | #define BTN_TRIGGER_HAPPY 0x2c0 | ||
668 | #define BTN_TRIGGER_HAPPY1 0x2c0 | ||
669 | #define BTN_TRIGGER_HAPPY2 0x2c1 | ||
670 | #define BTN_TRIGGER_HAPPY3 0x2c2 | ||
671 | #define BTN_TRIGGER_HAPPY4 0x2c3 | ||
672 | #define BTN_TRIGGER_HAPPY5 0x2c4 | ||
673 | #define BTN_TRIGGER_HAPPY6 0x2c5 | ||
674 | #define BTN_TRIGGER_HAPPY7 0x2c6 | ||
675 | #define BTN_TRIGGER_HAPPY8 0x2c7 | ||
676 | #define BTN_TRIGGER_HAPPY9 0x2c8 | ||
677 | #define BTN_TRIGGER_HAPPY10 0x2c9 | ||
678 | #define BTN_TRIGGER_HAPPY11 0x2ca | ||
679 | #define BTN_TRIGGER_HAPPY12 0x2cb | ||
680 | #define BTN_TRIGGER_HAPPY13 0x2cc | ||
681 | #define BTN_TRIGGER_HAPPY14 0x2cd | ||
682 | #define BTN_TRIGGER_HAPPY15 0x2ce | ||
683 | #define BTN_TRIGGER_HAPPY16 0x2cf | ||
684 | #define BTN_TRIGGER_HAPPY17 0x2d0 | ||
685 | #define BTN_TRIGGER_HAPPY18 0x2d1 | ||
686 | #define BTN_TRIGGER_HAPPY19 0x2d2 | ||
687 | #define BTN_TRIGGER_HAPPY20 0x2d3 | ||
688 | #define BTN_TRIGGER_HAPPY21 0x2d4 | ||
689 | #define BTN_TRIGGER_HAPPY22 0x2d5 | ||
690 | #define BTN_TRIGGER_HAPPY23 0x2d6 | ||
691 | #define BTN_TRIGGER_HAPPY24 0x2d7 | ||
692 | #define BTN_TRIGGER_HAPPY25 0x2d8 | ||
693 | #define BTN_TRIGGER_HAPPY26 0x2d9 | ||
694 | #define BTN_TRIGGER_HAPPY27 0x2da | ||
695 | #define BTN_TRIGGER_HAPPY28 0x2db | ||
696 | #define BTN_TRIGGER_HAPPY29 0x2dc | ||
697 | #define BTN_TRIGGER_HAPPY30 0x2dd | ||
698 | #define BTN_TRIGGER_HAPPY31 0x2de | ||
699 | #define BTN_TRIGGER_HAPPY32 0x2df | ||
700 | #define BTN_TRIGGER_HAPPY33 0x2e0 | ||
701 | #define BTN_TRIGGER_HAPPY34 0x2e1 | ||
702 | #define BTN_TRIGGER_HAPPY35 0x2e2 | ||
703 | #define BTN_TRIGGER_HAPPY36 0x2e3 | ||
704 | #define BTN_TRIGGER_HAPPY37 0x2e4 | ||
705 | #define BTN_TRIGGER_HAPPY38 0x2e5 | ||
706 | #define BTN_TRIGGER_HAPPY39 0x2e6 | ||
707 | #define BTN_TRIGGER_HAPPY40 0x2e7 | ||
708 | |||
598 | /* We avoid low common keys in module aliases so they don't get huge. */ | 709 | /* We avoid low common keys in module aliases so they don't get huge. */ |
599 | #define KEY_MIN_INTERESTING KEY_MUTE | 710 | #define KEY_MIN_INTERESTING KEY_MUTE |
600 | #define KEY_MAX 0x2ff | 711 | #define KEY_MAX 0x2ff |
@@ -645,9 +756,12 @@ struct input_absinfo { | |||
645 | #define ABS_TILT_X 0x1a | 756 | #define ABS_TILT_X 0x1a |
646 | #define ABS_TILT_Y 0x1b | 757 | #define ABS_TILT_Y 0x1b |
647 | #define ABS_TOOL_WIDTH 0x1c | 758 | #define ABS_TOOL_WIDTH 0x1c |
759 | |||
648 | #define ABS_VOLUME 0x20 | 760 | #define ABS_VOLUME 0x20 |
761 | |||
649 | #define ABS_MISC 0x28 | 762 | #define ABS_MISC 0x28 |
650 | 763 | ||
764 | #define ABS_MT_SLOT 0x2f /* MT slot being modified */ | ||
651 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | 765 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ |
652 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | 766 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ |
653 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | 767 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ |
@@ -658,6 +772,14 @@ struct input_absinfo { | |||
658 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ | 772 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ |
659 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ | 773 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ |
660 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 774 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ |
775 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | ||
776 | #define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ | ||
777 | |||
778 | #ifdef __KERNEL__ | ||
779 | /* Implementation details, userspace should not care about these */ | ||
780 | #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR | ||
781 | #define ABS_MT_LAST ABS_MT_DISTANCE | ||
782 | #endif | ||
661 | 783 | ||
662 | #define ABS_MAX 0x3f | 784 | #define ABS_MAX 0x3f |
663 | #define ABS_CNT (ABS_MAX+1) | 785 | #define ABS_CNT (ABS_MAX+1) |
@@ -677,6 +799,9 @@ struct input_absinfo { | |||
677 | #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ | 799 | #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ |
678 | #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ | 800 | #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ |
679 | #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ | 801 | #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ |
802 | #define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ | ||
803 | #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ | ||
804 | #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ | ||
680 | #define SW_MAX 0x0f | 805 | #define SW_MAX 0x0f |
681 | #define SW_CNT (SW_MAX+1) | 806 | #define SW_CNT (SW_MAX+1) |
682 | 807 | ||
@@ -717,6 +842,7 @@ struct input_absinfo { | |||
717 | #define REP_DELAY 0x00 | 842 | #define REP_DELAY 0x00 |
718 | #define REP_PERIOD 0x01 | 843 | #define REP_PERIOD 0x01 |
719 | #define REP_MAX 0x01 | 844 | #define REP_MAX 0x01 |
845 | #define REP_CNT (REP_MAX+1) | ||
720 | 846 | ||
721 | /* | 847 | /* |
722 | * Sounds | 848 | * Sounds |
@@ -756,12 +882,14 @@ struct input_absinfo { | |||
756 | #define BUS_HOST 0x19 | 882 | #define BUS_HOST 0x19 |
757 | #define BUS_GSC 0x1A | 883 | #define BUS_GSC 0x1A |
758 | #define BUS_ATARI 0x1B | 884 | #define BUS_ATARI 0x1B |
885 | #define BUS_SPI 0x1C | ||
759 | 886 | ||
760 | /* | 887 | /* |
761 | * MT_TOOL types | 888 | * MT_TOOL types |
762 | */ | 889 | */ |
763 | #define MT_TOOL_FINGER 0 | 890 | #define MT_TOOL_FINGER 0 |
764 | #define MT_TOOL_PEN 1 | 891 | #define MT_TOOL_PEN 1 |
892 | #define MT_TOOL_MAX 1 | ||
765 | 893 | ||
766 | /* | 894 | /* |
767 | * Values describing the status of a force-feedback effect | 895 | * Values describing the status of a force-feedback effect |
@@ -890,7 +1018,7 @@ struct ff_periodic_effect { | |||
890 | struct ff_envelope envelope; | 1018 | struct ff_envelope envelope; |
891 | 1019 | ||
892 | __u32 custom_len; | 1020 | __u32 custom_len; |
893 | __s16 *custom_data; | 1021 | __s16 __user *custom_data; |
894 | }; | 1022 | }; |
895 | 1023 | ||
896 | /** | 1024 | /** |
@@ -1002,6 +1130,7 @@ struct ff_effect { | |||
1002 | * @phys: physical path to the device in the system hierarchy | 1130 | * @phys: physical path to the device in the system hierarchy |
1003 | * @uniq: unique identification code for the device (if device has it) | 1131 | * @uniq: unique identification code for the device (if device has it) |
1004 | * @id: id of the device (struct input_id) | 1132 | * @id: id of the device (struct input_id) |
1133 | * @propbit: bitmap of device properties and quirks | ||
1005 | * @evbit: bitmap of types of events supported by the device (EV_KEY, | 1134 | * @evbit: bitmap of types of events supported by the device (EV_KEY, |
1006 | * EV_REL, etc.) | 1135 | * EV_REL, etc.) |
1007 | * @keybit: bitmap of keys/buttons this device has | 1136 | * @keybit: bitmap of keys/buttons this device has |
@@ -1012,29 +1141,38 @@ struct ff_effect { | |||
1012 | * @sndbit: bitmap of sound effects supported by the device | 1141 | * @sndbit: bitmap of sound effects supported by the device |
1013 | * @ffbit: bitmap of force feedback effects supported by the device | 1142 | * @ffbit: bitmap of force feedback effects supported by the device |
1014 | * @swbit: bitmap of switches present on the device | 1143 | * @swbit: bitmap of switches present on the device |
1144 | * @hint_events_per_packet: average number of events generated by the | ||
1145 | * device in a packet (between EV_SYN/SYN_REPORT events). Used by | ||
1146 | * event handlers to estimate size of the buffer needed to hold | ||
1147 | * events. | ||
1015 | * @keycodemax: size of keycode table | 1148 | * @keycodemax: size of keycode table |
1016 | * @keycodesize: size of elements in keycode table | 1149 | * @keycodesize: size of elements in keycode table |
1017 | * @keycode: map of scancodes to keycodes for this device | 1150 | * @keycode: map of scancodes to keycodes for this device |
1151 | * @getkeycode: optional legacy method to retrieve current keymap. | ||
1018 | * @setkeycode: optional method to alter current keymap, used to implement | 1152 | * @setkeycode: optional method to alter current keymap, used to implement |
1019 | * sparse keymaps. If not supplied default mechanism will be used | 1153 | * sparse keymaps. If not supplied default mechanism will be used. |
1020 | * @getkeycode: optional method to retrieve current keymap. If not supplied | 1154 | * The method is being called while holding event_lock and thus must |
1021 | * default mechanism will be used | 1155 | * not sleep |
1156 | * @getkeycode_new: transition method | ||
1157 | * @setkeycode_new: transition method | ||
1022 | * @ff: force feedback structure associated with the device if device | 1158 | * @ff: force feedback structure associated with the device if device |
1023 | * supports force feedback effects | 1159 | * supports force feedback effects |
1024 | * @repeat_key: stores key code of the last key pressed; used to implement | 1160 | * @repeat_key: stores key code of the last key pressed; used to implement |
1025 | * software autorepeat | 1161 | * software autorepeat |
1026 | * @timer: timer for software autorepeat | 1162 | * @timer: timer for software autorepeat |
1027 | * @sync: set to 1 when there were no new events since last EV_SYNC | ||
1028 | * @abs: current values for reports from absolute axes | ||
1029 | * @rep: current values for autorepeat parameters (delay, rate) | 1163 | * @rep: current values for autorepeat parameters (delay, rate) |
1164 | * @mt: pointer to array of struct input_mt_slot holding current values | ||
1165 | * of tracked contacts | ||
1166 | * @mtsize: number of MT slots the device uses | ||
1167 | * @slot: MT slot currently being transmitted | ||
1168 | * @trkid: stores MT tracking ID for the current contact | ||
1169 | * @absinfo: array of &struct input_absinfo elements holding information | ||
1170 | * about absolute axes (current value, min, max, flat, fuzz, | ||
1171 | * resolution) | ||
1030 | * @key: reflects current state of device's keys/buttons | 1172 | * @key: reflects current state of device's keys/buttons |
1031 | * @led: reflects current state of device's LEDs | 1173 | * @led: reflects current state of device's LEDs |
1032 | * @snd: reflects current state of sound effects | 1174 | * @snd: reflects current state of sound effects |
1033 | * @sw: reflects current state of device's switches | 1175 | * @sw: reflects current state of device's switches |
1034 | * @absmax: maximum values for events coming from absolute axes | ||
1035 | * @absmin: minimum values for events coming from absolute axes | ||
1036 | * @absfuzz: describes noisiness for axes | ||
1037 | * @absflat: size of the center flat position (used by joydev) | ||
1038 | * @open: this method is called when the very first user calls | 1176 | * @open: this method is called when the very first user calls |
1039 | * input_open_device(). The driver must prepare the device | 1177 | * input_open_device(). The driver must prepare the device |
1040 | * to start generating events (start polling thread, | 1178 | * to start generating events (start polling thread, |
@@ -1064,6 +1202,7 @@ struct ff_effect { | |||
1064 | * last user closes the device | 1202 | * last user closes the device |
1065 | * @going_away: marks devices that are in a middle of unregistering and | 1203 | * @going_away: marks devices that are in a middle of unregistering and |
1066 | * causes input_open_device*() fail with -ENODEV. | 1204 | * causes input_open_device*() fail with -ENODEV. |
1205 | * @sync: set to %true when there were no new events since last EV_SYN | ||
1067 | * @dev: driver model's view of this device | 1206 | * @dev: driver model's view of this device |
1068 | * @h_list: list of input handles associated with the device. When | 1207 | * @h_list: list of input handles associated with the device. When |
1069 | * accessing the list dev->mutex must be held | 1208 | * accessing the list dev->mutex must be held |
@@ -1075,6 +1214,8 @@ struct input_dev { | |||
1075 | const char *uniq; | 1214 | const char *uniq; |
1076 | struct input_id id; | 1215 | struct input_id id; |
1077 | 1216 | ||
1217 | unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]; | ||
1218 | |||
1078 | unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; | 1219 | unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; |
1079 | unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; | 1220 | unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; |
1080 | unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; | 1221 | unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; |
@@ -1085,45 +1226,55 @@ struct input_dev { | |||
1085 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; | 1226 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; |
1086 | unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; | 1227 | unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; |
1087 | 1228 | ||
1229 | unsigned int hint_events_per_packet; | ||
1230 | |||
1088 | unsigned int keycodemax; | 1231 | unsigned int keycodemax; |
1089 | unsigned int keycodesize; | 1232 | unsigned int keycodesize; |
1090 | void *keycode; | 1233 | void *keycode; |
1091 | int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); | 1234 | |
1092 | int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); | 1235 | int (*setkeycode)(struct input_dev *dev, |
1236 | unsigned int scancode, unsigned int keycode); | ||
1237 | int (*getkeycode)(struct input_dev *dev, | ||
1238 | unsigned int scancode, unsigned int *keycode); | ||
1239 | int (*setkeycode_new)(struct input_dev *dev, | ||
1240 | const struct input_keymap_entry *ke, | ||
1241 | unsigned int *old_keycode); | ||
1242 | int (*getkeycode_new)(struct input_dev *dev, | ||
1243 | struct input_keymap_entry *ke); | ||
1093 | 1244 | ||
1094 | struct ff_device *ff; | 1245 | struct ff_device *ff; |
1095 | 1246 | ||
1096 | unsigned int repeat_key; | 1247 | unsigned int repeat_key; |
1097 | struct timer_list timer; | 1248 | struct timer_list timer; |
1098 | 1249 | ||
1099 | int sync; | 1250 | int rep[REP_CNT]; |
1100 | 1251 | ||
1101 | int abs[ABS_MAX + 1]; | 1252 | struct input_mt_slot *mt; |
1102 | int rep[REP_MAX + 1]; | 1253 | int mtsize; |
1254 | int slot; | ||
1255 | int trkid; | ||
1256 | |||
1257 | struct input_absinfo *absinfo; | ||
1103 | 1258 | ||
1104 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; | 1259 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; |
1105 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; | 1260 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; |
1106 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; | 1261 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; |
1107 | unsigned long sw[BITS_TO_LONGS(SW_CNT)]; | 1262 | unsigned long sw[BITS_TO_LONGS(SW_CNT)]; |
1108 | 1263 | ||
1109 | int absmax[ABS_MAX + 1]; | ||
1110 | int absmin[ABS_MAX + 1]; | ||
1111 | int absfuzz[ABS_MAX + 1]; | ||
1112 | int absflat[ABS_MAX + 1]; | ||
1113 | int absres[ABS_MAX + 1]; | ||
1114 | |||
1115 | int (*open)(struct input_dev *dev); | 1264 | int (*open)(struct input_dev *dev); |
1116 | void (*close)(struct input_dev *dev); | 1265 | void (*close)(struct input_dev *dev); |
1117 | int (*flush)(struct input_dev *dev, struct file *file); | 1266 | int (*flush)(struct input_dev *dev, struct file *file); |
1118 | int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); | 1267 | int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
1119 | 1268 | ||
1120 | struct input_handle *grab; | 1269 | struct input_handle __rcu *grab; |
1121 | 1270 | ||
1122 | spinlock_t event_lock; | 1271 | spinlock_t event_lock; |
1123 | struct mutex mutex; | 1272 | struct mutex mutex; |
1124 | 1273 | ||
1125 | unsigned int users; | 1274 | unsigned int users; |
1126 | int going_away; | 1275 | bool going_away; |
1276 | |||
1277 | bool sync; | ||
1127 | 1278 | ||
1128 | struct device dev; | 1279 | struct device dev; |
1129 | 1280 | ||
@@ -1189,6 +1340,10 @@ struct input_handle; | |||
1189 | * @event: event handler. This method is being called by input core with | 1340 | * @event: event handler. This method is being called by input core with |
1190 | * interrupts disabled and dev->event_lock spinlock held and so | 1341 | * interrupts disabled and dev->event_lock spinlock held and so |
1191 | * it may not sleep | 1342 | * it may not sleep |
1343 | * @filter: similar to @event; separates normal event handlers from | ||
1344 | * "filters". | ||
1345 | * @match: called after comparing device's id with handler's id_table | ||
1346 | * to perform fine-grained matching between device and handler | ||
1192 | * @connect: called when attaching a handler to an input device | 1347 | * @connect: called when attaching a handler to an input device |
1193 | * @disconnect: disconnects a handler from input device | 1348 | * @disconnect: disconnects a handler from input device |
1194 | * @start: starts handler for given handle. This function is called by | 1349 | * @start: starts handler for given handle. This function is called by |
@@ -1200,8 +1355,6 @@ struct input_handle; | |||
1200 | * @name: name of the handler, to be shown in /proc/bus/input/handlers | 1355 | * @name: name of the handler, to be shown in /proc/bus/input/handlers |
1201 | * @id_table: pointer to a table of input_device_ids this driver can | 1356 | * @id_table: pointer to a table of input_device_ids this driver can |
1202 | * handle | 1357 | * handle |
1203 | * @blacklist: pointer to a table of input_device_ids this driver should | ||
1204 | * ignore even if they match @id_table | ||
1205 | * @h_list: list of input handles associated with the handler | 1358 | * @h_list: list of input handles associated with the handler |
1206 | * @node: for placing the driver onto input_handler_list | 1359 | * @node: for placing the driver onto input_handler_list |
1207 | * | 1360 | * |
@@ -1210,6 +1363,11 @@ struct input_handle; | |||
1210 | * same time. All of them will get their copy of input event generated by | 1363 | * same time. All of them will get their copy of input event generated by |
1211 | * the device. | 1364 | * the device. |
1212 | * | 1365 | * |
1366 | * The very same structure is used to implement input filters. Input core | ||
1367 | * allows filters to run first and will not pass event to regular handlers | ||
1368 | * if any of the filters indicate that the event should be filtered (by | ||
1369 | * returning %true from their filter() method). | ||
1370 | * | ||
1213 | * Note that input core serializes calls to connect() and disconnect() | 1371 | * Note that input core serializes calls to connect() and disconnect() |
1214 | * methods. | 1372 | * methods. |
1215 | */ | 1373 | */ |
@@ -1218,6 +1376,8 @@ struct input_handler { | |||
1218 | void *private; | 1376 | void *private; |
1219 | 1377 | ||
1220 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 1378 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
1379 | bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | ||
1380 | bool (*match)(struct input_handler *handler, struct input_dev *dev); | ||
1221 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); | 1381 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); |
1222 | void (*disconnect)(struct input_handle *handle); | 1382 | void (*disconnect)(struct input_handle *handle); |
1223 | void (*start)(struct input_handle *handle); | 1383 | void (*start)(struct input_handle *handle); |
@@ -1227,7 +1387,6 @@ struct input_handler { | |||
1227 | const char *name; | 1387 | const char *name; |
1228 | 1388 | ||
1229 | const struct input_device_id *id_table; | 1389 | const struct input_device_id *id_table; |
1230 | const struct input_device_id *blacklist; | ||
1231 | 1390 | ||
1232 | struct list_head h_list; | 1391 | struct list_head h_list; |
1233 | struct list_head node; | 1392 | struct list_head node; |
@@ -1286,9 +1445,14 @@ static inline void input_set_drvdata(struct input_dev *dev, void *data) | |||
1286 | int __must_check input_register_device(struct input_dev *); | 1445 | int __must_check input_register_device(struct input_dev *); |
1287 | void input_unregister_device(struct input_dev *); | 1446 | void input_unregister_device(struct input_dev *); |
1288 | 1447 | ||
1448 | void input_reset_device(struct input_dev *); | ||
1449 | |||
1289 | int __must_check input_register_handler(struct input_handler *); | 1450 | int __must_check input_register_handler(struct input_handler *); |
1290 | void input_unregister_handler(struct input_handler *); | 1451 | void input_unregister_handler(struct input_handler *); |
1291 | 1452 | ||
1453 | int input_handler_for_each_handle(struct input_handler *, void *data, | ||
1454 | int (*fn)(struct input_handle *, void *)); | ||
1455 | |||
1292 | int input_register_handle(struct input_handle *); | 1456 | int input_register_handle(struct input_handle *); |
1293 | void input_unregister_handle(struct input_handle *); | 1457 | void input_unregister_handle(struct input_handle *); |
1294 | 1458 | ||
@@ -1298,7 +1462,7 @@ void input_release_device(struct input_handle *); | |||
1298 | int input_open_device(struct input_handle *); | 1462 | int input_open_device(struct input_handle *); |
1299 | void input_close_device(struct input_handle *); | 1463 | void input_close_device(struct input_handle *); |
1300 | 1464 | ||
1301 | int input_flush_device(struct input_handle* handle, struct file* file); | 1465 | int input_flush_device(struct input_handle *handle, struct file *file); |
1302 | 1466 | ||
1303 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); | 1467 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
1304 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 1468 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
@@ -1340,18 +1504,53 @@ static inline void input_mt_sync(struct input_dev *dev) | |||
1340 | 1504 | ||
1341 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); | 1505 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); |
1342 | 1506 | ||
1343 | static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) | 1507 | /** |
1508 | * input_set_events_per_packet - tell handlers about the driver event rate | ||
1509 | * @dev: the input device used by the driver | ||
1510 | * @n_events: the average number of events between calls to input_sync() | ||
1511 | * | ||
1512 | * If the event rate sent from a device is unusually large, use this | ||
1513 | * function to set the expected event rate. This will allow handlers | ||
1514 | * to set up an appropriate buffer size for the event stream, in order | ||
1515 | * to minimize information loss. | ||
1516 | */ | ||
1517 | static inline void input_set_events_per_packet(struct input_dev *dev, int n_events) | ||
1344 | { | 1518 | { |
1345 | dev->absmin[axis] = min; | 1519 | dev->hint_events_per_packet = n_events; |
1346 | dev->absmax[axis] = max; | 1520 | } |
1347 | dev->absfuzz[axis] = fuzz; | ||
1348 | dev->absflat[axis] = flat; | ||
1349 | 1521 | ||
1350 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); | 1522 | void input_alloc_absinfo(struct input_dev *dev); |
1523 | void input_set_abs_params(struct input_dev *dev, unsigned int axis, | ||
1524 | int min, int max, int fuzz, int flat); | ||
1525 | |||
1526 | #define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \ | ||
1527 | static inline int input_abs_get_##_suffix(struct input_dev *dev, \ | ||
1528 | unsigned int axis) \ | ||
1529 | { \ | ||
1530 | return dev->absinfo ? dev->absinfo[axis]._item : 0; \ | ||
1531 | } \ | ||
1532 | \ | ||
1533 | static inline void input_abs_set_##_suffix(struct input_dev *dev, \ | ||
1534 | unsigned int axis, int val) \ | ||
1535 | { \ | ||
1536 | input_alloc_absinfo(dev); \ | ||
1537 | if (dev->absinfo) \ | ||
1538 | dev->absinfo[axis]._item = val; \ | ||
1351 | } | 1539 | } |
1352 | 1540 | ||
1353 | int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); | 1541 | INPUT_GENERATE_ABS_ACCESSORS(val, value) |
1354 | int input_set_keycode(struct input_dev *dev, int scancode, int keycode); | 1542 | INPUT_GENERATE_ABS_ACCESSORS(min, minimum) |
1543 | INPUT_GENERATE_ABS_ACCESSORS(max, maximum) | ||
1544 | INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz) | ||
1545 | INPUT_GENERATE_ABS_ACCESSORS(flat, flat) | ||
1546 | INPUT_GENERATE_ABS_ACCESSORS(res, resolution) | ||
1547 | |||
1548 | int input_scancode_to_scalar(const struct input_keymap_entry *ke, | ||
1549 | unsigned int *scancode); | ||
1550 | |||
1551 | int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke); | ||
1552 | int input_set_keycode(struct input_dev *dev, | ||
1553 | const struct input_keymap_entry *ke); | ||
1355 | 1554 | ||
1356 | extern struct class input_class; | 1555 | extern struct class input_class; |
1357 | 1556 | ||
@@ -1377,6 +1576,10 @@ extern struct class input_class; | |||
1377 | * methods; erase() is optional. set_gain() and set_autocenter() need | 1576 | * methods; erase() is optional. set_gain() and set_autocenter() need |
1378 | * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER | 1577 | * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER |
1379 | * bits. | 1578 | * bits. |
1579 | * | ||
1580 | * Note that playback(), set_gain() and set_autocenter() are called with | ||
1581 | * dev->event_lock spinlock held and interrupts off and thus may not | ||
1582 | * sleep. | ||
1380 | */ | 1583 | */ |
1381 | struct ff_device { | 1584 | struct ff_device { |
1382 | int (*upload)(struct input_dev *dev, struct ff_effect *effect, | 1585 | int (*upload)(struct input_dev *dev, struct ff_effect *effect, |