Skip to content

Commit 97c01e6

Browse files
endriftdtor
authored andcommitted
Input: Add and document BTN_GRIP*
Many controllers these days have started including grip buttons. As there has been no particular assigned BTN_* constants for these, they've been haphazardly assigned to BTN_TRIGGER_HAPPY*. Unfortunately, the assignment of these has varied significantly between drivers. Add and document new constants for these grip buttons. Signed-off-by: Vicki Pfau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent a43a503 commit 97c01e6

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

Documentation/input/gamepad.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@ Gamepads report the following events:
190190

191191
Rumble is advertised as FF_RUMBLE.
192192

193+
- Grip buttons:
194+
195+
Many pads include buttons on the rear, usually referred to as either grip or
196+
rear buttons, or paddles. These are often reprogrammable by the firmware to
197+
appear as "normal" buttons, but are sometimes exposed to software too. Some
198+
notable examples of this are the Steam Deck, which has R4, R5, L4, and L5 on
199+
the back; the Xbox Elite pads, which have P1-P4; and the Switch 2 Pro
200+
Controller, which has GL and GR.
201+
202+
For these controllers, BTN_GRIPR and BTN_GRIPR2 should be used for the top
203+
and bottom (if present) right grip button(s), and BTN_GRIPL and BTN_GRIPL2
204+
should be used for the top and bottom (if present) left grip button(s).
205+
193206
- Profile:
194207

195208
Some pads provide a multi-value profile selection switch. Examples include

drivers/hid/hid-debug.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,6 +3291,8 @@ static const char *keys[KEY_MAX + 1] = {
32913291
[BTN_TR2] = "BtnTR2", [BTN_SELECT] = "BtnSelect",
32923292
[BTN_START] = "BtnStart", [BTN_MODE] = "BtnMode",
32933293
[BTN_THUMBL] = "BtnThumbL", [BTN_THUMBR] = "BtnThumbR",
3294+
[BTN_GRIPL] = "BtnGripL", [BTN_GRIPR] = "BtnGripR",
3295+
[BTN_GRIPL2] = "BtnGripL2", [BTN_GRIPR2] = "BtnGripR2",
32943296
[BTN_TOOL_PEN] = "ToolPen", [BTN_TOOL_RUBBER] = "ToolRubber",
32953297
[BTN_TOOL_BRUSH] = "ToolBrush", [BTN_TOOL_PENCIL] = "ToolPencil",
32963298
[BTN_TOOL_AIRBRUSH] = "ToolAirbrush", [BTN_TOOL_FINGER] = "ToolFinger",

include/uapi/linux/input-event-codes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@
601601
#define BTN_DPAD_LEFT 0x222
602602
#define BTN_DPAD_RIGHT 0x223
603603

604+
#define BTN_GRIPL 0x224
605+
#define BTN_GRIPR 0x225
606+
#define BTN_GRIPL2 0x226
607+
#define BTN_GRIPR2 0x227
608+
604609
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
605610
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
606611
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */

0 commit comments

Comments
 (0)