Skip to content

Commit e7412ba

Browse files
endriftdtor
authored andcommitted
Input: xpad - use new BTN_GRIP* buttons
Map paddles to the newly defined BTN_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 97c01e6 commit e7412ba

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

drivers/input/joystick/xpad.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@ static const signed short xpad_abs_triggers[] = {
475475

476476
/* used when the controller has extra paddle buttons */
477477
static const signed short xpad_btn_paddles[] = {
478-
BTN_TRIGGER_HAPPY5, BTN_TRIGGER_HAPPY6, /* paddle upper right, lower right */
479-
BTN_TRIGGER_HAPPY7, BTN_TRIGGER_HAPPY8, /* paddle upper left, lower left */
478+
BTN_GRIPR, BTN_GRIPR2, /* paddle upper right, lower right */
479+
BTN_GRIPL, BTN_GRIPL2, /* paddle upper left, lower left */
480480
-1 /* terminating entry */
481481
};
482482

@@ -1070,10 +1070,10 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
10701070
data[18] = 0;
10711071

10721072
/* Elite Series 2 split packet paddle bits */
1073-
input_report_key(dev, BTN_TRIGGER_HAPPY5, data[18] & BIT(0));
1074-
input_report_key(dev, BTN_TRIGGER_HAPPY6, data[18] & BIT(1));
1075-
input_report_key(dev, BTN_TRIGGER_HAPPY7, data[18] & BIT(2));
1076-
input_report_key(dev, BTN_TRIGGER_HAPPY8, data[18] & BIT(3));
1073+
input_report_key(dev, BTN_GRIPR, data[18] & BIT(0));
1074+
input_report_key(dev, BTN_GRIPR2, data[18] & BIT(1));
1075+
input_report_key(dev, BTN_GRIPL, data[18] & BIT(2));
1076+
input_report_key(dev, BTN_GRIPL2, data[18] & BIT(3));
10771077

10781078
do_sync = true;
10791079
}
@@ -1170,10 +1170,10 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
11701170
data[32] = 0;
11711171

11721172
/* OG Elite Series Controller paddle bits */
1173-
input_report_key(dev, BTN_TRIGGER_HAPPY5, data[32] & BIT(1));
1174-
input_report_key(dev, BTN_TRIGGER_HAPPY6, data[32] & BIT(3));
1175-
input_report_key(dev, BTN_TRIGGER_HAPPY7, data[32] & BIT(0));
1176-
input_report_key(dev, BTN_TRIGGER_HAPPY8, data[32] & BIT(2));
1173+
input_report_key(dev, BTN_GRIPR, data[32] & BIT(1));
1174+
input_report_key(dev, BTN_GRIPR2, data[32] & BIT(3));
1175+
input_report_key(dev, BTN_GRIPL, data[32] & BIT(0));
1176+
input_report_key(dev, BTN_GRIPL2, data[32] & BIT(2));
11771177
} else if (xpad->packet_type == PKT_XBE2_FW_OLD) {
11781178
/* Mute paddles if controller has a custom mapping applied.
11791179
* Checked by comparing the current mapping
@@ -1183,10 +1183,10 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
11831183
data[18] = 0;
11841184

11851185
/* Elite Series 2 4.x firmware paddle bits */
1186-
input_report_key(dev, BTN_TRIGGER_HAPPY5, data[18] & BIT(0));
1187-
input_report_key(dev, BTN_TRIGGER_HAPPY6, data[18] & BIT(1));
1188-
input_report_key(dev, BTN_TRIGGER_HAPPY7, data[18] & BIT(2));
1189-
input_report_key(dev, BTN_TRIGGER_HAPPY8, data[18] & BIT(3));
1186+
input_report_key(dev, BTN_GRIPR, data[18] & BIT(0));
1187+
input_report_key(dev, BTN_GRIPR2, data[18] & BIT(1));
1188+
input_report_key(dev, BTN_GRIPL, data[18] & BIT(2));
1189+
input_report_key(dev, BTN_GRIPL2, data[18] & BIT(3));
11901190
} else if (xpad->packet_type == PKT_XBE2_FW_5_EARLY) {
11911191
/* Mute paddles if controller has a custom mapping applied.
11921192
* Checked by comparing the current mapping
@@ -1198,10 +1198,10 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
11981198
/* Elite Series 2 5.x firmware paddle bits
11991199
* (before the packet was split)
12001200
*/
1201-
input_report_key(dev, BTN_TRIGGER_HAPPY5, data[22] & BIT(0));
1202-
input_report_key(dev, BTN_TRIGGER_HAPPY6, data[22] & BIT(1));
1203-
input_report_key(dev, BTN_TRIGGER_HAPPY7, data[22] & BIT(2));
1204-
input_report_key(dev, BTN_TRIGGER_HAPPY8, data[22] & BIT(3));
1201+
input_report_key(dev, BTN_GRIPR, data[22] & BIT(0));
1202+
input_report_key(dev, BTN_GRIPR2, data[22] & BIT(1));
1203+
input_report_key(dev, BTN_GRIPL, data[22] & BIT(2));
1204+
input_report_key(dev, BTN_GRIPL2, data[22] & BIT(3));
12051205
}
12061206
}
12071207

0 commit comments

Comments
 (0)