aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-06 12:30:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-06 12:30:36 -0400
commit22e04f6b4b04a8afe9af9239224591d06ba3b24d (patch)
tree9bb72350400153ab232e227a378f94e95ad27569 /Documentation
parentec0ad730802173ec17e942f4b652a1819b1025b2 (diff)
parent4e5a494e4b4ba7e6aa1a8a285e98e3665fcb396e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina: "Highlights: - conversion of HID subsystem to use devm-based resource management, from Benjamin Tissoires - i2c-hid support for DT bindings, from Benjamin Tissoires - much improved support for Win8-multitouch devices, from Benjamin Tissoires - cleanup of core code using common hidinput_input_event(), from David Herrmann - fix for bug in implement() access to the bit stream (causing oops) that has been present in the code for ages, but devices that are able to trigger it have started to appear only now, from Jiri Kosina - fixes for CVE-2013-2899, CVE-2013-2898, CVE-2013-2896, CVE-2013-2892, CVE-2013-2888 (all triggerable only by specially crafted malicious HW devices plugged into the system), from Kees Cook - hidraw oops fix, from Manoj Chourasia - various smaller fixes here and there, support for a bunch of new devices by various contributors" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (53 commits) HID: MAINTAINERS: add roccat drivers HID: hid-sensor-hub: change kmalloc + memcpy by kmemdup HID: hid-sensor-hub: move to devm_kzalloc HID: hid-sensor-hub: fix indentation accross the code HID: move HID_REPORT_TYPES closer to the report-definitions HID: check for NULL field when setting values HID: picolcd_core: validate output report details HID: sensor-hub: validate feature report details HID: ntrig: validate feature report details HID: pantherlord: validate output report details HID: hid-wiimote: print small buffers via %*phC HID: uhid: improve uhid example client HID: Correct the USB IDs for the new Macbook Air 6 HID: wiimote: add support for Guitar-Hero guitars HID: wiimote: add support for Guitar-Hero drums Input: introduce BTN/ABS bits for drums and guitars HID: battery: don't do DMA from stack HID: roccat: add support for KonePureOptical v2 HID: picolcd: Prevent NULL pointer dereference on _remove() HID: usbhid: quirk for N-Trig DuoSense Touch Screen ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/devicetree/bindings/hid/hid-over-i2c.txt28
-rw-r--r--Documentation/hid/uhid.txt4
-rw-r--r--Documentation/input/gamepad.txt156
3 files changed, 187 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/hid/hid-over-i2c.txt b/Documentation/devicetree/bindings/hid/hid-over-i2c.txt
new file mode 100644
index 000000000000..488edcb264c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/hid/hid-over-i2c.txt
@@ -0,0 +1,28 @@
1* HID over I2C Device-Tree bindings
2
3HID over I2C provides support for various Human Interface Devices over the
4I2C bus. These devices can be for example touchpads, keyboards, touch screens
5or sensors.
6
7The specification has been written by Microsoft and is currently available here:
8http://msdn.microsoft.com/en-us/library/windows/hardware/hh852380.aspx
9
10If this binding is used, the kernel module i2c-hid will handle the communication
11with the device and the generic hid core layer will handle the protocol.
12
13Required properties:
14- compatible: must be "hid-over-i2c"
15- reg: i2c slave address
16- hid-descr-addr: HID descriptor address
17- interrupt-parent: the phandle for the interrupt controller
18- interrupts: interrupt line
19
20Example:
21
22 i2c-hid-dev@2c {
23 compatible = "hid-over-i2c";
24 reg = <0x2c>;
25 hid-descr-addr = <0x0020>;
26 interrupt-parent = <&gpx3>;
27 interrupts = <3 2>;
28 };
diff --git a/Documentation/hid/uhid.txt b/Documentation/hid/uhid.txt
index 3c741214dfbb..dc35a2b75eee 100644
--- a/Documentation/hid/uhid.txt
+++ b/Documentation/hid/uhid.txt
@@ -149,11 +149,13 @@ needs. Only UHID_OUTPUT and UHID_OUTPUT_EV have payloads.
149 is of type "struct uhid_data_req". 149 is of type "struct uhid_data_req".
150 This may be received even though you haven't received UHID_OPEN, yet. 150 This may be received even though you haven't received UHID_OPEN, yet.
151 151
152 UHID_OUTPUT_EV: 152 UHID_OUTPUT_EV (obsolete):
153 Same as UHID_OUTPUT but this contains a "struct input_event" as payload. This 153 Same as UHID_OUTPUT but this contains a "struct input_event" as payload. This
154 is called for force-feedback, LED or similar events which are received through 154 is called for force-feedback, LED or similar events which are received through
155 an input device by the HID subsystem. You should convert this into raw reports 155 an input device by the HID subsystem. You should convert this into raw reports
156 and send them to your device similar to events of type UHID_OUTPUT. 156 and send them to your device similar to events of type UHID_OUTPUT.
157 This is no longer sent by newer kernels. Instead, HID core converts it into a
158 raw output report and sends it via UHID_OUTPUT.
157 159
158 UHID_FEATURE: 160 UHID_FEATURE:
159 This event is sent if the kernel driver wants to perform a feature request as 161 This event is sent if the kernel driver wants to perform a feature request as
diff --git a/Documentation/input/gamepad.txt b/Documentation/input/gamepad.txt
new file mode 100644
index 000000000000..8002c894c6b0
--- /dev/null
+++ b/Documentation/input/gamepad.txt
@@ -0,0 +1,156 @@
1 Linux Gamepad API
2----------------------------------------------------------------------------
3
41. Intro
5~~~~~~~~
6Linux provides many different input drivers for gamepad hardware. To avoid
7having user-space deal with different button-mappings for each gamepad, this
8document defines how gamepads are supposed to report their data.
9
102. Geometry
11~~~~~~~~~~~
12As "gamepad" we define devices which roughly look like this:
13
14 ____________________________ __
15 / [__ZL__] [__ZR__] \ |
16 / [__ TL __] [__ TR __] \ | Front Triggers
17 __/________________________________\__ __|
18 / _ \ |
19 / /\ __ (N) \ |
20 / || __ |MO| __ _ _ \ | Main Pad
21 | <===DP===> |SE| |ST| (W) -|- (E) | |
22 \ || ___ ___ _ / |
23 /\ \/ / \ / \ (S) /\ __|
24 / \________ | LS | ____ | RS | ________/ \ |
25 | / \ \___/ / \ \___/ / \ | | Control Sticks
26 | / \_____/ \_____/ \ | __|
27 | / \ |
28 \_____/ \_____/
29
30 |________|______| |______|___________|
31 D-Pad Left Right Action Pad
32 Stick Stick
33
34 |_____________|
35 Menu Pad
36
37Most gamepads have the following features:
38 - Action-Pad
39 4 buttons in diamonds-shape (on the right side). The buttons are
40 differently labeled on most devices so we define them as NORTH,
41 SOUTH, WEST and EAST.
42 - D-Pad (Direction-pad)
43 4 buttons (on the left side) that point up, down, left and right.
44 - Menu-Pad
45 Different constellations, but most-times 2 buttons: SELECT - START
46 Furthermore, many gamepads have a fancy branded button that is used as
47 special system-button. It often looks different to the other buttons and
48 is used to pop up system-menus or system-settings.
49 - Analog-Sticks
50 Analog-sticks provide freely moveable sticks to control directions. Not
51 all devices have both or any, but they are present at most times.
52 Analog-sticks may also provide a digital button if you press them.
53 - Triggers
54 Triggers are located on the upper-side of the pad in vertical direction.
55 Not all devices provide them, but the upper buttons are normally named
56 Left- and Right-Triggers, the lower buttons Z-Left and Z-Right.
57 - Rumble
58 Many devices provide force-feedback features. But are mostly just
59 simple rumble motors.
60
613. Detection
62~~~~~~~~~~~~
63All gamepads that follow the protocol described here map BTN_GAMEPAD. This is
64an alias for BTN_SOUTH/BTN_A. It can be used to identify a gamepad as such.
65However, not all gamepads provide all features, so you need to test for all
66features that you need, first. How each feature is mapped is described below.
67
68Legacy drivers often don't comply to these rules. As we cannot change them
69for backwards-compatibility reasons, you need to provide fixup mappings in
70user-space yourself. Some of them might also provide module-options that
71change the mappings so you can adivce users to set these.
72
73All new gamepads are supposed to comply with this mapping. Please report any
74bugs, if they don't.
75
76There are a lot of less-featured/less-powerful devices out there, which re-use
77the buttons from this protocol. However, they try to do this in a compatible
78fashion. For example, the "Nintendo Wii Nunchuk" provides two trigger buttons
79and one analog stick. It reports them as if it were a gamepad with only one
80analog stick and two trigger buttons on the right side.
81But that means, that if you only support "real" gamepads, you must test
82devices for _all_ reported events that you need. Otherwise, you will also get
83devices that report a small subset of the events.
84
85No other devices, that do not look/feel like a gamepad, shall report these
86events.
87
884. Events
89~~~~~~~~~
90Gamepads report the following events:
91
92Action-Pad:
93 Every gamepad device has at least 2 action buttons. This means, that every
94 device reports BTN_SOUTH (which BTN_GAMEPAD is an alias for). Regardless
95 of the labels on the buttons, the codes are sent according to the
96 physical position of the buttons.
97 Please note that 2- and 3-button pads are fairly rare and old. You might
98 want to filter gamepads that do not report all four.
99 2-Button Pad:
100 If only 2 action-buttons are present, they are reported as BTN_SOUTH and
101 BTN_EAST. For vertical layouts, the upper button is BTN_EAST. For
102 horizontal layouts, the button more on the right is BTN_EAST.
103 3-Button Pad:
104 If only 3 action-buttons are present, they are reported as (from left
105 to right): BTN_WEST, BTN_SOUTH, BTN_EAST
106 If the buttons are aligned perfectly vertically, they are reported as
107 (from top down): BTN_WEST, BTN_SOUTH, BTN_EAST
108 4-Button Pad:
109 If all 4 action-buttons are present, they can be aligned in two
110 different formations. If diamond-shaped, they are reported as BTN_NORTH,
111 BTN_WEST, BTN_SOUTH, BTN_EAST according to their physical location.
112 If rectangular-shaped, the upper-left button is BTN_NORTH, lower-left
113 is BTN_WEST, lower-right is BTN_SOUTH and upper-right is BTN_EAST.
114
115D-Pad:
116 Every gamepad provides a D-Pad with four directions: Up, Down, Left, Right
117 Some of these are available as digital buttons, some as analog buttons. Some
118 may even report both. The kernel does not convert between these so
119 applications should support both and choose what is more appropriate if
120 both are reported.
121 Digital buttons are reported as:
122 BTN_DPAD_*
123 Analog buttons are reported as:
124 ABS_HAT0X and ABS_HAT0Y
125
126Analog-Sticks:
127 The left analog-stick is reported as ABS_X, ABS_Y. The right analog stick is
128 reported as ABS_RX, ABS_RY. Zero, one or two sticks may be present.
129 If analog-sticks provide digital buttons, they are mapped accordingly as
130 BTN_THUMBL (first/left) and BTN_THUMBR (second/right).
131
132Triggers:
133 Trigger buttons can be available as digital or analog buttons or both. User-
134 space must correctly deal with any situation and choose the most appropriate
135 mode.
136 Upper trigger buttons are reported as BTN_TR or ABS_HAT1X (right) and BTN_TL
137 or ABS_HAT1Y (left). Lower trigger buttons are reported as BTN_TR2 or
138 ABS_HAT2X (right/ZR) and BTN_TL2 or ABS_HAT2Y (left/ZL).
139 If only one trigger-button combination is present (upper+lower), they are
140 reported as "right" triggers (BTN_TR/ABS_HAT1X).
141
142Menu-Pad:
143 Menu buttons are always digital and are mapped according to their location
144 instead of their labels. That is:
145 1-button Pad: Mapped as BTN_START
146 2-button Pad: Left button mapped as BTN_SELECT, right button mapped as
147 BTN_START
148 Many pads also have a third button which is branded or has a special symbol
149 and meaning. Such buttons are mapped as BTN_MODE. Examples are the Nintendo
150 "HOME" button, the XBox "X"-button or Sony "P" button.
151
152Rumble:
153 Rumble is adverticed as FF_RUMBLE.
154
155----------------------------------------------------------------------------
156 Written 2013 by David Herrmann <dh.herrmann@gmail.com>